Class CompactDiskLayout is a layout algorithm that arranges the graph’s nodes on a disk optimizing the compactness of the placement; see Figure 1. The nodes are placed such that nodes of the same connected component lie closely together; see Figure 2. The compact placement of the nodes makes the layout style mostly suitable for graphs that consist of multiple components each having only few edges. In particular, it is suitable for graphs with one main path such that other edges only connect nodes that lie closely together on that path. Moreover, the layout is optimized for nodes that are represented by uniform circles, which admits a strongly compact packing of the nodes.
Minimal Node Distance
The compactness of the layout can be controlled by the minimum distance between nodes; see Figure 3. The distance is measured between the boundary of the nodes. In order to obtain a particularly dense packing of the nodes the layout algorithm makes assumptions on the shape of the nodes. By default the layout algorithm assumes the nodes to be circles such that each circle has the same center as its node and its radius is the half of the maximum of the node’s width and height. In particular, this assumption implies that using non-circular nodes the layout algorithm may create a placement that has overlapping nodes; see Figure 4.
To enforce that non-circular nodes do not overlap, the user can relax this assumption by providing the layout algorithm with node halos. In that case the layout algorithm approximates the boundary of each node that has a node halo with a sufficiently large circle. This circle is the circumcircle of the bounding box that contains the node as well as the node’s halo. In order to activate this relaxation for a node it is sufficient to add a halo of size 0.
- Enables the "from-sketch" layout
The CompactDiskLayout by default considers node types as soon as they are declared. In that case the connected components are ignored, but the nodes are placed with respect to their node types, i.e., nodes having the same type are placed together; see Figure 6.
The CompactDiskLayout by default considers node halos as soon as they are declared. As explained in Section Minimum Node Distance defining a node halo for a particular node let the layout algorithm assume a rough approximation of the node’s boundary, namely the circumcircle of the bounding box that contains the node as well as its halo.
Edge labels can be placed automatically using the generic labeling support as described in Generic Labeling, which is available with all yFiles layout algorithms. Additionally, the layout algorithm can be set up to take node labels into account during layout. This integrated labeling can be enabled using the following property; see also Integrated Labeling.
Enabling the integrated node labeling support of class CompactDiskLayout let the layout algorithm place the nodes and labels such that there are neither label-label nor node-label overlaps. The following policies are available.
- Each node label is placed with its center at the center of its node such that the label has horizontal orientation; see Figure 7. Multiple node labels will be placed center-aligned and stacked.
- The label of a node is placed on the ray that emanates from the disk’s center and goes through the center of the node. The label is rotated such that it has the same orientation as the ray; see Figure 8. If the node of the label lies at the boundary of the disk, the label’s distance to the disk’s center is chosen such that it lies outside of the disk and touches the boundary of its node. If the node of the label does not lie at the boundary of the disk, the center of label coincides with the center of the node. In case that a node has multiple labels, these labels are stacked on top of each other such that they can be treated as one multi-line label.
- The labels are placed in the same way as RAY_LIKE, however, with the exception that the labels of nodes that do not lie at the boundary of the disk are placed horizontally; see Figure 9 In case that a node has multiple labels, these labels are stacked on top of each other such that they can be treated as one multi-line label.
Note that ray-like labels are only supported for node labels that use a "free" label model, e.g., FreeNodeLabelModel.
Supplemental layout data for a graph’s elements can be specified either by using class CompactDiskLayoutData or by registering data providers with the graph using given look-up keys. Table Supplemental layout data lists the properties of CompactDiskLayoutData and the corresponding look-up keys that are used by CompactDiskLayout during the layout process.
Providing supplemental layout data is described in detail in Layout Data.