How to Achieve Deterministic Graph Layout

Questions & Answers

Summary

Achieving deterministic graph layout depends on a number of factors in different scenarios.

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):

  1. The sequence of nodes and also the sequence of edges should not be changed.
  2. The sequence of edges at the nodes should not be changed either.
  3. 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 and SmartOrganicLayouter use randomization when computing a layout.

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 IncrementalHierarchicLayouter and OrganicLayouter support layout computation based on a given node placement. This feature is referred to as "From Sketch" and "As Is" layout, respectively.

Of 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.

Categories this article belongs to:
yFiles for Silverlight > yFiles for Silverlight Algorithms > Automatic Graph Layout
yFiles.NET > yFiles.NET Algorithms > Automatic Graph Layout
yFiles WPF > yFiles WPF Algorithms > Automatic Graph Layout
Applies to:
yFiles.NET: 4.0, 4.1, 4.2, 4.3
yFiles WPF: 2.0, 2.1, 2.2, 2.3, 2.4
yFiles for Silverlight: 1.0, 1.0.1, 2.0, 2.1, 2.2, 2.3
Keywords:
time - limit - deterministic - organic - orthogonal - hierarchic - hierarchical - layout - randomization - As - Is