IncrementalHierarchicLayouter: Runtime vs Quality
Applies to: yFiles for Java 2.8, 2.7, 2.6, 2.5, 2.4 print article email article

Type: Tips & Tricks

This article shows how to configure the IncrementalHierarchicLayouter in order to improve the required runtime.

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.
Note
The actual runtime may exceed the maximal duration since the layout algorithm still has to find a valid solution.

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);
Note
Speeding up the IncrementalHierarchicLayouter with the above settings may increase the number of crossings and produce less compact layouts (regarding the horizontal direction).

Keywords: runtime - performance - IncrementalHierarchicLayouter - IHL

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2012 yWorks · ALL RIGHTS RESERVED imprint | terms of use | privacy policy | home