Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Re-running force-simulation takes nodes farther and farther apart #228
Describe the bug
When deleting a node from a cluster or dragging a node, the simulation is being re-run. This, however will move clusters farther and farther apart. It can easily be seen in the dynamic data example. I know that this is more or less related to
Distribution within the original space without widening the space on every iteration.
Anyway, thanks for this awesome demonstration of d3 + three.js!
I managed to solve my problem by using the radial force and putting clusters of nodes onto different layers, e.g.:
simulation .force("center", forceCenter()) .force("charge", forceManyBody()) .force("link", forceLink()) .force("radial", forceRadial(node => 300 / node.weight))
This will move nodes with low weight to the outer edge while keeping nodes with heavier weights in the center.