JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgit.com/Linkurious/linkurious.js/develop/dist/sigma.min.js"></script>
<div id="graph-container"></div>
CSS
#graph-container {
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
}
JavaScript
var i,
s,
N = 100,
E = 500,
g = {
nodes: [],
edges: []
};
// Generate a random graph:
for (i = 0; i < N; i++)
g.nodes.push({
id: 'n' + i,
label: 'Node ' + i,
x: Math.random(),
y: Math.random(),
size: Math.random()*2+1,
color: '#333'
});
for (i = 0; i < E; i++)
g.edges.push({
id: 'e' + i,
source: 'n' + (Math.random() * N | 0),
target: 'n' + (Math.random() * N | 0),
size: Math.random(),
color: 'rgba(10,20,30,0.15)'
});
// Instantiate sigma:
s = new sigma({
graph: g,
container: 'graph-container'
});