self-sorting nodes in d3 fdg
Force Directed Graph with self sorting nodes - Inertial winnowing
Features
- Collisions between nodes
Based on this example but enhanced to simulate inertia. The distance each node is moved away from the collision is proportional to their relative mass. Since gravity is switched on and friction is set for low damping, the heavier nodes will move towards the center of the graph and the smaller nodes pushed out of the way. The mass is calculated assuming the nodes are spheres, using r3, and the rebounds calculated according to relative "mass".
force.alpha(a/0.99*(1 - x))
d3 features used
- d3.layout.force
- Ordinal Scales
- d3.format
- d3.range
- d3.geom.quadtree