An abstract base class for layout algorithms that provides services to simplify and decompose the input graph before it is passed to the core layout algorithm itself.
Remarks
Subclasses of this layout algorithm have to provide implementations for the abstract method applyLayoutCore. It invokes the actual layout routine of this layout algorithm.
Concept
This class provides a configurable pipeline that contains ILayoutStages that add preprocessing steps and/or postprocessing steps to the layout algorithm. MultiStageLayout provides some predefined ILayoutStages, that simplify the input graph for the layout algorithm and complement the result. It is also possible to add custom ILayoutStages which are executed before or after the predefined ones.
Each ILayoutStage in the pipeline wraps its successor. When the layout pipeline is processed, the preprocessing code of the preceding ILayoutStage is executed before the code in the current ILayoutStage while the postprocessing code is executed afterwards.
The pipeline of predefined ILayoutStages of MultiStageLayout (when all are activated) causes the following sequence of steps:
- Hides the group nodes.
- Hides all except for the induced subgraph.
- Decomposes the graph into its connected components. Performs steps 4-12 on each component.
- Prepares for label placement.
- Prepares the layout for an orientation change.
- Hides self-loops.
- Hides parallel edges.
- Invokes the layout algorithm on the simplified graph.
- Un-hides and routes parallel edges.
- Un-hides and routes self-loops.
- Completes orientation change of the layout.
- Assigns label positions.
- Arranges the connected components of the graph.
- Un-hides non-induced subgraph.
- Un-hides the group nodes.
In order to take effect, a stage that is not already activated by default needs to be activated using the corresponding method, e.g., hideGroupsStageEnabled. Vice versa, a stage can also be deactivated, if necessary.
Default Values of Properties
componentLayoutEnabled | true | The stage that arranges connected graph components is activated. |
hideGroupsStageEnabled | true | The stage responsible for hiding group nodes is activated. |
labelingEnabled | false | The stage responsible for label placement is deactivated. |
layoutOrientation | TOP_TO_BOTTOM
| |
orientationLayoutEnabled | true | The orientation |
parallelEdgeRouterEnabled | true | The stage that routes parallel edges is activated. |
selfLoopRouterEnabled | true | The stage that routes self-loops is activated. |
subgraphLayoutEnabled | false | The stage that constrains the input graph to a subgraph is deactivated. |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.MultiStageLayout
See Also
Constructors
Creates a new MultiStageLayout instance with default settings.
Parameters
A map of options to pass to the method.
- 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 the ILayoutStage that arranges the connected components of an input graph.
Default Value
ComponentLayout.See Also
Gets or sets whether or not the ILayoutStage used for arranging the components of the graph is activated.
Remarks
Default Value
true
.The stage that arranges connected graph components is activated.
See Also
Gets or sets the ILayoutStage that hides the group nodes of the input graph.
Default Value
HideGroupsStage.See Also
Gets or sets whether or not the ILayoutStage used for hiding group nodes is activated.
Remarks
Default Value
true
.The stage responsible for hiding group nodes is activated.
See Also
Gets or sets the ILayoutStage that places the labels of the input graph.
Default Value
See Also
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
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
Gets or sets the ILayoutStage that modifies the orientation of a computed layout.
Default Value
OrientationLayout.See Also
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
Gets or sets the ILayoutStage that routes parallel edges.
Default Value
ParallelEdgeRouter.See Also
Gets or sets whether or not the ILayoutStage used for routing parallel edges is activated.
Remarks
Default Value
true
.The stage that routes parallel edges is activated.
See Also
Gets or sets the ILayoutStage that routes self-loops.
Default Value
SelfLoopRouter.See Also
Gets or sets whether or not the ILayoutStage used for routing self-loops is activated.
Remarks
Default Value
true
.The stage that routes self-loops is activated.
See Also
Gets or sets the ILayoutStage that constrains the layout process to a subgraph of the input graph.
Default Value
SubgraphLayout.See Also
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
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
Calculates a layout for the given graph and applies it directly to the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Invokes the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Checks the sizes of the nodes to be non-zero.
Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
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
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