( a feature of FlowChartX Pro edition)
Implements a simulated annealing graph layout algorithm.
VB6
![]() |
---|
Public Class AnnealLayout |
C++
![]() |
---|
class AnnealLayout |
Simulated Annealing is a general-purpose optimization method used to solve large-scale combinatorial problems by simulating the process of heating and cooling of metal to achieve freedom from defects. Finding a nice arrangement of a graph is a combinatorial problem that can be reduced to assigning costs to graph configurations and finding the minimum cost configuration. In that case, a cost is assigned to a graph configuration by evaluating different aesthetic criteria such as distance between nodes, length of links and the number of link crossings.
The AnnealLayout class implements a Simulated Annealing layout algorithm that can be used to arrange the elements of a FlowChart. To apply it, create an AnnealLayout instance, set its properties and pass it to the ArrangeDiagram method.
The algorithm starts the simulation with the temperature set in InitialTemperature, and runs several cooling Stages. At each stage the algorithm evaluates several graph configurations for each node, as set in IterationsPerStage. At the end of each stage, the algorithm selects the configuration that has a minimum cost and decreases the temperature by multiplying it by TemperatureScale. The relative weight of an aesthetic criterion relative to the other criteria is set by the DistributionFactor, LinkLengthFactor, BoundaryFactor and CrossingLinksCost properties.
Anchoring specifies whether the layout algorithm must attach links to the anchor points of graphs nodes. The layout algorithm produces best results if it can place link ends at arbitrary positions over the nodes outlines, that is, when using the ancIgnore value. If your application logic requires links to be always attached to anchor points, use the other two values. In such cases ancReassign would yield better results.