IncrementalHierarchicLayouter: Runtime vs Quality
Tips & TricksSummary
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.
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);