The TreeReductionStage temporarily reduces general graphs to trees.
Remarks
Layout Style
This stage prepares a non-tree graph such that it can be processed by a tree layout algorithm.
Concept
This ILayoutStage works in three steps:
- Remove some edges to get a tree or forest from the graph
- Invoke the core layout algorithm which supports tree graph handling
- Reinsert all previously removed edges
- Optionally route these edges using the non-tree edge router and place their labels using the non-tree edge labeling algorithm.
Features
The routing of the temporarily hidden non-tree edges can be customized by specifying an edge routing algorithm for those edges. Similarly, the placement of edge labels of non-tree edges can be delegated to a custom edge labeling algorithm. As default, both custom algorithms are not specified and, thus, non-tree edges are not routed and edge labels not placed.
This stage is also able to handle multi-parent structures, i.e., structures of multiple nodes that share the same predecessors as well as the same successors. More precisely, if the specified core layout algorithm supports multi-parent structures (see multiParentAllowed) and option multiParentAllowed is enabled, this stage does not hide such structures, i.e., the multi-parent structures are passed to the core layout algorithm.
Non-tree edges can also be bundled together such that their common parts are to some degree merged into a bundled part. The edge bundling can be specified by means of method edgeBundling.
Default Values of Properties
multiParentAllowed | false | The reduced graph is a normal tree. |
nonTreeEdgeLabelingAlgorithm | null | Edge labels of non-tree edges are not placed. |
nonTreeEdgeRouter | null | Non-tree edges are not routed. |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.TreeReductionStage
See Also
Constructors
Creates a new TreeReductionStage instance with the given core layout algorithm and default settings.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the core layout algorithm
- multiParentAllowed - boolean
Whether or not multi-parent structures (structures of multiple nodes that share the same predecessors as well as the same successors) are allowed. This option sets the multiParentAllowed property on the created object.
- nonTreeEdgeRouter - ILayoutAlgorithm
The edge routing algorithm that is applied to all non-tree edges. This option sets the nonTreeEdgeRouter property on the created object.
- nonTreeEdgeSelectionKey - Object
The key to register a IDataProvider that will be used by the non-tree edge routing algorithm to determine the edges that need to be routed. This option sets the nonTreeEdgeSelectionKey property on the created object.
- nonTreeEdgeLabelingAlgorithm - ILayoutAlgorithm
The labeling algorithm that is applied to all edge labels that belong to non-tree edges. This option sets the nonTreeEdgeLabelingAlgorithm property on the created object.
- nonTreeEdgeLabelSelectionKey - Object
The key to register a IDataProvider that is used by the non-tree edge labeling algorithm to determine which edge labels it should place. This option sets the nonTreeEdgeLabelSelectionKey property on the created object.
Properties
Gets or sets the core layout algorithm that is wrapped by this stage.
Gets the EdgeBundling instance that defines the settings of the edge bundling feature.
Remarks
The specified EdgeBundling defines global bundling properties. Settings for individual edges can be defined by assigning an EdgeBundleDescriptor to an edge using a IDataProvider registered with key EDGE_BUNDLE_DESCRIPTOR_DP_KEY. To enable bundling for all non-tree edges, set a default bundle descriptor which has bundling enabled.
If the graph contains self-loops that belong to the set of non-tree edges, the stage will invoke the router defined for the non-tree edges in order to route them. In the case where this is not desired, the user has to hide them from the stage and route them afterwards as desired.
See Also
Gets or sets whether or not multi-parent structures (structures of multiple nodes that share the same predecessors as well as the same successors) are allowed.
Remarks
Default Value
false
.The reduced graph is a normal tree.
Sample Graphs
Gets or sets the labeling algorithm that is applied to all edge labels that belong to non-tree edges.
Remarks
Default Value
null
.Edge labels of non-tree edges are not placed.
See Also
Gets or sets the key to register a IDataProvider that is used by the non-tree edge labeling algorithm to determine which edge labels it should place.
Default Value
null
.There is no
See Also
Gets or sets the edge routing algorithm that is applied to all non-tree edges.
Default Value
null
.Non-tree edges are not routed.
See Also
Gets or sets the key to register a IDataProvider that will be used by the non-tree edge routing algorithm to determine the edges that need to be routed.
Default Value
null
.There is no
See Also
Methods
Determines a spanning tree of the graph and passes it to the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Defined in
Creates a routing algorithm that routes edges as a single straight segment.
Remarks
Returns
- ↪ILayoutAlgorithm
- an edge routing algorithm that produces straight-line edges
See Also
Routes all edges that do not belong to the chosen spanning tree.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph containing tree and non-tree edges
- nonTreeEdgeMap - IEdgeMap
- the IEdgeMap that marks all non-tree edges in the graph
Domain Edge Values boolean true
if the edge is a non-tree edge,false
otherwise
null
).Constants
A data provider key for explicitly marking (some) edges that should not be considered for the tree.
Domain | Edge | |
Values | boolean | true if the edge should be excluded from the tree, false otherwise |