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();
SimplexNodePlacer nodePlacer = new SimplexNodePlacer();
nodePlacer.setBaryCenterModeEnabled(false);
nodePlacer.setHorizontalCompactionEnabled(false);
nodePlacer.setBreakLongSegmentsEnabled(false);
nodePlacer.setGroupCompactionStrategy(SimplexNodePlacer.GROUP_COMPACTION_NONE);
ihl.setNodePlacer(nodePlacer);
DefaultLayerSequencer layerSequencer = new DefaultLayerSequencer();
layerSequencer.setTranspositionEnabled(false);
layerSequencer.setMaximalDuration(10000); 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). |