With more than 30 nodes linked to a parent node in an Arbor.js visualization, the parent node oscillates between opposite sides of the cluster - gif.
Reproducible with this repo - check it out, spin up a local server (python -m SimpleHTTPServer 8080
), and point your webbrowser at localhost:8080
.
The graph appears stable at 30 nodes, unstable-but-still-centralized at 35, and totally unstable at 40.
I think this is because, when the parent node is outside the centre of the cluster, the "pull" of all the child nodes pulls it so hard that, on the next "tick", it is located beyond the cluster on the opposite side. I guess this could be fixed by putting a limit on either the total force that can be exerted on a single node, or the maximum distance that a node can move in a single tick - but I don't know how to do either - sys.bounds()
doesn't do what I want.
You can fix this by adjusting the repulsion/stiffness/friction - most simply in this case, by increasing the friction from 0.5 to 0.6 will let you have 40 items around a central node.