This layout algorithm arranges grouped graphs in a recursive structure.
Remarks
Layout Style
CactusGroupLayout is designed to arrange directed and undirected, hierarchically grouped graphs. All members of a group are placed adjacent to the group node along its circular border, resembling the structure of a cactus. The group hierarchy of the graph is represented implicitly by the position of the nodes. Non-hierarchical edges are routed through the centers of all nodes on a path through the hierarchy tree, connecting the edge's endpoints.
Cactus group layout algorithms are commonly used for visualizing relational data and for producing diagrams of high quality that are able to showcase hierarchic properties of the graph. They especially address the concern of recognizability between identical subtrees.
Concept
The algorithm executes the following steps
- If no single group acts as a unique root of the hierarchy, create a virtual root containing all nodes to base the layout on.
- Recursively determine the size of each node to accommodate the subtrees rooted in its children and place the subtrees relative to it. Prioritize placing large subtrees in centered positions to promote vertical growth.
- Adjust the placement of individual subtrees to optimize the usage of space around the subtree roots and improve the compactness of the drawing.
- Route the non-hierarchical edges of the graph according to the specified routing policies.
- Remove the virtual root of the group, if it was added during the first step of the algorithm.
Features
The algorithm features the possibility to collapse the hierarchy at one or more of its groups, to gather all direct and indirect members of the specified group or groups along their boundary. Collapsed groups can be specified using the IDataProvider registered with COLLAPSED_SUBTREE_ROOTS_DP_KEY.
The CactusGroupLayout allows for integrated node labeling. Node labels are placed automatically without generating overlaps with other labels or graph elements. Note that for nodes with multiple labels such overlaps may occur. There are different ways to place node labels.
The algorithm supports edge bundling and all its included features for non-hierarchical edges of the graph.
Defining a preferred wedge angle has a great influence on the layout style. Subtrees at the hierarchy's root get a certain amount of radial space to be placed around the root node, such that a large preferred angle will generally lead to more compact drawings while a smaller angle will focus the drawing towards a singular direction.
The CactusGroupLayout supports customizing the overlap between nodes and their parent nodes. The overlap can be set individually for each node by registering a IDataProvider with PARENT_OVERLAP_RATIO_DP_KEY.
Since it is computationally not very complex, CactusGroupLayout is well suited for large graphs. It performs well even for huge graphs.
Default Values of Properties
componentLayoutEnabled | false | The stage that arranges connected graph components is activated. |
considerNodeLabels | true | Node labels are considered for automatic scaling. |
fromSketchMode | false | The order given by the sketch is ignored. |
groupSizingPolicy | ADAPTIVE
| |
hideGroupsStageEnabled | false | The stage responsible for hiding group nodes is activated. |
integratedNodeLabeling | true | Node labels are placed by this algorithm. |
nodeComparer | IComparer<T>
| Subtrees are ordered symmetrically by the number of leaves they contain. |
nodeLabelingPolicy | RAY_LIKE_LEAVES
| |
parallelEdgeRouterEnabled | false | The stage that routes parallel edges is activated. |
preferredRootWedge | 180 |
Type Details
- yfiles module
- layout-cactus
- yfiles-umd modules
- layout-cactus, layout
- Legacy UMD name
- yfiles.layout.CactusGroupLayout
See Also
Constructors
Creates a new CactusGroupLayout instance with default settings.
Parameters
A map of options to pass to the method.
- fromSketchMode - boolean
Whether or not the order of subtrees around a root may be changed by the algorithm. This option sets the fromSketchMode property on the created object.
- nodeLabelSpacing - number
The spacing used for node labels when integrated node labeling is enabled. This option sets the nodeLabelSpacing property on the created object.
- nodeComparer - IComparer<Object>
A IComparer<T> for children of the same parent node, by which the order of the subtrees around their parent is determined. This option sets the nodeComparer property on the created object.
- considerNodeLabels - boolean
Whether the algorithm actively prevents node label overlaps when computing the layout. This option sets the considerNodeLabels property on the created object.
- nodeLabelingPolicy - NodeLabelingPolicy
The policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation). This option sets the nodeLabelingPolicy property on the created object.
- groupSizingPolicy - CactusGroupLayoutGroupSizingPolicy
The policy defining how group node sizes are determined. This option sets the groupSizingPolicy property on the created object.
- integratedNodeLabeling - boolean
Whether or not the layout algorithm automatically places node labels. This option sets the integratedNodeLabeling property on the created object.
- preferredRootWedge - number
The maximum angle on which the root's children can be distributed around its center. This option sets the preferredRootWedge 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 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 the default policy for ordering subtree roots around their common parent.
Remarks
By default, subtrees are ordered by their size.
CactusGroupLayout arranges nodes in a radial fashion around their parent node. The order is determined by a IComparer<T> specified with nodeComparer. By default all subtrees are arranged according to the number of leaves they contain, placing the largest subtrees in the center and smaller subtrees towards beginning and end of the order.
See Also
Gets the EdgeBundling instance that defines the settings of the edge bundling feature.
Remarks
Gets or sets whether or not the order of subtrees around a root may be changed by the algorithm.
Default Value
false
.The order given by the sketch is ignored.
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 or sets whether or not the layout algorithm automatically places node labels.
Remarks
If enabled, this layout algorithm will calculate the positions for the node labels assuring that no overlaps occur.
Different labeling strategies may be selected using nodeLabelingPolicy.
Default Value
true
.Node labels are placed by this algorithm.
See Also
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 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 a IComparer<T> for children of the same parent node, by which the order of the subtrees around their parent is determined.
Default Value
IComparer<T>.Subtrees are ordered symmetrically by the number of leaves they contain.
See Also
Gets or sets the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation).
Default Value
RAY_LIKE_LEAVES.Throws
- Exception({ name: 'ArgumentError' })
- if an unknown labeling policy is given
See Also
Gets or sets the spacing used for node labels when integrated node labeling is enabled.
Remarks
For ray-like label placement of leaf nodes, the spacing defines the distance between labels and the node they belong to (e.g. for ray-like label placement). For labels of inner nodes, the spacing specifies the distance between the labels (if there are multiple labels).
The spacing must have a non-negative value.
Default Value
4.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing value is negative
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 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 the maximum angle on which the root's children can be distributed around its center.
Remarks
Default Value
180
.Throws
- Exception({ name: 'ArgumentError' })
- if a negative angle, or an angle of more than
360
degrees is specified.
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
true
.The stage that routes self-loops is activated.
See Also
Defined in
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 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
Arranges the given grouped graph in the style of a cactus group layout.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the grouped 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
Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
Defined in
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 specifying the roots of collapsed subtrees in the hierarchy.
Remarks
false
all children of the node are placed on its border and their respective descendants are arranged recursively. If the entry is however set to true
, all descendants of the node are placed depending on whether they are inner nodes or leaves. Inner nodes are positioned at the center of the node whereas leaves are placed on its border in place of child nodes. The entries of leaf nodes in the hierarchy have no effect.Domain | YNode | the nodes of the input graph |
Values | boolean | the state of the subtree rooted by the node as collapsed |
See Also
Sample Graphs
false
.A data provider key for specifying the overlap of nodes with their parent in the hierarchy.
Remarks
Domain | YNode | the nodes of the input graph |
Values | number | a double value in range [0, 1] specifying how far a node is moved towards its parent |
See Also
Sample Graphs
0.2
.