I have built a graph that dynamically loads a few hundreds (sometimes thousands) nodes using D3.js V4. As much as I try to tune its forces, there are clusters of nodes that may get less cluttered, but consequentially the repel forces push nodes that have no edges to the boundaries of the canvas.
It seems there is no easy way to set a single node without edges gravitate towards a closer distance to the center
Following is a screenshot (notice the node on the upper-right corner):
Here are the forces involved:
var repelForce = d3.forceManyBody()
.strength(-200)
.distanceMax(400)
.distanceMin(150);
var gSimulation = d3.forceSimulation()
.force('link', d3.forceLink().id((d) => d.id))
.force('charge', repelForce)
.force('center', d3.forceCenter(gwidth / 2, gheight / 2));
Looking forward to alternative ways to tune or optimize nodes that are specifically un-edged...