C

RadialTreeLayout

A tree layout algorithm that arranges the subtrees of the tree in a radial fashion.
ImplementsInheritance Hierarchy

Remarks

Layout Style

RadialTreeLayout is designed to arrange directed and undirected tree graphs. Subtrees rooted at a node are placed in a radial fashion around their root node. All direct children of one node can be placed on a common circle around their parent node (depending on the alignment policy). Therefore, subtrees look like balloons or stars, especially if subtrees have similar sizes. The edges of the tree are drawn as straight lines.

Sample radial tree drawing of a large tree obtained with default settings

Sample radial tree drawing featuring interleaved child placement and ray-like node labels

Concept

The algorithm executes the following steps:

  1. Select a root node according to the specified policy.
  2. Determine the placement of subtrees around the root using a bottom-up recursive approach (starting with leaf nodes).
    • For a leaf node: calculate the convex hull of the node.
    • For a non-leaf node: arrange the children rooted at the node. Children are sorted according to a specified ordering policy and a distance to their parent is chosen. This distance will be chosen such that subtrees rooted at the current node fit into the preferred sector angle. The sector angle defines how much radial space a subtree occupies around its parent; it is computed using the convex hull of subtrees.

      Finally, the convex hull of the subtree rooted at the current node is updated in order to include all the convex hulls of child nodes. This is possible, because distances and sectors of the child subtrees are now known.

  3. Assign the actual coordinates of nodes, again using a recursive approach (starting with the root node).

Features

The algorithm features integrated edge labeling as well as node labeling. Edge labels and node labels are placed automatically without generating overlaps with other labels or graph elements. There are different ways to place node labels. Edge labeling will take the settings of EdgeLabelPreferredPlacement into account.

Defining a preferred sector angle has a great influence on the layout style. Subtrees rooted at a node get a certain amount of radial space to be placed around the parent node, such that a preferred angle close to 360 degrees will generate drawings where subtrees look like balloons, while an angle close to 180 degrees could be chosen to get drawings where subtrees look like semicircles.

Since it is computationally not very complex, RadialTreeLayout is very well suited for large tree graphs. It performs well even for huge graphs.

nodeTypes are considered such that the type of the nodes is used as a criterion for sorting the child nodes of a local root node, with the effect that nodes of the same type are placed consecutively, if possible. If defined, the childOrder is stronger than the node type criterion. However, the node types are considered more important than the childOrderingPolicy.

This layout algorithm can only handle graphs with a tree structure. To make it applicable to general graphs, the treeReductionStage is used by default. This stage will temporarily remove some edges of the input graph until a tree is obtained. These edges will later be reinserted and routed separately.

This layout algorithm handles port placement constraints by applying the PortPlacementStage as a postprocessing step.

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:

With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.

Performance

The RadialTreeLayout algorithm is a fast algorithm that is generally well-suited to handle even large graphs.

With disconnected 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

NameDefaultDescription
allowOverlapsfalse
Nodes are not allowed to overlap.
chainStraighteningModefalse
There is no guarantee that chains are drawn straight.
compactnessFactor0.5
A factor offering good balance between compactness and runtime.
edgeLabelPlacementEdgeLabelPlacement.INTEGRATED
Edge labels are placed by the layout algorithm.
minimumEdgeLength40
minimumNodeDistance10
nodeLabelPlacementRadialNodeLabelPlacement.CONSIDER
Node labels are considered by this algorithm.
preferredChildSectorAngle340
preferredRootSectorAngle360

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new RadialTreeLayout instance with default settings.

Parameters

Properties

Gets or sets whether or not (partially) overlapping nodes are allowed.
If overlaps are allowed, the resulting layouts can become significantly more compact. Overlaps will mostly occur at the borders of nodes. Nodes will not be totally covered by other nodes.
For smaller graphs or graphs where most nodes have a low outdegree count, overlaps will often not occur, even if this property is enabled. This allows really compact drawings of such graphs.
The computation of the convex hull of a node depends on this setting: the outer circle with respect to the rectangle defined by height and width of a node is taken if overlaps are not allowed. Otherwise, the inner circle is used for the convex hull.
final

Property Value

true if node overlaps are allowed, false otherwise

Default Value

The default value is: false
Nodes are not allowed to overlap.

Sample Graphs

ShownSetting: false

See Also

Developer's Guide
Gets or sets whether or not chains are drawn straight.

A chain is defined as a tree node with exactly one child node. If this feature is enabled, then the incoming edge and outgoing edge of the chain will have the same orientation, i.e., the whole chain looks straight.

Straightening all chains can lead to smoother, more symmetric results.

This feature improves result quality especially if a graph has many (large) labels associated to nodes and edges, because in that case non-straight chains are more likely.
final

