Limit distance between nodes


We're using a ForceDirected layout.
By increasing MaxIterations and ElectricalCharge we get the right diagram.
But the nodes are to far apart fo our purpose.
Increasing springstiffness does not help as the nodes go even further apart above a certain level and doc says to use only small values.
Gravitational mass does not do anything at all. No doc or example found.
Played around with all parameters and searched this forum endlessly.
Finally we just increased the font of the nodes and lowered the scale.
Looking for a better solution, because a smaller scale has impact on the tickness of all rectangles in the diagram (selectiontool, node selection, overview rectangle, etc...)

Usually all you need to do is to reduce the value of the SpringLength.
You can do that for all springs (links) by setting ForceDirectedLayout.DefaultSpringLength.
Or you can do that for individual edges by overriding SpringLength or setting ForceDirectedEdge.Length.

However, depending on the counter-acting forces, there is a limit to how much decreasing the spring length will allow the nodes to get closer to each other. You mention increasing the ElectricalCharge – that will just make it harder to allow nodes to get closer to each other. And since electrical fields vary by the (inverse) square of the distance while spring forces vary linearly, the electrical charge values will dominate when the distances get short.

Thank you for the prompt reply.
Actually, SpringLength is already at 0
We noticed exactly what you are saying, there's no control when increasing ElectricCharge.
Although we need the extra energy to push not linked elements away from each other.
Normally having sufficient spring stiffness would be able to counteract this. (although linear, power is power in the end)
I don't quit understand why increasing spring stiffness gets such a jittery result as the formula used is just linear. (sometimes links get even longer with higher stiffness ), could you please explain?
Is there any way we could use the gravitational mass to pull only linked elements closer to each other?
(Don't understand the gravity either, not much documentation/no sample found)
Or have a different electrical charge between linked and not linked elements?
Or whatever you think suitable?

Electrical forces are meant to apply to all nodes, even if “unrelated” by links.
Spring forces only apply to nodes when connected by a link.

Making springs too stiff does cause “jitteriness” because it reduces the “give” so the system cannot “relax”. Any little change forces movements in all of the connected nodes.

How large are your nodes? Do you have really large nodes that you want to position relatively close to each other? I can see how that kind of situation would not be achieved very well if you want to avoid node overlaps.

Our nodes are quite normal size. (two lines of 30 characters)

It's just that the links become too long compared to the node size.
To resolve this we increased the nodes (font)size and lowered the scale.
This gets the desired effect, but a lot of lower scale side effects (explained above)
So we would like to make the links shorter instead of increasing the nodes.
How can increasing spring stiffness result in even longer links?
Node overlap is not the problem per se. The overal picture is just a lot different with lower energy. More intertwined, less spread out.
Is gravitation between linked node possible?

Gravitational force is normally a constant in one direction regardless of position. But you could override the GravitationalFieldX and GravitationalFieldY methods to make it non-uniform. Still, I don’t think it can help you with this particular issue.

If you don’t set any properties (or override any methods) and then decrease the SpringLength, don’t you see that the nodes get closer together? However, as I said, how close the nodes can be together is limited by the electrical charge. Try reducing that value too, and the nodes should be noticeably closer.