This layout algorithm arranges graphs in a hierarchic fashion.
Remarks
Layout Style
The nodes are distributed into layers so that most of the edges point to the main layout direction. The order of the nodes within the layers ensures that the number of edge crossings is as small as possible. There are different edge routing styles available. Edges can be orthogonal, polyline, octilinear or curved (see HierarchicLayoutRoutingStyle for details).
Hierarchical diagrams are commonly used for the visualization of hierarchical data, since they facilitate the identification of dependencies and relationships among the nodes of the graph. Possible application domains are the following: workflow visualization, call graph visualization, entity-relationship diagrams, biochemical pathways and network management.
Concept
The layout algorithm runs in three main phases:
- Layering – The nodes are distributed into layers by means of fromScratchLayerer or fixedElementsLayerer, respectively. If the layout orientation is top-to-bottom, the nodes in each layer are arranged horizontally while the layers are ordered vertically top-to-bottom.
- Sequencing – The order of the nodes in each layer is determined such that the number of edge crossings is as small as possible. To specify the sequencing algorithm, use fromScratchSequencer or fixedElementsSequencer.
- Drawing – The layout algorithm assigns the final coordinates to all nodes and routes the edges.
Features
This layout algorithm is able to create hierarchic layouts from scratch or add new elements to the existing sketch drawing incrementally. In order to add elements incrementally to the current sketch or let the algorithm optimize certain elements in the current sketch, set the layout mode to INCREMENTAL. Then register a IDataProvider (e.g. use createHashedDataMap) with the graph using the INCREMENTAL_HINTS_DP_KEY DataProvider key and associate the hints obtained from the IIncrementalHintsFactory with the elements to be added incrementally.
HierarchicLayoutNodeLayoutDescriptor and HierarchicLayoutEdgeLayoutDescriptor instances can be used for specifying individual information (e.g. distances or routing styles) for each node and edge in the graph. The descriptors are bound to the graph using IDataProviders registered with NODE_LAYOUT_DESCRIPTOR_DP_KEY or EDGE_LAYOUT_DESCRIPTOR_DP_KEY. If there is no descriptor assigned to some nodes/edges, a default descriptor will be used. To set default descriptors use nodeLayoutDescriptor and edgeLayoutDescriptor.
HierarchicLayout supports two approaches to connect edges on a specific side or even an exact location to a node. PortConstraints define a single constraint for the ports of an edge. To realize more complex port restrictions, several PortCandidates or PortCandidateSets can be assigned to edges or nodes. If an edge with registered PortCandidates connects to nodes with PortCandidateSets, the algorithm will try to match both collections to find an appropriate port. In case there is no matching port candidate, a PortCandidate specified for the edge is preferred. For the matching to work properly, the candidates in both collection need to be the same instances. Since their simultaneous existence at the same node may be ambiguous, it is not recommended to use a combination of PortConstraints and PortCandidates in the same layout. Furthermore, PortCandidates with multiple directions (e.g. EAST or WEST) are not supported. To model that an edge should connect at one of several sides, define multiple candidates instead, where each candidate has a single direction.
The edge grouping feature of this layout algorithm is restricted to normal, hierarchic edges. Edges with recursive edge style DIRECTED or UNDIRECTED will not be grouped. They are also not grouped when enabling automatic edge grouping.
The port grouping feature (see SOURCE_PORT_GROUP_ID_DP_KEY and TARGET_PORT_GROUP_ID_DP_KEY) allows to specify edges that share the same port location at their source/target. However, unlike as for edge grouping, edges with port groups will be routed independently without sharing segments. Port grouping has similar restrictions as the edge grouping feature. In addition, port grouping is not considered for self-loops.
The HierarchicLayout also supports node types as a subordinate criterion during the sequencing of nodes within their layer. More precisely, the sequencing algorithm prefers to place nodes of the same type next to each other if this does not induce additional crossings or conflicts with other constraints (like node groups, swimlanes, or sequence constraints). The algorithm uses an additional local optimization heuristic to improve the placement with respect to node types and, thus, does not guarantee optimal results. Furthermore, this additional step may increase the required runtime. Note that node types do not affect the layer assignment.
HierarchicLayout allows restricting the maximum duration which may be a suitable option to reduce the runtime required for large graphs. Note that restricting the maximum duration may result in a lower layout quality. Furthermore, the actual runtime may exceed the maximum duration since the layout algorithm still has to find a valid solution.
Default Values of Properties
componentArrangementPolicy | TOPMOST
| Connected components are aligned with their first layer. |
componentLayoutEnabled | false | The stage that arranges connected graph components is activated. |
considerNodeLabels | false | Node labels are not considered. |
gridSpacing | 0 | There is no grid specified. |
groupAlignmentPolicy | CENTER
| Groups and normal nodes are center aligned. |
hideGroupsStageEnabled | false | The stage responsible for hiding group nodes is activated. |
integratedEdgeLabeling | false | Integrated edge labeling is disabled. |
layoutMode | FROM_SCRATCH
| |
maximumDuration | <code>0x7FFFFFFF</code> | The layout algorithm runs unrestricted. |
parallelEdgeRouterEnabled | false | The stage that routes parallel edges is activated. |
recursiveGroupLayering | true | Groups are layered recursively. |
selfLoopRouterEnabled | false | The stage that routes self-loops is activated. |
Type Details
- yfiles module
- layout-hierarchic
- yfiles-umd modules
- layout-familytree, layout-hierarchic, layout-radial, layout
- Legacy UMD name
- yfiles.hierarchic.HierarchicLayout
See Also
Constructors
Creates a new HierarchicLayout instance with the default settings.
Parameters
A map of options to pass to the method.
- groupAlignmentPolicy - GroupAlignmentPolicy
The group layer alignment strategy used for recursive group layering. This option sets the groupAlignmentPolicy property on the created object.
- compactGroups - boolean
Whether or not layer compaction for recursive group layering is active. This option sets the compactGroups property on the created object.
- componentArrangementPolicy - ComponentArrangementPolicy
The policy that specifies how to arrange connected components. This option sets the componentArrangementPolicy property on the created object.
- maximumDuration - number
The time limit (in milliseconds) set for the layout algorithm. This option sets the maximumDuration property on the created object.
- recursiveGroupLayering - boolean
Whether or not groups are respected during the layering stage. This option sets the recursiveGroupLayering property on the created object.
- gridSpacing - number
The equidistant spacing between the horizontal and vertical grid lines. This option sets the gridSpacing property on the created object.
- backLoopRouting - boolean
Whether or not reversed edges should be routed as back-loops. This option sets the backLoopRouting property on the created object.
- backLoopRoutingForSelfLoops - boolean
Whether or not self-loops should be routed in a similar manner as back-loops. This option sets the backLoopRoutingForSelfLoops property on the created object.
- automaticEdgeGrouping - boolean
Whether or not edges are grouped automatically. This option sets the automaticEdgeGrouping property on the created object.
- orthogonalRouting - boolean
Whether or not edges should be routed orthogonally. This option sets the orthogonalRouting property on the created object.
- integratedEdgeLabeling - boolean
Whether or not the layout algorithm reserves space for labels and places them. This option sets the integratedEdgeLabeling property on the created object.
- considerNodeLabels - boolean
Whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps. This option sets the considerNodeLabels property on the created object.
- minimumLayerDistance - number
The minimum distance between two adjacent layers. This option sets the minimumLayerDistance property on the created object.
- stopAfterLayering - boolean
Whether or not to stop the layout algorithm after the layering step. This option sets the stopAfterLayering property on the created object.
- stopAfterSequencing - boolean
Whether or not to stop the layout algorithm after the sequencing step. This option sets the stopAfterSequencing property on the created object.
- nodeToNodeDistance - number
The minimum distance between two adjacent nodes in one layer. This option sets the nodeToNodeDistance property on the created object.
- nodeToEdgeDistance - number
The minimum distance between an edge and an adjacent node in one layer. This option sets the nodeToEdgeDistance property on the created object.
- edgeToEdgeDistance - number
The minimum distance between two directly consecutive edges that pass through the same layer. This option sets the edgeToEdgeDistance property on the created object.
- separateLayers - boolean
Whether or not to separate layers. This option sets the separateLayers property on the created object.
- fromScratchLayeringStrategy - HierarchicLayoutLayeringStrategy
A predefined layering strategy for the from scratch layerer. This option sets the fromScratchLayeringStrategy property on the created object.
- fromScratchLayerer - ILayerer
The ILayerer instance that obtains the layering for the nodes if the layout algorithm runs in From Scratch mode. This option sets the fromScratchLayerer property on the created object.
- fromScratchSequencer - ISequencer
The ISequencer instance that calculates the node sequence if the layout algorithm runs in From Scratch mode. This option sets the fromScratchSequencer property on the created object.
- nodePlacer - IHierarchicLayoutNodePlacer
The IHierarchicLayoutNodePlacer instance that will calculate the final node placement of the layout. This option sets the nodePlacer property on the created object.
- fixedElementsLayerer - ILayerer
The ILayerer instance that obtains the layering for fixed nodes during the incremental layout run. This option sets the fixedElementsLayerer property on the created object.
- fixedElementsSequencer - ISequencer
The ISequencer instance that calculates the sequence of the fixed nodes during the incremental layout run. This option sets the fixedElementsSequencer property on the created object.
- layoutMode - LayoutMode
The layout mode this layouter should use for upcoming layouts. This option sets the layoutMode property on the created object.
- edgeLayoutDescriptor - HierarchicLayoutEdgeLayoutDescriptor
The HierarchicLayoutEdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned. This option sets the edgeLayoutDescriptor property on the created object.
- nodeLayoutDescriptor - HierarchicLayoutNodeLayoutDescriptor
The HierarchicLayoutNodeLayoutDescriptor instance used for all those nodes that do not have a specific layout descriptor assigned. This option sets the nodeLayoutDescriptor property on the created object.
- labeling - ILayoutStage
The ILayoutStage that places the labels of the input graph. This option sets the labeling property on the created object.
- selfLoopRouter - ILayoutStage
The ILayoutStage that routes self-loops. This option sets the selfLoopRouter property on the created object.
- parallelEdgeRouter - ILayoutStage
The ILayoutStage that routes parallel edges. This option sets the parallelEdgeRouter property on the created object.
- componentLayout - ILayoutStage
The ILayoutStage that arranges the connected components of an input graph. This option sets the componentLayout property on the created object.
- subgraphLayout - ILayoutStage
The ILayoutStage that constrains the layout process to a subgraph of the input graph. This option sets the subgraphLayout property on the created object.
- hideGroupsStage - ILayoutStage
The ILayoutStage that hides the group nodes of the input graph. This option sets the hideGroupsStage property on the created object.
- orientationLayout - ILayoutStage
The ILayoutStage that modifies the orientation of a computed layout. This option sets the orientationLayout property on the created object.
- orientationLayoutEnabled - boolean
Whether or not the ILayoutStage that modifies the orientation of the layout is activated. This option sets the orientationLayoutEnabled property on the created object.
- layoutOrientation - LayoutOrientation
The main orientation of the layout. This option sets the layoutOrientation property on the created object.
- selfLoopRouterEnabled - boolean
Whether or not the ILayoutStage used for routing self-loops is activated. This option sets the selfLoopRouterEnabled property on the created object.
- labelingEnabled - boolean
Whether or not the ILayoutStage used for placing the labels of the input graph is activated. This option sets the labelingEnabled property on the created object.
- hideGroupsStageEnabled - boolean
Whether or not the ILayoutStage used for hiding group nodes is activated. This option sets the hideGroupsStageEnabled property on the created object.
- componentLayoutEnabled - boolean
Whether or not the ILayoutStage used for arranging the components of the graph is activated. This option sets the componentLayoutEnabled property on the created object.
- parallelEdgeRouterEnabled - boolean
Whether or not the ILayoutStage used for routing parallel edges is activated. This option sets the parallelEdgeRouterEnabled property on the created object.
- subgraphLayoutEnabled - boolean
Whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This option sets the subgraphLayoutEnabled property on the created object.
Properties
Gets or sets whether or not edges are grouped automatically.
Remarks
Default Value
false
.Edges are not grouped automatically.
See Also
Sample Graphs
Gets or sets whether or not reversed edges should be routed as back-loops.
Remarks
Default Value
false
.There is no back-loop routing applied to reversed edges.
See Also
Sample Graphs
0
) are never routed as back-loops because they have no dedicated source/target node. Furthermore, for edges with a negative directedness value the source and target are interchanged.Gets or sets whether or not self-loops should be routed in a similar manner as back-loops.
Remarks
Default Value
false
.There is no back-loop routing applied to self-loops.
See Also
Sample Graphs
Gets or sets whether or not layer compaction for recursive group layering is active.
Remarks
Default Value
false
.The layer compaction is disabled.
See Also
Sample Graphs
Gets or sets the ILayoutStage that arranges the connected components of an input graph.
Default Value
ComponentLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for arranging the components of the graph is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that arranges connected graph components is activated.
See Also
Defined in
Gets or sets whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps.
Remarks
true
.Default Value
false
.Node labels are not considered.
Throws
- Exception({ name: 'InvalidOperationError' })
- if this property should be enabled but the current
is not of type - Exception({ name: 'InvalidOperationError' })
- if no properly configured
is registered even though this property was enabled earlier (can happen when manually specifying the ).
See Also
Sample Graphs
Gets the DefaultDrawingDistanceCalculator that is registered with the layout algorithm by default.
Throws
- Exception({ name: 'InvalidOperationError' })
- if the current instance returned by
is not an instance of
Gets or sets the HierarchicLayoutEdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned.
Remarks
Default Value
HierarchicLayoutEdgeLayoutDescriptor.Throws
- Exception({ name: 'ArgumentError' })
- if the
is null
See Also
Gets or sets the minimum distance between two directly consecutive edges that pass through the same layer.
Remarks
More precisely, the specified value is the minimum distance between the two vertical segments of these edges that traverse the layer. The algorithm does not consider this value if the layer contains other elements lying between the two edges (e.g., nodes or group node borders).
All values have to be greater than or equal to 0
.
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the distance is negative
- Exception({ name: 'InvalidOperationError' })
- if the current
is not an instance of
See Also
Sample Graphs
Gets or sets the ILayerer instance that obtains the layering for fixed nodes during the incremental layout run.
Default Value
AsIsLayerer.Throws
- Exception({ name: 'ArgumentError' })
- if the
is null
See Also
Gets or sets the ISequencer instance that calculates the sequence of the fixed nodes during the incremental layout run.
Default Value
AsIsSequencer.Throws
- Exception({ name: 'ArgumentError' })
- if the given
is null
See Also
Gets or sets the ILayerer instance that obtains the layering for the nodes if the layout algorithm runs in From Scratch mode.
Remarks
Default Value
WeightedLayerer.Throws
- Exception({ name: 'ArgumentError' })
- if the
is null
See Also
Gets or sets a predefined layering strategy for the from scratch layerer.
Remarks
The layouter assigns the nodes to separate layers. The nodes within each layer will be placed on the same horizontal layer. The layers will be arranged vertically starting with the small-numbered layers.
An important layering strategy for the hierarchic layout style is called Hierarchical Layering. A hierarchical layering tries to assign nodes to layers in a way such that as much edges of the graph as possible will point to the main layout direction, i.e., the start nodes of the edges will be in a layer with a smaller number than the corresponding end nodes. Also, a hierarchical layering will never put two connected nodes in the same layer.
This method wraps the internal implementations into a MultiComponentLayerer instance so that it is possible to specify the behavior of the algorithm if the component layouter is disabled.
Default Value
HIERARCHICAL_OPTIMAL.Throws
- Exception({ name: 'ArgumentError' })
- if an unknown strategy is given
See Also
Gets or sets the ISequencer instance that calculates the node sequence if the layout algorithm runs in From Scratch mode.
Default Value
DefaultLayerSequencer.Throws
- Exception({ name: 'ArgumentError' })
- if the
is null
See Also
Gets or sets the equidistant spacing between the horizontal and vertical grid lines.
Remarks
Default Value
0
.There is no grid specified.
See Also
Sample Graphs
Gets or sets the group layer alignment strategy used for recursive group layering.
Default Value
Throws
- Exception({ name: 'ArgumentError' })
- if an unknown group alignment policy is given
See Also
Gets or sets the ILayoutStage that hides the group nodes of the input graph.
Default Value
HideGroupsStage.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for hiding group nodes is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage responsible for hiding group nodes is activated.
See Also
Defined in
Gets the current layout algorithm instance.
Remarks
See Also
Gets or sets whether or not the layout algorithm reserves space for labels and places them.
Remarks
To define the desired placement for each label add a PreferredPlacementDescriptor on IEdgeLabelLayout.
This method is a convenience method that assures that the labeling algorithm is of type LabelLayoutTranslator and translateEdgeLabels is set to true
.
Default Value
false
.Integrated edge labeling is disabled.
Throws
- Exception({ name: 'InvalidOperationError' })
- if integrated labeling should be enabled but the current
is not of type - Exception({ name: 'InvalidOperationError' })
- if no properly configured
is registered even though integrated labeling was enabled earlier (can happen when manually specifying the ).
See Also
Sample Graphs
Gets or sets the ILayoutStage that places the labels of the input graph.
Default Value
See Also
Defined in
Gets or sets whether or not the ILayoutStage used for placing the labels of the input graph is activated.
Remarks
Default Value
false
.The stage responsible for label placement is deactivated.
See Also
Defined in
Gets or sets the layout mode this layouter should use for upcoming layouts.
Remarks
Default Value
FROM_SCRATCH.Throws
- Exception({ name: 'ArgumentError' })
- if the given layout mode is unknown
See Also
Gets or sets the main orientation of the layout.
Remarks
Default Value
TOP_TO_BOTTOM.Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation does not match a default layout orientation
See Also
Defined in
Gets or sets the time limit (in milliseconds) set for the layout algorithm.
Remarks
0
.Default Value
<code>0x7FFFFFFF</code>
.The layout algorithm runs unrestricted.
Throws
- Exception({ name: 'ArgumentError' })
- if the maximum duration is negative
See Also
Gets or sets the minimum distance between two adjacent layers.
Remarks
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the distance is negative
See Also
Sample Graphs
Gets or sets the HierarchicLayoutNodeLayoutDescriptor instance used for all those nodes that do not have a specific layout descriptor assigned.
Remarks
Default Value
HierarchicLayoutNodeLayoutDescriptor.Throws
- Exception({ name: 'ArgumentError' })
- if the given
is null
See Also
Gets or sets the IHierarchicLayoutNodePlacer instance that will calculate the final node placement of the layout.
Default Value
SimplexNodePlacer.Throws
- Exception({ name: 'ArgumentError' })
- if the
is null
See Also
Gets or sets the minimum distance between an edge and an adjacent node in one layer.
Remarks
0
.Default Value
15
.Throws
- Exception({ name: 'ArgumentError' })
- if the distance is negative
- Exception({ name: 'InvalidOperationError' })
- if the current
is not an instance of
See Also
Sample Graphs
Gets or sets the minimum distance between two adjacent nodes in one layer.
Remarks
0
.Default Value
30
.Throws
- Exception({ name: 'ArgumentError' })
- if the distance is negative
- Exception({ name: 'InvalidOperationError' })
- if the current
is not an instance of
See Also
Sample Graphs
Gets or sets the ILayoutStage that modifies the orientation of a computed layout.
Default Value
OrientationLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage that modifies the orientation of the layout is activated.
Remarks
Default Value
true
.The orientation
See Also
Defined in
Gets or sets whether or not edges should be routed orthogonally.
Remarks
Default Value
false
.Edges are not orthogonally routed.
See Also
Sample Graphs
Gets or sets the ILayoutStage that routes parallel edges.
Default Value
ParallelEdgeRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing parallel edges is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that routes parallel edges is activated.
See Also
Defined in
Gets or sets whether or not groups are respected during the layering stage.
Remarks
If this option is enabled, groups are layered recursively, i.e.
- nodes in the same group always occupy adjacent layers
- layer intervals spanned by different group nodes are either disjoint or are nested
If it is disabled, group information is ignored for the layering step.
If the graph is flat, this setting is ignored.
Default Value
true
.Groups are layered recursively.
See Also
Sample Graphs
Gets or sets the ILayoutStage that routes self-loops.
Default Value
SelfLoopRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing self-loops is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that routes self-loops is activated.
See Also
Defined in
Gets or sets whether or not to separate layers.
Remarks
Default Value
true
.Layers are separated.
Sample Graphs
Gets or sets whether or not to stop the layout algorithm after the layering step.
Remarks
By then, each node will be assigned to a layer. Since the sequencing and drawing phases are skipped, the order of the nodes within a layer matches the initial order of the nodes, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering information can be retrieved from the IDataProvider registered with the key LAYER_INDEX_DP_KEY.
Default Value
false
.The algorithm calculates the complete layout.
See Also
1
. Similarly, rows and columns of a partition grid do not get proper computed positions and computed height/width values.Gets or sets whether or not to stop the layout algorithm after the sequencing step.
Remarks
By then, each node will be assigned to a layer and will have a place in the sequence of nodes in this layer. Since the drawing phase is skipped, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering and sequencing information can be retrieved from the IDataProviders registered with the keys LAYER_INDEX_DP_KEY and SEQUENCE_INDEX_DP_KEY.
Default Value
false
.The algorithm calculates the complete layout.
See Also
1
. Similarly, rows and columns of a partition grid do not get proper computed positions and computed height/width values.Gets or sets the ILayoutStage that constrains the layout process to a subgraph of the input graph.
Default Value
SubgraphLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
Remarks
Default Value
false
.The stage that constrains the input graph to a subgraph is deactivated.
See Also
Defined in
Methods
Appends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Calculates a hierarchic layout of the given graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Overrides
Delegates the calculation of the hierarchic layout to a configured HierarchicLayoutCore instance.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
Checks the sizes of the nodes to be non-zero.
Parameters
A map of options to pass to the method.
- g - LayoutGraph
- The graph to check.
Defined in
Configures the core layout algorithm with the settings of this HierarchicLayout instance.
Remarks
This method is called by applyLayoutCore before the actual layout is calculated. It may be overridden in order to manually reconfigure the core layout algorithm.
This implementation will temporarily set a PortCandidateOptimizer if a IDataProvider is registered with NODE_PORT_CANDIDATE_SET_DP_KEY and no portConstraintOptimizer is assigned.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- coreLayouter - HierarchicLayoutCore
- the given core layout algorithm instance
Returns a new HierarchicLayoutEdgeLayoutDescriptor instance that will be used during the various phases of the layout algorithm to determine the drawing details of the edges of the graph.
Remarks
Returns
Returns a new HierarchicLayoutCore instance.
Remarks
This method may be overridden to create a new HierarchicLayoutCore object with different configuration settings.
This factory method provides the initial HierarchicLayoutCore instance.
Returns
- ↪HierarchicLayoutCore
- a new HierarchicLayoutCore instance
Returns a IIncrementalHintsFactory instance that must be used to obtain hints to be associated with graph elements that should be laid out incrementally.
Remarks
Returns
- ↪IIncrementalHintsFactory
- a new IIncrementalHintsFactory instance
See Also
Returns a ILayerConstraintFactory instance that can be used for specifying layer constraints for the given graph.
Remarks
The instance is usually bound to Graph instance graph
, i.e., if the input graph for the layerer changes, a new instance must be retrieved. This instance can be used for creating constraints for this graph instance.
You can create an instance without binding it to a graph instance initially by passing a null
parameter. In that case, you must bind the returned instance to the graph, see LAYER_CONSTRAINTS_MEMENTO_DP_KEY and memento.
Parameters
A map of options to pass to the method.
- graph - Graph
- the input graph
Returns
- ↪ILayerConstraintFactory
- a new ILayerConstraintFactory instance
Sample Graphs
graph
was passed in. Disposing the factory will also remove all constraints previously specified for the factory's associated graph. Creating layering constraints with a disposed factory will throw an InvalidOperationError.Creates and registers an incremental layer constraint factory for an IGraph.
Remarks
graph
, it has to be disposed after the layout calculation.Parameters
A map of options to pass to the method.
- graph - IGraph
- The graph for which the factory is created
Returns
- ↪ILayerConstraintFactory
- the sequence constraint factory
Class.ensure(LayoutExecutor)
More information.Deprecation warning
Instead of creating a layer constraint factory directly, the LayerConstraintFactory property of HierarchicLayoutData should be used.Returns a new HierarchicLayoutNodeLayoutDescriptor instance that will be used during the various phases of the layout algorithm to determine the drawing details of the nodes of the graph.
Remarks
Returns
Returns a ISequenceConstraintFactory instance that can be used for specifying sequence constraints for the given graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Returns
See Also
Sample Graphs
graph
was passed in. Disposing of the factory will also remove all constraints previously specified for the factory's associated graph. Creating sequence constraints with a disposed of factory will throw an InvalidOperationError.Creates and registers a sequencer constraint factory for an IGraph.
Remarks
graph
, it has to be disposed after the layout calculation.Parameters
A map of options to pass to the method.
- graph - IGraph
- The graph.
Returns
- ↪ISequenceConstraintFactory
- the sequence constraint factory
Class.ensure(LayoutExecutor)
More information.Deprecation warning
Instead of creating a sequence constraint factory directly, the SequenceConstraintFactory property of HierarchicLayoutData should be used.Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
Defined in
Disposes of the core layout algorithm.
Remarks
This method is called by applyLayoutCore after the actual layout is calculated. It may be overridden in order to revert a custom configuration made in configureCoreLayout.
This implementation will remove the PortCandidateOptimizer that was created in case a IDataProvider is registered with NODE_PORT_CANDIDATE_SET_DP_KEY and no portConstraintOptimizer was initially assigned.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- coreLayouter - HierarchicLayoutCore
- the given core layout algorithm instance
Returns the mirror mask of the orientation layouter.
Remarks
Returns
- ↪MirrorModes
- the mirror mask
Prepends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Removes the given ILayoutStage from the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- a ILayoutStage to be removed from the layout pipeline
See Also
Defined in
Constants
A data provider key for associating alternative paths for edges connecting to groups, group content or folder nodes.
Remarks
When running in incremental layout mode, the alternative edge paths are considered during the routing of fixed (i.e., non-incremental) edges.
The alternative paths should be used in conjunction with alternative group bounds to achieve more stable layout results when collapsing/expanding a group node as follows:
- Collapsing: edges adjacent to the group itself and edges where one of the endpoints (source/target) lies inside the group should get the path before collapsing the group as alternative path. If both endpoints are either inside or outside the group, no alternative path is required.
- Expanding: edges adjacent to the expanded folder node (which is now a group) should get the path before expanding as alternative path.
Domain | Edge | the edges of the input graph |
Values | YPointPath | the alternative path of an edge connecting to the content of the expanded/collapsed group and null for all other edges |
See Also
A data provider key for associating an alternative bounds with the collapsed/expanded group.
Remarks
Domain | YNode | the collapsed/expanded group of the input graph |
Values | YRectangle | the alternative bounds of the collapsed/expanded group and null for all other nodes |
See Also
A data provider key for specifying the bus to which an edge belongs to.
Remarks
All edges with the same HierarchicLayoutBusDescriptor instance adjacent to a specific node (the root) and having the same direction are arranged in a compact, bus-like way. The edge directedness is also considered here. The direction defines the placement of the bus structure in the following way:
- Bus nodes connected by out-edges are placed in the layers starting with the layer that comes directly after the layer of the root (e.g. below the root for top-to-bottom layout orientation).
- Bus nodes connected by in-edges are placed in the layers ending with the layer that comes directly before the layer of the root (e.g. above the root for top-to-bottom layout orientation).
The bus substructures are arranged using a style that yields more compact layout results. Edges to the child nodes, the so-called bus nodes, are routed using a shared segment that connects to the common root node. The bus nodes are arranged using several layers above or below the root node such that the whole substructure has a compact area. By default, each bus layer contains equally many bus nodes, bus nodes of adjacent layers are center-aligned and the shared bus segment is routed in the middle of the nodes. This produces compact, symmetric arrangements of the bus structures.
The arrangement can also be customized for each bus individually, by using the settings offered by HierarchicLayoutBusDescriptor. It allows to configure the number of bus nodes before and after the common bus segment.
There apply some restrictions for bus structures:
- Bus structures can not be nested/interleaved. More precisely, each node can only be part of a single bus. Note that the root node is considered to be a part of the bus, i.e., if a node is a bus node it can not be a root node of another bus at the same time.
- Only nodes that are in the same partition grid cell or same swimlane as the root node are included in the bus structure.
- The bus nodes must all belong to the same group node. Also, a group node can not be part of a bus structure; neither as bus element nor as root.
- Nodes that are contained in a tabular group node cannot be part of a bus structure.
- For bus edges, the integrated edge labeling feature does not place port labels as close to the actual port as it does for other edges (see AT_SOURCE_PORT and AT_TARGET_PORT).
- Edge grouping constraints at the side of the bus root node are ignored for bus edges; the grouping induced by the bus structure is considered to be stronger.
- If in incremental layout mode, the bus edges are always treated in an incremental way such that the bus-style routing remains consistent (e.g. if a fixed bus edge contains bends that suggest another route, they are ignored). The reason is that the bus-style layout of the structures has higher priority. Furthermore, the location of the bus segment relative to the elements is not derived from the sketch but depends on the settings maximumNodesBeforeBus and maximumNodesAfterBus as well as the before/after constraints (see PLACE_BEFORE_BUS_DP_KEY). This means that it can happen that a fixed bus node which was placed before the bus in the input drawing may be placed after the bus if the bus was enlarged due to the insertion of incremental bus nodes.
- It is not recommended to define buses inside a group node which has an incremental group hint. Fixed bus nodes inside such a group are not necessarily kept fix but are treated like an incrementally inserted node.
Domain | Edge | the edges of the input graph |
Values | HierarchicLayoutBusDescriptor | the bus descriptor that represents the bus to which this edge should belong to at its source/target node or null for edges that are not on a bus |
See Also
Sample Graphs
A data provider key for defining the priority of critical edges.
Remarks
Critical edges highlight different edge paths that are relevant for a user. The layouter tries to vertically align each node pair that is connected by a critical edge. Conflicts between different critical edges are always resolved in favor of the higher priority.
Critical edges do not automatically affect the result of the crossing minimization phase. If crossings between critical edges should be avoided, one can assign individual crossing costs by using EDGE_CROSSING_COST_DP_KEY. Critical edges need to get a larger crossing cost than other, non-critical edges. This is recommended if critical edges should not only highlight a relevant path but also crossings with them should be avoided. Note, however, that the crossing minimization is only a heuristic and there is no guarantee for an optimal solution in all cases.
Domain | Edge | the edges of the input graph |
Values | number | the positive priority value for a critical edge, or, to indicate a non-critical edge, use zero, any negative value or null |
See Also
Sample Graphs
A data provider key for specifying individual crossing costs of the edges.
Remarks
The crossing costs of the edges are considered during the crossing minimization phase. The total crossing costs are minimized using a heuristic where the cost of a crossing between two edges is defined as the product of the edges' crossing costs.
If no individual crossing costs are defined, each crossing has a cost of 1
. A crossing with an edge that has a cost of zero is cost-free and such a crossing will therefore not be avoided.
Domain | Edge | the edges of the input graph |
Values | number | the non-negative crossing cost of the edge |
See Also
A data provider key for specifying the directedness of edges.
Remarks
1
means that the edge should fully comply, a value of -1
that it should comply inversely (the edge should point against the main layout direction), and a value of 0
means that the direction doesn't matter at all and the endpoints of the edges may be placed at the same layer. If there are conflicting preferences, edges with higher absolute values are more likely to point in the desired direction.Domain | Edge | the edges of the input graph |
Values | number | the directedness of the edge |
See Also
Sample Graphs
1
.A data provider key for specifying the thickness of the edges.
Remarks
0
.Domain | Edge | the edges of the input graph |
Values | number | the non-negative thickness of an edge |
See Also
Sample Graphs
A data provider key for marking folder nodes.
Remarks
Domain | YNode | the nodes of the input graph |
Values | boolean | true if the node is a folder node, false otherwise |
See Also
A data provider key for specifying individual crossing costs for vertical borders of group nodes.
Remarks
Like edge crossing costs, these costs are considered during the crossing minimization phase. The total costs are minimized using a heuristic where the cost of a crossing between a group node border and an edge is defined as the product of the respective group border crossing cost and the edge crossing cost.
If no individual crossing costs are defined, the cost for crossing a group node border is 5
. This means that by default, a crossing between an edge and a group node border is more expensive than a crossing between two edges. Also note that a crossing with a group node border that has a cost of zero is cost-free and such a crossing will therefore not be avoided.
Domain | YNode | the group nodes of the input graph |
Values | number | the cost for crossing the border of the group node |
See Also
A data provider key for specifying incremental hints.
Remarks
Domain | GraphObject | the nodes and edges of the input graph |
Values | Object | the incremental hint that specifies where the node/edge is incrementally inserted or null if the element is non-incremental |
See Also
A data acceptor key for publishing the layer IDs for all nodes in the graph.
Remarks
Domain | YNode | the nodes of the input graph |
Values | number | the index of the layer inside the |
See Also
A data acceptor key for publishing the index inside their layer for all nodes in the graph.
Remarks
Domain | YNode | the nodes of the input graph |
Values | number | the index of the node inside the sequence of the according |
See Also
A data provider key for specifying custom subcomponents of the input graph.
Remarks
A subcomponent is arranged by another layout algorithm and its layout is finally embedded into the global hierarchical layout. This feature allows, for example, to highlight special substructures by arranging them in a different fashion. The sub-layout algorithm must be specified in the component descriptor registered with this key. All nodes associated with the same HierarchicLayoutSubcomponentDescriptor instance are members of the same subcomponent.
Carefully note that nodes of a subcomponent can be connected to nodes of another subcomponent as well as to nodes that are not part of any subcomponent. Edges that model these connections are so-called inter-edges. It is recommended to keep the number of inter-edges small for better overall integration of the components.
If all inter-edges of a subcomponent connect to the same external node, that single external so-called connector node is included in the calculation of the component layout when using placement policy AUTOMATIC or ALWAYS_INTEGRATED. In case the result is feasible, this results in a better and more compact integration of the component in the main layout. In that case the sub-layout is fully responsible for the routing of inter-edges (meaning the restrictions below may not apply anymore).
For inter-edges there apply some restrictions with respect to the supported features:
- Their general style can somewhat differ from other, normal hierarchical edges. They do not fully comply with all HierarchicLayoutRoutingStyle settings.
- The backloop routing style is not applied for the part of an inter-edge that connects to a subcomponent node.
- The minimum first segment length and the minimum last segment length can not always be fulfilled for the side of an inter-edge that lies inside a subcomponent. It is still kept on the side outside of subcomponents.
- The node-to-edge distance can not always be kept between inter-edges and nodes inside a subcomponent. This will mostly appear if a subcomponent has a rather large number of inter-edges connecting to it.
- The integrated edge labeling does not guarantee full support for all PreferredPlacementDescriptor configurations for inter-edges. This affects the side of the inter-edge that lies inside a subcomponent and when the label should be placed near the component node, i.e., using settings AT_SOURCE, AT_SOURCE_PORT, AT_TARGET or AT_TARGET_PORT.
subcomponents can be defined on grouped graphs with the following restrictions:
- All subcomponent nodes must be on the same hierarchy level if the group node itself is not part of the subcomponent.
- If a group is assigned to a subcomponent, all its descendants (including other group nodes) must be in that component, too.
When running in incremental mode, it is still up to the sub-layout algorithm to decide whether to treat a subcomponent element as incremental or fixed. If the given layout of the subcomponent should be considered, then the from-sketch mode of the used layout algorithm needs to be enabled (if such a mode is supported).
Layering and sequencing constraints are supported for subcomponents in the following way: all constraints from the subcomponent nodes are transferred to the component itself. Constraints between nodes of the same component are ignored. In the same way, a given layering provided by GivenLayersLayerer is supported for subcomponents.
Domain | YNode | |
Values | HierarchicLayoutSubcomponentDescriptor | the component descriptor of the node or null if the node should not be part of a specific subcomponent |
See Also
A data provider key for defining swimlanes for the nodes.
Remarks
The layout algorithm will arrange nodes in swimlanes according to the registered descriptors.
Layout information about the swimlanes is finally written back to the descriptor instances. Instances can be shared among multiple nodes in the same lane.
Domain | YNode | the nodes of the input graph |
Values | SwimlaneDescriptor | the descriptor which holds swimlane information for a node or null if the node isn't assigned to a swimlane |
See Also
A data provider key for specifying orderings of child nodes of a tabular group node.
Remarks
Domain | YNode | the tabular group node |
Values | IComparer<T> | the ordering for child nodes of the tabular group or null if no specific |
See Also
A data provider key for marking tabular group nodes.
Remarks
Children of marked groups are arranged in a compact tabular fashion as shown in the figure below. Groups contained in a tabular group behave like tabular groups as well.
Child nodes are placed next to each other within the same layer with a distance defined by tabularGroupChildDistance, which is zero by default.
There are some setups for which a tabular group may not be tight (i.e., maximally compact):
- If edges directly connect to a tabular group (not to its content), then it is not guaranteed that the group becomes maximally compact. Children may be placed a little further apart to fulfill the defined edge-to-edge distance.
- The same is true if there are children with self-loops. Such self-loops are always drawn within the tabular group.
- In addition, labels of edges connecting two children of the same tabular group may intersect with other edge segments.
Besides, the tabular groups may not be tight if there are user specified constraints like node halos, node labels that exceed the size of the associated child node, and port constraints connecting to a side orthogonal to the layout orientation.
Domain | YNode | the group nodes of the input graph |
Values | boolean | true if the children of the group should be arranged in a tabular fashion, false otherwise |
See Also
Sample Graphs
A data provider key for specifying whether or not the ports of edges incident to a specific group node should be uniformly distributed.
Remarks
This setting only affects the two sides of a group node that are in flow and against the flow of the layout orientation. For example, for orientation TOP_TO_BOTTOM only the edges incident to the top and bottom group node side are considered but not the edges at the left and right side.
If no IDataProvider is registered with this key, then the ports at group nodes are not explicitly distributed in a uniform way.
The uniform group port assignment considers the edge-to-edge distance such that two ports keep the specified distance to each other. Group nodes may in consequence be enlarged to satisfy that constraints, potentially generating less compact layouts. The distance from the group node border to the first/last port on each group side may be influenced by using group node insets.
Importantly, it is not guaranteed that the group node ports of a specific side can be uniformly distributed. In the following cases ports of a specific side are not uniformly distributed:
- There are edges that cross the group node border because they connect to a child node of the group.
- There is a self-loop at the group node which has its source and target port at the same group node side.
Domain | YNode | the group nodes |
Values | boolean | true if ports of the group node should be uniformly distributed, false otherwise |
Sample Graphs
Static Methods
Returns the corresponding original edge instance for a given edge.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the original input edge is retrieved
- layoutDataProvider - ILayoutDataProvider
- the layout data provider holding layout information of the hierarchical layout
Returns
- ↪Edge
- the original input edge corresponding to the given edge