Is there a way to define different physics for different sets of edges?
What I want to achieve, is to pull nodes together, who are in the same cluster, and to push those nodes away, who have a different cluster.
At the moment I define the physics in options:
const options = {
physics: {
enabled: true,
barnesHut: {
gravitationalConstant: -80000,
springConstant: 0.001,
springLength: 200,
centralGravity: 0,
},
},
};
While reading the documentation, I figured out that there is no way to set different physics.
But there is a way to deactivate the physics for specific nodes or edges.
Therefore you have to override the global options for the nodes/ edges. This can be achieved by defining the options in the node/edge itself.
In this example, the edges [from 1 to 3] and [from 1 to 2] are overriding the global physics options and therefore they don't act as springs.