How can I add repulsion between all nodes, with this 3d force graph?

44 Views Asked by At

Starting from the "basic" example here: https://github.com/vasturiano/3d-force-graph

it already has this code:

const Graph = ForceGraph3D()(document.getElementById('3d-graph')).graphData(gData);

I want to add repulsion between each node and every other node (not just between each node and the node(s) it is linked to).

I tried adding forceManyBody() like this:

Graph.numDimensions(3).d3Force('charge', d3.forceManyBody().strength(-200));

but now the graph is 2D - its no longer 3D.

How can I add repulsion between all nodes (whether theyre linked or not) while keeping the graph as 3D?

0

There are 0 best solutions below