<h1>Force Graph Demo</h1>
<div id="graph"></div>
body {
margin: 20px auto;
font-family: 'Lato';
font-weight: 300;
overflow: hidden;
}
h1 {
text-align: center;
}
// Random tree
const N = 30;
const gData = {
nodes: [Array(N).keys()].map((i) => ({ id: i })),
links: [Array(N).keys()]
.filter((id) => id)
.map((id) => ({
source: id,
target: Math.round(Math.random() * (id - 1))
}))
};
const Graph = ForceGraph()(document.getElementById("graph"))
.linkDirectionalParticles(2)
.graphData(gData);