C

TreeReductionStage

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.

The non-tree edges are marked

Concept

This ILayoutStage works in three steps:

  1. Remove some edges to get a tree or forest from the graph
  2. Invoke the coreLayout which supports tree graph handling
  3. Reinsert all previously removed edges
  4. 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 coreLayout supports multi-parent structures (see allowMultiParent) and option allowMultiParent is enabled, this stage does not hide such structures, i.e., the multi-parent structures are passed to the coreLayout.

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 property edgeBundling.

Default Values of Properties

NameDefaultDescription
allowMultiParentfalse
The reduced graph is a normal tree.
coreLayoutnull
nonTreeEdgeLabelingnull
Edge labels of non-tree edges are not placed.
nonTreeEdgeRouternull
Non-tree edges are not routed.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new TreeReductionStage instance with the given core layout algorithm and default settings.

Parameters

coreLayout?: ILayoutAlgorithm
the core layout algorithm

Properties

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.
More precisely, if this option is enabled and the specified coreLayout can handle multi-parent structures (see allowMultiParent ), this stage does not hide such structures, but the multi-parent structures are passed on to the coreLayout core layout algorithm}.
final

Property Value

true if multi-parent structures are allowed, false otherwise

Default Value

The default value is: false
The reduced graph is a normal tree.

Sample Graphs

ShownSetting: false - the multi-parent structure was reduced to a tree, a non-tree edge is marked
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
final

Property Value

the core layout routine

Default Value

The default value is: null
Gets the EdgeBundling instance that defines the settings of the edge bundling feature.

The specified EdgeBundling defines global bundling properties. Settings for individual edges can be defined by assigning an EdgeBundleDescriptor to an edge with edgeBundleDescriptors. To enable bundling for all non-tree edges, set a defaultBundleDescriptor 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.

To obtain a layout with bundled edges of nice quality, the TreeReductionStage should be combined with a layout algorithm that produces planar layouts of the underlying tree (i.e., no edges of the tree cross each other) as RadialTreeLayout or TreeLayout.
The specified non-tree layouter is not applied to bundled edges.
Edge bundling has an effect only for non-tree edges for which bundling is enabled and if the graph does not contain multi-parent structures.
Edge bundling ignores any LayoutPortCandidate s assigned to nodes/edges and always resets the port to the center of the nodes. Also, when edge bundling is enabled, node/edge label overlaps are allowed.
In the case where the coreLayouter uses the ParallelEdgeRouter to route possible parallel edges, all edges that will be bundled and approximated by a cubic bezier curve using CurveFittingStage should not be in the scope of ParallelEdgeRouter.
readonlyfinal

Property Value

the EdgeBundling instance defining the edge bundling setup

See Also

Developer's Guide
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.

By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false.

Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.

final
Gets or sets the labeling algorithm that is applied to all edge labels that belong to non-tree edges.
The communication between the TreeReductionStage and the specified labeling algorithm is automatically established via the key PLACE_EDGE_LABELS_DATA_KEY.
final

Property Value

the labeling algorithm used for edge labels of non-tree edges

Default Value

The default value is: null
Edge labels of non-tree edges are not placed.

See Also

Developer's Guide
Gets or sets the edge routing algorithm that is applied to all non-tree edges.
The specified edge router is not applied to bundled non-tree edges.
final

Property Value

The edge routing algorithm used for non-tree edges.

Default Value

The default value is: null
Non-tree edges are not routed.

See Also

Developer's Guide

Methods

Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
This implementation checks the enabled state and when it's not enabled, will delegate to the coreLayout, directly. When the stage is enabled, all the work will be delegated to applyLayoutImpl, instead.
final

Parameters

graph: LayoutGraph
The graph to apply the layout to.
Determines a spanning tree of the graph and passes it to the coreLayout.
This ILayoutStage reduces the graph to a tree. Then, it applies the coreLayout to that tree. After it gets the result, it reinserts the non-tree edges and routes them.
protected

Parameters

graph: LayoutGraph
the input graph
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the TreeReductionStage.
The generic type arguments of the created layout data are compatible with instances of LayoutGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.

Parameters

graph: LayoutGraph
the graph that determines the generic type arguments of the created layout data

Return Value

TreeReductionStageData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
an instance of layout data that can be used to perform item-specific configurations for the given TreeReductionStage.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the TreeReductionStage.
The generic type arguments of the created layout data are compatible with instances of IGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.

Parameters

graph?: IGraph
the graph that determines the generic type arguments of the created layout data

Return Value

TreeReductionStageData<INode, IEdge, ILabel, ILabel>
an instance of layout data that can be used to perform item-specific configurations for the given TreeReductionStage.
Routes all edges that do not belong to the chosen spanning tree.
This method is called by applyLayoutImpl after the tree was arranged by the coreLayout. It may be overridden to apply custom edge routes.
This method will do nothing if no non-tree edge routing algorithm was specified (i.e. if it is null).
protected

Parameters

graph: LayoutGraph
the graph containing tree and non-tree edges
nonTreeEdgeMap: IMapper<LayoutEdge, boolean>
the IMapper<K, V> that marks an edge with true if the edge is a non-tree edge, or false otherwise

Constants

All constants are filtered. Go to Filters.