( a feature of FlowChartX Pro edition)
Implements the Spring-Embedder graph layout algorithm.
VB6
![]() |
---|
Public Class SpringLayout |
C++
![]() |
---|
class SpringLayout |
Spring-Embedder produces layouts having uniform distribution of nodes by simulating a physical system in which nodes repulse each other and the links between them act as confining springs. Nodes are moved around in an iterative process. The forces that act on a node are calculated, taking in account the positions of surrounding nodes and links from the previous iteration.
To apply this layout to a diagram, create an instance of SpringLayout, set its properties and pass it to ArrangeDiagram. If there are several unconnected graphs in the diagram, it is possible to specify which of them to arrange by means of the Root property.
The final appearance of arranged graphs depends mostly on the values of EnableClusters and NodeDistance properties that specify how nodes are distributed by the layout routine. Enabling the MinimizeCrossings property helps to decrease the number of link crossings, though that makes the algorithm run somewhat slower.
The layout routine runs as much iterations as set in NumIterations, calculating better node positions at each step. When that stage of the algorithm completes, if ArrowAnchoring is enabled arrow ends are aligned to nodes' anchor points.