vasturiano / 3d-force-graph

3D force-directed graph component using ThreeJS/WebGL
https://vasturiano.github.io/3d-force-graph/example/large-graph/
MIT License
4.8k stars 831 forks source link

Weights for edges #376

Open adminy opened 4 years ago

adminy commented 4 years ago

Is your feature request related to a problem? Please describe. The force directed graph has no weights you could specify on the edges.

Describe the solution you'd like To have weight between two nodes not just saying that it is connected but that it's connected this amount. This should spring two nodes closer or further with more variation.

Describe alternatives you've considered None.

Additional context None.

vasturiano commented 4 years ago

@adminy you can set a custom logic for how the length and strength of the link forces behave.

For instance:

myGraph.d3Force('link').strength(link => /* your logic */)

You can see the docs of the link force here: https://github.com/vasturiano/d3-force-3d#link_distance