d3 / d3-force

Force-directed graph layout using velocity Verlet integration.
https://d3js.org/d3-force
ISC License
1.82k stars 377 forks source link

Go back to position Verlet? #158

Open mbostock opened 4 years ago

mbostock commented 4 years ago

When this module was broken out for D3 3.x, we switched from position to velocity Verlet. I believe the idea was to avoid certain ordering effects and instabilities as a result of forces incrementally modifying node positions as they ran. However, the new force layout feels… more sluggish than the old one. Here’s an example:

https://bl.ocks.org/mbostock/7881887 https://observablehq.com/@d3/clustered-bubbles-2

Going back to the D3 3.x method of integration would be disruptive (for custom forces), but it’s worth considering.

Fil commented 4 years ago

I don't notice any sluggishness nor a big difference in the time to reach an arbitrary energy threshold? See https://observablehq.com/d/5a863352b0e1c1a7

It seems possible for each force to decide on offering a choice as .method("velocity" || "position")