How to Achieve Deterministic Graph Layout
Questions & AnswersSummary
Description
As a general precondition to facilitate deterministic graph layout in different scenarios, the graph structure should remain unaltered between algorithm runs. This includes the following items (most relevant first):
- The sequence of nodes and also the sequence of edges should not be changed.
- The sequence of edges at the nodes should not be changed either.
- In scenarios where (strong) port constraints are obeyed, they should remain unchanged, too.
The sections below describe common scenarios where non-deterministic layout results can arise, and offer practical solutions.
Switching to Deterministic Mode with Some Layout Algorithms
Normally, classes OrganicLayouter
To get deterministic results this behavior can be changed by using properties
ActivateDeterministicMode
and
Deterministic
,
respectively.
Analogously, to obtain deterministic results for
OrthogonalLayouter
the randomization has to be disabled using property
UseRandomization
.
"From Sketch"/"As Is" Layout
The layout algorithms provided by classes IncrementalHierarchicLayouterOf course, the main precondition for deterministic layout using a given node placement is the placement to remain unaltered when running the layout multiple times.
Setting (Increasing) the Time Limit
With huge graphs or really slow computers there is the possibility to reach a computation time limit. Reaching the time limit eventually ends the computation, returning its current result. Clearly, with modern operating systems this result is not guaranteed to be deterministic at all.Hence, to achieve deterministic results the time limit should offer enough room for ending the computation normally.