vis-network
vis-network copied to clipboard
Example of tree with custom edge lengths, and repulsion between nodes
Hi,
First of all you didn't provide any example of graph with target length specified for each edge, such that the physics really converges approximatively to the specific edges. So there is what I got: demo
Note the "change edge length" button.
After many different attempts I used
var options ={physics: {solver:"repulsion",timestep:0.05,repulsion: {gravitationalConstant:0, avoidOverlap: 100,nodeDistance:10000,centralGravity: 0, springLength: 100, springConstant: 0.37, damping: 0.7}}};
I usedsolver:"repulsion"
and "smooth":false
because it wasn't working otherwise, that is the simulation often converged to edge lengths quite different to the ones I specified.
Now I have some troubles customizing the main parameters:
-
the simulation speed, ie. the speed at which the physics converges to the new specified edge length.
-
the (negative) gravity between the nodes, here I'd want to avoid overlapping nodes
Thank you.