IncrementalHierarchicLayouter: Runtime vs Quality

Tips & Tricks

Summary

This article shows how to configure the IncrementalHierarchicLayouter in order to improve the required runtime.
For a better user experience, please go to the integrated documentation viewer to read this article.

Description

Applying the IncrementalHierarchicLayouter to large graphs often results in a high layout runtime. The IncrementalHierarchicLayouter provides several parameters which can be used to satisfy different user preferences and to control the quality of the resulting layouts as well as the runtime needed for its calculation. Note, that in general, quality and runtime are conflicting objectives. While for smaller graphs quality is often the main objective, the required runtime gets more important for larger graphs. For larger graphs some settings improving quality are less important since the main focus for those graphs does not lie in showing every detail.

Since yFiles for Java 2.7, the IncrementalHierarchicLayouter allows specifying a preferred time limit (in milliseconds) using method setMaximalDuration(long). Dependent on the specified time as well as the graph size, the layout algorithm automatically skips/disables some of these settings.

The actual runtime may exceed the maximal duration since the layout algorithm still has to find a valid solution.
Since yFiles for Java 2.11, class AbortHandler can be used to force an early termination of the layout process, independent of the specified time limit and quality settings.


For yFiles versions prior to 2.7 the following setting may reduce the runtime of the IncrementalHierarchicLayouter significantly.

IncrementalHierarchicLayouter ihl = new IncrementalHierarchicLayouter();

//configure the node placer
SimplexNodePlacer nodePlacer = new SimplexNodePlacer();
nodePlacer.setBaryCenterModeEnabled(false);
nodePlacer.setHorizontalCompactionEnabled(false);
nodePlacer.setBreakLongSegmentsEnabled(false);
nodePlacer.setGroupCompactionStrategy(SimplexNodePlacer.GROUP_COMPACTION_NONE);
ihl.setNodePlacer(nodePlacer);

//configure the layer sequencer
DefaultLayerSequencer layerSequencer = new DefaultLayerSequencer();
layerSequencer.setTranspositionEnabled(false);
layerSequencer.setMaximalDuration(10000); //sets the maximal duration in milliseconds
ihl.setFromScratchSequencer(layerSequencer);
Speeding up the IncrementalHierarchicLayouter with the above settings may increase the number of crossings and produce less compact layouts (regarding the horizontal direction).

Categories this article belongs to:
yFiles for Java > yFiles Layout > Automatic Graph Layout > Incremental Hierarchical Layout
Applies to:
yFiles for Java 2: 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18
Keywords:
runtime - performance - IncrementalHierarchicLayouter - IHL