Property Value

true if chains are drawn straight, false otherwise.

Default Value

The default value is: false
There is no guarantee that chains are drawn straight.

Sample Graphs

ShownSetting: false

See Also

Developer's Guide
Gets or sets the child alignment policy for this layout algorithm.
This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.
The alignment policy can have a high influence on the result if node sizes and/or subtree sizes are differing a lot. It also has a high influence if the graph contains labels - especially large edge labels - and if the edgeLabelPlacement is set to INTEGRATED labeling.
conversionfinal

Property Value

one of the predefined child alignment policies

Default Value

The default value is: ChildAlignmentPolicy.COMPACT

See Also

Developer's Guide
Gets or sets the child ordering policy for sorting the child nodes around their parents.
The sorting policy can affect the compactness of drawings. Advantageous orderings allow adjacent subtrees to be close together and can thus make the whole layout more compact.
This policy is ignored for nodes whose children are placed in an interleaved fashion.
This policy is ignored if a comparer for sorting edges is specified, see childOrder, or if nodeTypes are set.
conversionfinal

Property Value

one of the predefined child ordering policies

Default Value

The default value is: ChildOrderingPolicy.COMPACT

See Also

Developer's Guide
Gets or sets the compactness factor for the layout.

Smaller values may result in less compact drawings, larger values in more compact drawings.

The algorithm tries to optimize the child node arrangement around each tree node such that each subtree is as close to its root as possible, while still fitting into the preferred sector angle and not overlapping with adjacent subtrees.

Low compactness factor values induce the optimization procedure to be less strict and accept less optimal results, while high factor values mean that the optimization will only stop when being nearly optimal. Thus, higher values lead to a potentially higher runtime.

The compactness factor needs to lie in the interval [0, 1].

final

Property Value

the compactness factor from the interval [0, 1]

Throws

Exception ({ name: 'ArgumentError' })
if the factor is smaller than 0.0 or greater than 1.0

Default Value

The default value is: 0.5
A factor offering good balance between compactness and runtime.

See Also

Developer's Guide
Gets the ComponentLayout from the layoutStages of this instance.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
readonlyfinal

Throws

Exception ({ name: 'InvalidOperationError' })
If there is no instance of the respective type in the layoutStages
Gets or sets how the layout handles the position of edge labels.
conversionfinal

Property Value

INTEGRATED if the layout algorithm places the edge labels avoiding overlaps, IGNORE if the edge labels are ignored by the layout algorithm, and GENERIC if the edge labels are placed by the GenericLabeling algorithm subsequently.

Default Value

The default value is: EdgeLabelPlacement.INTEGRATED
Edge labels are placed by the layout algorithm.

Sample Graphs

ShownSetting: IGNORE

See Also

Developer's Guide
Gets or sets the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge.
The spacing must have a non-negative value.
With a spacing of 0, labels will touch each other and the target node.
The spacing value has an effect only if edgeLabelPlacement is set to INTEGRATED.
final

Property Value

the non-negative edge label spacing

Throws

Exception ({ name: 'ArgumentError' })
if the given label spacing value is negative

Default Value

The default value is: 4.0
Labels are close together and close to targets.

Sample Graphs

ShownSetting: Default edge label spacing of 4.0

See Also

API
edgeLabelPlacement
Gets or sets the minimum length that this layout algorithm assigns to edges of the graph.

A lower minimum edge length allows generally more compact layouts. It has the highest effect if most nodes of the graph have a low degree, as the minimum can potentially be met for such graphs.

The minimum length must be non-negative.

Really small minimum edge length values (i.e. smaller than 5) are not recommended, because edges may be barely visible in the result drawing.
final

Property Value

the non-negative minimum edge length

Throws

Exception ({ name: 'ArgumentError' })
if the given length is negative

Default Value

The default value is: 40

Sample Graphs

ShownSetting: 20

See Also

Developer's Guide
Gets or sets the minimum distance to be kept between the nodes in the tree.
The minimum distance must be non-negative.
This minimum distance is not always considered if overlaps are allowed.
final

Property Value

the non-negative minimum node distance

Throws

Exception ({ name: 'ArgumentError' })
if the given minimum distance is negative

Default Value

The default value is: 10

Sample Graphs

ShownSetting: Minimum distance 0 (default)

See Also

API
allowOverlaps
Gets or sets how the layout algorithm handles node labels.
Optimal label placement with integrated labeling can be achieved using a label model which allows free placement of node labels.
conversionfinal

Property Value

  • IGNORE if node labels should be 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.

Default Value

The default value is: RadialNodeLabelPlacement.CONSIDER
Node labels are considered by this algorithm.

Sample Graphs

ShownSetting: IGNORE - Note that assumed label positions before the layout run were not changed

