documentationfor yFiles for HTML 2.6

Cactus Group Layout

Class CactusGroupLayout is a layout algorithm for hierarchically grouped graphs that arranges all direct members of a group around its border, resulting in a recursive tree that resembles a cactus.

Sample layout by class CactusGroupLayout: A layout of a grouped graph with relatively flat hierarchy
Sample layout by CactusGroupLayout
Sample layout by class CactusGroupLayout: A layout of a grouped graph with tiered hierarchy
Sample layout by CactusGroupLayout

Basic Options

Group Sizing Policy

The CactusGroupLayout offers three policies to determine the size of group nodes in the drawing. The policies mainly differ in their approach to balance the compactness of the overall drawing against the consistency of the layout when collapsing opened/opening collapsed groups. The policy is spezified via property groupSizingPolicy.

COMPACT
Groups will be sized as small as possible without causing the fully opened graph to contain any node overlaps (or label overlaps, if integrated labeling is enabled). If one or more nodes are however collapsed, their leaves may overlap with one another.

ADAPTIVE
Opened groups will be sized as small as possible without causing the graph to contain any node overlaps (or label overlaps, if integrated labeling is enabled). If one or more nodes are collapsed, their size may increase in order to prevent their leaves from overlapping with one another.

STABLE
Groups will be sized as small as possible without causing any node overlaps (or label overlaps, if integrated labeling is enabled) in the graph for any combination of collapsed groups. This produces the least compact drawing out of the available options. However, if one or more nodes are collapsed, they have the same size as if they were not collapsed, without causing any overlaps.

Parent-Child Overlap

The CactusGroupLayout arranges direct members of a group such that they are touching at the groups border. The overlap between any group member and its parent can be specified individually as shown in Table: Supplemental layout data. It is defined as a fraction of the child node’s radius.

By default, the value is set to 0.2 for all nodes.

Order of Group Members

The clockwise order of group members around their parent can be specified with nodeComparer.

By default, group members are ordered such that the largest groups are placed towards the center of the allotted angle around a group, with groups getting smaller the closer they are to the borders of the angle.

Preferred Root Wedge

This setting determines the angular range of the sector that will be reserved around the root group of the graph to accommodate the attached subtrees. The possible angular range lies between 1 and 360 degrees. Generally the compactness of the layout improves with larger angles, especially for graphs with flat grouping hierarchies.

By default, the root wedge is set to 180 degrees.

Collapse Groups

The CactusGroupLayout supports collapsing the hierarchy at a group node, to gather all leaf nodes descended from the node around its border. Any subgroups contained in the specified group are placed on its center, unless the subgroup itself has no members, in which case it is treated as a leaf node. One or more group nodes can be selected for collapse simultaneously as shown in Table: Supplemental layout data.

Labeling

In addition to the generic labeling support as described in Generic Labeling, which is available with all yFiles for HTML layout algorithms, CactusGroupLayout features integrated labeling for node labels. Labels are taken into consideration when determining the positions for the nodes. That way it is guaranteed that no label will overlap other objects in the diagram. Integrated labeling can be enabled or disabled using the following property:

integratedNodeLabeling
Determines whether integrated labeling is enabled.

See also Integrated Labeling.

Enabling the integrated node labeling support of class CactusGroupLayout means that each node label will be placed and arranged such that there are no overlaps of node labels with each other or with graph elements (other than their respective node).

CactusGroupLayout supports different node labeling policies that can be configured using the nodeLabelingPolicy property. The following policies are available:

HORIZONTAL
Each node label will be placed at the center of its node and with horizontal orientation. Multiple node labels will be placed center-aligned and stacked.

RAY_LIKE
The node labels of the root group will be placed at the center of their node and with horizontal orientation. Node labels of other nodes will be oriented ray-like, i.e., on the axis through the centers of the node and its parent group. Additionally, node labels of leaf nodes will be placed outside the border of their respective node. Multiple, ray-like oriented node labels will be arranged symmetrically around their respective axis.

RAY_LIKE_LEAVES
Node labels of leaf nodes will be oriented ray-like, i.e. on an axis through the centers of the node and its parent group. The node labels will be placed outside the border of their respective node. Multiple, ray-like oriented node labels will be arranged symmetrically around their respective axis. All other node labels will be placed at the center of their node and with horizontal orientation. This is the default setting.

Note that ray-like oriented node labels are only supported by integrated labeling for node labels that use a "free" label model, e.g., FreeNodeLabelModel.

Results with different Node Labeling policies
Example drawing with horizontal node labels
Example drawing with ray-like node labels

Edge Bundling

While the hierarchy relations of the graph are represented by the nodes touching in the CactusGroupLayout, the non-hierarchical edges are drawn as usual. They are routed along the hierarchy and can additionally be bundled to reduce visual clutter. The configuration for bundling the edges is the responsibility of EdgeBundling.

From-Sketch

The setting fromSketchMode takes the initial position of all nodes in relation to their parent group into account to determine their order around the parent in the finished layout.

fromSketchMode
Enables the "from-sketch" layout

Node Halos

CactusGroupLayout by default supports node halos as soon as they are declared using layout data. It considers any specified additional padding around nodes, however, due to the straight-line routing of the edges, they can cross through these areas.

Layout Data

When using class CactusGroupLayout, supplemental layout data for a graph’s elements can be specified either by using class CactusGroupLayoutData or by registering data providers with the graph using given look-up keys. Supplemental layout data lists all properties of CactusGroupLayoutData and the corresponding look-up keys that CactusGroupLayout tests during the layout process in order to query supplemental data.

Providing supplemental layout data is described in detail in Layout Data.

Supplemental layout data

parentOverlapRatios
For each node a floating-point value in range [0, 1], indicating how much a child node should overlap with its parent group.
Data Provider Key: PARENT_OVERLAP_RATIO_DP_KEY
Maps from node to double
nodeHalos
A NodeHalo object that specifies the halo sizes at each side of a node.
Data Provider Key: NODE_HALO_DP_KEY
Maps from node to NodeHalo
collapsedSubtreeRoots
A boolean value for marking whether the subtree rooted in a node should be collapsed.
Maps from node to boolean
CactusGroupLayoutData.edgeBundleDescriptors
For each edge an EdgeBundleDescriptor object that configures edge bundling options.
Maps from edge to EdgeBundleDescriptor
abortHandler
An AbortHandler instance that will be queried by the layout algorithm to determine whether layout calculation shall be terminated.
Data Provider Key: ABORT_HANDLER_DP_KEY
Maps from graph to AbortHandler
nodeComparer
For each parent node, the order of its child nodes. (Overrides nodeComparer])
Data Provider Key: -
Maps from node to comparison function