Your JSON doesn't show up in Sigma because by default Sigma's parser needs X and Y coordinates for the nodes.
What you can do is either to add X and Y coordinates to JSON file, or if you don't want to do that (probably you will want to apply ForceAtlas layout to them, for example), then you could do something like this:
// these are just some preliminary settings
var g = {
nodes: [],
edges: []
};
// Create new Sigma instance in graph-container div (use your div name here)
s = new sigma({
graph: g,
container: 'graph-container',
renderer: {
container: document.getElementById('graph-container'),
type: 'canvas'
},
settings: {
minNodeSize: 8,
maxNodeSize: 16
}
});
// first you load a json with (important!) s parameter to refer to the sigma instance
sigma.parsers.json(
'/data/your-jsonfile.json',
s,
function() {
// this below adds x, y attributes as well as size = degree of the node
var i,
nodes = s.graph.nodes(),
len = nodes.length;
for (i = 0; i < len; i++) {
nodes[i].x = Math.random();
nodes[i].y = Math.random();
nodes[i].size = s.graph.degree(nodes[i].id);
nodes[i].color = nodes[i].center ? '#333' : '#666';
}
// Refresh the display:
s.refresh();
// ForceAtlas Layout
s.startForceAtlas2();
}
);
You will also need to include ForceAtlas2 plugin in your scripts.
If you don't want to use ForceAtlas and just want random layout, remove s.startForceAtlas2(); string above.