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

Is there a way to avoid superposition of edges & nodes ? #153

Closed redouane59 closed 4 years ago

redouane59 commented 4 years ago

Hi,

In this example, we could think that there is a link between these two nodes : image but in reality they are not connected, the edge is just passing through this node to go to another one. image

Is there a way to avoid this behavior please ?

mbostock commented 4 years ago

There’s nothing built-in to prevent this, but possibly you could write a custom force that tries to avoid edges passing through unrelated nodes.

redouane59 commented 4 years ago

Hi @mbostock , do you have an idea to disable the fact that the edges / the nodes tend to be always aligned with other elements on the same line when moving them which provokes this behavior ? see : https://twitter-social-graph.firebaseapp.com/index.html Maybe the forceCollide method is guilty ? https://github.com/redouane59/social-media-raiser/blob/master/social-graph/public/index.html