documentationfor yFiles for HTML 2.6

CactusGroupLayout

This layout algorithm arranges grouped graphs in a recursive structure.

Inheritance Hierarchy
MultiStageLayout
CactusGroupLayout
Implemented Interfaces

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.

Sample cactus drawing of a large graph with default settings

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

  1. If no single group acts as a unique root of the hierarchy, create a virtual root containing all nodes to base the layout on.
  2. 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.
  3. Adjust the placement of individual subtrees to optimize the usage of space around the subtree roots and improve the compactness of the drawing.
  4. Route the non-hierarchical edges of the graph according to the specified routing policies.
  5. 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

componentLayoutEnabledfalseThe stage that arranges connected graph components is activated.
considerNodeLabelstrueNode labels are considered for automatic scaling.
fromSketchModefalseThe order given by the sketch is ignored.
groupSizingPolicyADAPTIVE
hideGroupsStageEnabledfalseThe stage responsible for hiding group nodes is activated.
integratedNodeLabelingtrueNode labels are placed by this algorithm.
nodeComparerIComparer<T>Subtrees are ordered symmetrically by the number of leaves they contain.
nodeLabelingPolicyRAY_LIKE_LEAVES
parallelEdgeRouterEnabledfalseThe stage that routes parallel edges is activated.
preferredRootWedge180

Type Details

yfiles module
layout-cactus
yfiles-umd modules
layout-cactus, layout
Legacy UMD name
yfiles.layout.CactusGroupLayout

See Also

Even though the integrated node labeling is enabled, there may sometimes be overlapping labels if there are nodes with multiple labels.
The layout algorithm considers the nodes as circles and, thus, using a circular node style is strongly recommended to obtain suitable visualizations.

Constructors

Properties

Methods

Constants