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.
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.
- 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.
- 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.
- 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.
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.
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.
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:
- 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:
- 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.
- 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.
- 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.
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.
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.
- Enables the "from-sketch" layout
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.
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
- 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_KEYMaps from node to double
- A NodeHalo object that specifies the halo sizes at each side of a node.Data Provider Key: NODE_HALO_DP_KEYMaps from node to NodeHalo
- A boolean value for marking whether the subtree rooted in a node should be collapsed.Data Provider Key: COLLAPSED_SUBTREE_ROOTS_DP_KEYMaps from node to boolean
- For each edge an EdgeBundleDescriptor object that configures edge bundling options.Data Provider Key: EDGE_BUNDLE_DESCRIPTOR_DP_KEYMaps from edge to EdgeBundleDescriptor
- 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_KEYMaps from graph to AbortHandler