I have a force-directed graph using d3.js, part of the code is like:
simulation
.force("center", d3.forceCenter(width / 2, height / 2))
.force("nodes", d3.forceManyBody())
.force(
"links",
d3
.forceLink(links)
.id(d => d.id)
.distance(d => 5 * (d.source.size + d.target.size))
)
.on("tick", ticked);
this line determines the force between linked nodes:
.distance(d => 5 * (d.source.size + d.target.size))
however, I would like to provide a force between unlinked nodes (ideally, the force would increase as the degree of freedom increases).
How can I accomplish this?
these seem to do the trick:
how can I change these forces dynamically as the animation progresses?