This layout algorithm arranges grouped graphs in a recursive structure.
Remarks
Layout Style
RadialGroupLayout 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.
Radial group layout algorithms are commonly used for visualizing relational data and for producing diagrams of high quality that are able to showcase hierarchical 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 collapsedSubtreeRoots.
The RadialGroupLayout 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.
The algorithm supports EdgeBundling and all its included features for non-hierarchical edges of the graph.
Defining a preferredRootSectorAngle 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 RadialGroupLayout supports customizing the overlap between nodes and their parent nodes. The overlap can be set individually for each node with parentOverlapRatios.
This layout algorithm handles port placement constraints by applying the PortPlacementStage as a postprocessing step.
Since it is computationally not very complex, RadialGroupLayout is well suited for large graphs. It performs well even for huge graphs.
Layout Stages
This class provides a configurable pipeline that contains various ILayoutStages. Each ILayoutStage can incorporate preprocessing or postprocessing steps into the layout calculation to streamline the input graph and enhance the resulting layout. Additionally, custom ILayoutStages can be added and executed either before or after the predefined ones.
The following default ILayoutStages are included:
- PortPlacementStage: Assigns edges to ports.
- SubgraphLayoutStage: Filters a graph to include only specific nodes and edges from a subgraph while maintaining the positions of excluded elements. Note: This stage is disabled by default.
- ComponentLayout: Arranges graph components with customizable styles. Note: This stage is disabled by default.
- GenericLabeling: Efficiently places node and edge labels. The property fillEmptyScope is set to
false
and stopDuration is set to ZERO. - SelfLoopRouter: Routes self-loops in a graph, allowing for either orthogonal or rounded routing styles.
- ParallelEdgeRouter: Routes multiple edges between the same nodes in parallel. Note: This stage is disabled by default.
With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.
Performance
The RadialGroupLayout algorithm is a fast algorithm that is generally well-suited to handle even large graphs.
With graphs containing a large number of edges, applying edgeBundling can cause the algorithm to take noticeably longer to arrive at a result.
Should the componentLayout stage be enabled for graphs that contain large unconnected components, it can be beneficial to change the component arrangement style of the used componentLayout from the default style PACKED_CIRCLE to the faster ROWS style.
Default Values of Properties
edgeLabelPlacement | GENERIC
| Edge labels are placed by an independent labeling algorithm. |
fromSketchMode | false | The order given by the sketch is ignored. |
groupSizePolicy | ADAPTIVE
| |
nodeLabelPlacement | RAY_LIKE_LEAVES
| Node labels are placed horizontally for inner nodes and ray-like at leaves by this algorithm. |
preferredRootSectorAngle | 360 |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new RadialGroupLayout instance with default settings.
Parameters
A map of options to pass to the method.
- fromSketchMode - boolean
- Whether 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.
- nodeLabelPlacement - RadialNodeLabelPlacement
- How the layout algorithm handles node labels. This option sets the nodeLabelPlacement property on the created object.
- edgeLabelPlacement - RadialEdgeLabelPlacement
- How the layout handles the position of edge labels. This option sets the edgeLabelPlacement property on the created object.
- groupSizePolicy - GroupSizePolicy
- The policy defining how group node sizes are determined. This option sets the groupSizePolicy property on the created object.
- preferredRootSectorAngle - number
- The maximum angle in degrees on which the root's children can be distributed around its center. This option sets the preferredRootSectorAngle property on the created object.
Properties
Gets the ComponentLayout from the layoutStages of this instance.
Remarks
By default, the algorithm handles components by itself and, thus, the ComponentLayout is not enabled.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
Throws
- Exception({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the
Gets the EdgeBundling instance that defines the settings of the edge bundling feature.
Remarks
Property Value
See Also
Gets or sets how the layout handles the position of edge labels.
Default Value
Property Value
See Also
Gets or sets whether the order of subtrees around a root may be changed by the algorithm.
Default Value
false
.The order given by the sketch is ignored.
Property Value
true
if subtree order is fixed, false
otherwise.See Also
Gets or sets the policy defining how group node sizes are determined.
Default Value
ADAPTIVE.Property Value
See Also
Gets the mutable stack of ILayoutStage that will be applied to this layout.
Gets or sets how the layout algorithm handles node labels.
Default Value
RAY_LIKE_LEAVES.Node labels are placed horizontally for inner nodes and ray-like at leaves by this algorithm.
Property Value
- IGNORE if node label positions relative to their owner should be maintained and ignored during the layout process.
- CONSIDER if node label positions relative to their owner should be maintained and considered for the placement of other graph elements to avoid overlaps.
- HORIZONTAL if horizontal node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
- RAY_LIKE if ray-like node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
- RAY_LIKE_LEAVES if a mix of horizontal and ray-like node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
- GENERIC if the node labels should be placed by the GenericLabeling algorithm subsequently.
See Also
Sample Graphs
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
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing value is negative
See Also
Sample Graphs
Gets or sets the maximum angle in degrees on which the root's children can be distributed around its center.
Default Value
360
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if a negative angle, or an angle of more than
360
degrees is specified.
See Also
Sample Graphs
Methods
Arranges the given grouped graph in the style of a radial group layout.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the grouped input graph
See Also
Implements
Arranges the given grouped graph in the style of a radial group layout.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the grouped input graph
createLayoutData
(graph: LayoutGraph) : RadialGroupLayoutData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the RadialGroupLayout.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪RadialGroupLayoutData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given RadialGroupLayout.
Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the RadialGroupLayout.
Remarks
Parameters
A map of options to pass to the method.
- graph - IGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪RadialGroupLayoutData<INode,IEdge,ILabel,ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given RadialGroupLayout.
LayoutExecutor
type is available at runtime.Constants
A data 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.See Also
Sample Graphs
false
.A data key for specifying the overlap of nodes with their parent in the hierarchy.
Remarks
Generally, the RadialGroupLayout algorithm places all child nodes in the hierarchy such that they are touching their respective parent node. However, an overlap can be specified as a fraction of the child's radius, by which the node will be moved towards the parent node's center.
Assign a double value in range [0, 1] for specifying how far a node is moved towards its parent.
See Also
Sample Graphs
0.2
.