See Also

Developer's Guide
API
RadialNodeLabelPlacement
Gets or sets the distance between node labels belonging to the same node.

It also defines the distance between labels and the node they belong to in case of label placement outside of the node (e.g. for ray-like label placement).

The spacing must have a non-negative value.

With a spacing of 0, node labels will be maximally close to each other and to their node.
The spacing value has an effect only if the policy for placing node labels is set to one of HORIZONTAL, RAY_LIKE or RAY_LIKE_LEAVES.
final

Property Value

the non-negative node label spacing

Throws

Exception ({ name: 'ArgumentError' })
if the given spacing value is negative

Default Value

The default value is: 4.0

Sample Graphs

ShownSetting: Default node label spacing of 4.0

See Also

API
nodeLabelPlacement
Gets the ParallelEdgeRouter from the layoutStages of this instance.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
readonlyfinal

Throws

Exception ({ name: 'InvalidOperationError' })
If there is no instance of the respective type in the layoutStages
Gets or sets the preferred radial amount (sector) in degrees that child nodes may in total occupy around their parent node.

The sector angle controls the degree to which the child nodes may radiate from the center of layout. A value close to 360 means that the child nodes may radiate in (almost) any direction from their parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that children are restricted to a small angle; thus, edge lengths (and drawings) may become large.

The minimum allowed sector angle is 1 and the maximum allowed value is 359.

To get drawings where each subtree looks radial-like, an angle close to 360 is needed.
The angle of the designated root node of the tree is not affected by this setting. The preferred angle of the root can be specified using preferredRootSectorAngle.
final

Property Value

the preferred sector angle in degrees from the interval [1,359]

Throws

Exception ({ name: 'ArgumentError' })
if the given angle is smaller than 1 or larger than 359

Default Value

The default value is: 340

Sample Graphs

ShownSetting: Child sector angle 359 (same for root node)

See Also

Developer's Guide
API
preferredRootSectorAngle
Gets or sets the preferred radial amount (sector) in degrees that child nodes may in total occupy around the global root.

This property allows to separately control the sector angle for the designated root node of the tree, while preferredChildSectorAngle controls the angles of all child nodes. The root node will be determined depending on the rootSelectionPolicy.

The minimum allowed root sector angle is 1 and the maximum allowed value is 360.

final

Property Value

the preferred sector angle in degrees from the interval [1,360]

Throws

Exception ({ name: 'ArgumentError' })
if the given angle is smaller than 1 or larger than 360

Default Value

The default value is: 360

Sample Graphs

ShownSetting: Root sector angle 180

See Also

Developer's Guide
API
preferredChildSectorAngle
Gets or sets the root node selection policy of this layout algorithm.

The policy determines which node is chosen as (virtual) tree root during the layout process.

To define a custom root node instead of using the predefined policies, utilize the property treeRoot. In this case, the value of rootSelectionPolicy will be ignored.

conversionfinal

Property Value

one of the predefined root node policies

Default Value

The default value is: RootSelectionPolicy.DIRECTED_ROOT

See Also

Developer's Guide
Gets the SelfLoopRouter from the layoutStages of this instance.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
readonlyfinal

Throws

Exception ({ name: 'InvalidOperationError' })
If there is no instance of the respective type in the layoutStages
Gets the TreeReductionStage from the layoutStages of this instance.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
readonlyfinal

Throws

Exception ({ name: 'InvalidOperationError' })
If there is no instance of the respective type in the layoutStages

Methods

Calculates a radial tree layout of the graph.
In contrast to applyLayoutCore, the graph and layout algorithm are prepared for an independent layout run.
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph.

Parameters

graph: LayoutGraph
the input graph
Arranges the given graph as a tree graph in a radial-tree-like fashion.
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph. This method is not side effect free in the sense that the order of edges or nodes in the input graph may change during the layout process.
protectedfinal

Parameters

graph: LayoutGraph
The input graph

Throws

Exception ({ name: 'ArgumentError' })
If the given graph is not a tree
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the RadialTreeLayout.
The generic type arguments of the created layout data are compatible with instances of LayoutGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.

Parameters

graph: LayoutGraph
the graph that determines the generic type arguments of the created layout data

Return Value

RadialTreeLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
an instance of layout data that can be used to perform item-specific configurations for the given RadialTreeLayout.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the RadialTreeLayout.
The generic type arguments of the created layout data are compatible with instances of IGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.

Parameters

graph?: IGraph
the graph that determines the generic type arguments of the created layout data

Return Value

RadialTreeLayoutData<INode, IEdge, ILabel, ILabel>
an instance of layout data that can be used to perform item-specific configurations for the given RadialTreeLayout.

Constants

All constants are filtered. Go to Filters.