Where to Find Up-to-date yFiles Information

This page is from the outdated yFiles for Java 2.13 documentation. You can find the most up-to-date documentation for all yFiles products on the yFiles documentation overview page.

Please see the following links for more information about the yFiles product family of diagramming programming libraries and corresponding yFiles products for modern web apps, for cross-platform Java(FX) applications, and for applications for the Microsoft .NET environment.

More about the yFiles product family Close X

Radial Layout Style

This section presents the radial layout style.

About the Style

In the radial layout style, the nodes of a graph are arranged on concentric circles. The layout calculation starts by conceptually reducing the graph to a tree structure whose root node is taken as the center of all circles. Each child node in this tree structure is then placed on the next outer circle within the sector of the circle that was reserved by its parent node. All edges that were initially ignored are re-established and the radii of the circles are calculated taking the sector sizes needed by each whole subtree into account.

This layout style is well suited for the visualization of directed graphs and tree-like structures.

Terminology

The circles are also referred to as layers. Layer count increases from center to outer.

Figure 5.87. Sample layout produced by class RadialLayouter

Sample layout produced by class RadialLayouter
 
Sample radial layout.  

Class RadialLayouter

Class RadialLayouter is a layout provider of radial layout.

Class RadialLayouter provides a set of options that affect its layout behavior. These options can be set using the setter methods of class RadialLayouter. The options are documented within the API documentation of class RadialLayouter.

Layout Options

The policy to choose the center node from the node set of the graph can be determined by using the setCenterNodesPolicy(byte) method. The following policies are available:

CENTER_NODES_POLICY_DIRECTED
Description Chooses the center node from the set of nodes that have no predecessors. If this set is empty, an arbitrary node of the graph becomes the center node.
CENTER_NODES_POLICY_CENTRALITY
Description The node that has the highest centrality becomes the center node.
CENTER_NODES_POLICY_WEIGHTED_CENTRALITY
Description The node that has the highest weighted centrality becomes the center node. This is the default setting.
CENTER_NODES_POLICY_SELECTED_NODES
Description Uses a custom selection of nodes. To specify the nodes, a data provider holding the selection information for each node is looked up. The data provider is expected to be registered with the graph using the look-up key returned by getCenterNodesDpKey(). If there are more than one node marked as center node, these nodes get placed on the innermost circle and the actual center position remains empty.

The setLayeringStrategy(byte) method specifies how nodes will be distributed to the layers. The following strategies are available:

LAYERING_STRATEGY_BFS
Description Layering based on a breadth-first search (BFS). All edges will span at most one layer in the resulting drawing. Edges between nodes that belong to the same layer are possible. This is the default setting.
LAYERING_STRATEGY_HIERARCHICAL
Description The layer distance of an edge is the absolute difference between the layer numbers of its source and target node. Layer assignment will be done in such a way that the overall sum of the layer distances of all edges in the layout is minimal.

Drawing Style Options

The distance between the layers depends on the space that is needed by the subtrees. However, the layer spacing can be controlled and a minimal distance can be defined.

Layer Spacing
API
void setLayerSpacing(double layerSpacing)
Description Defines a unit value for the distance between circles, i.e., each circle radius is a multiple of this value.
Minimal Layer Distance
API
void setMinimalLayerDistance(double minimalLayerDistance)
Description Defines the minimal layer distance.

Edge routing options include different routing policies that can be specified using the setEdgeRoutingStrategy(byte) method:

EDGE_ROUTING_STRATEGY_POLYLINE
Description Polyline edge routing. Edges will be routed straight-line, if possible, or have bends on the circles.
EDGE_ROUTING_STRATEGY_ARC
Description Arc edge routing. Source and target of an edge as well as one bend on each spanned circle are used as main control points. Additional control points are inserted in-between to create an arc-like edge. This is the default setting.

Note that with both edge routing policies overlaps of edge paths with nodes cannot always be prevented. In particular, this affects edges that span multiple circles (i.e., layers).

Advanced Layout Concepts

Node Halos

RadialLayouter by default supports node halos as soon as they are declared. It considers any specified additional paddings around nodes, however, edges can cross through these areas in the resulting diagram.

The following table lists the data provider look-up keys that are recognized by RadialLayouter in conjunction with node halo support.

Table 5.65. Data provider look-up keys

Key Element Type Value Type Description
NODE_HALO_DPKEY Node NodeHalo A NodeHalo object that specifies the halo sizes at each side of a node.

Edge Bundling

RadialLayouter supports edge bundling for the non-tree edges in a diagram to bundle their paths so that they follow similar routes.

Figure 5.88. Radial layout with edge bundling of non-tree edges

Radial layout with edge bundling of non-tree edges
Edge bundling of non-tree edges in a radial layout.

Using edge bundling significantly reduces the visual clutter in drawings of large graphs with many edges. In addition, high-level patterns of edge routes and relations between different groups of nodes can be highlighted and easily recognized. Edge bundling is commonly used in bio-informatics, social network analysis, telecommunications, and in fraud detection.

Edge bundling in RadialLayouter is supported for the non-tree edges of a diagram.

The actual setup and edge bundling configuration is the responsibility of the EdgeBundling class. RadialLayouter provides the following getter method to access the instance it holds of this class:

EdgeBundling getEdgeBundling()
Description Getter method to access the EdgeBundling instance to configure edge bundling-related drawing options.

This EdgeBundling instance holds an instance of class EdgeBundleDescriptor to store and retrieve default edge bundling values for non-tree edges. The following method can be used to retrieve this default EdgeBundleDescriptor instance:

EdgeBundleDescriptor getDefaultBundleDescriptor()
void setDefaultBundleDescriptor(EdgeBundleDescriptor edgeBundleDescriptor)
Description Methods to access the default edge bundling descriptor held by EdgeBundling.

In addition to the instance held by EdgeBundling, edge bundling descriptors can also be associated with single non-tree edges in order to specify individual settings for them. Setting individual descriptors for non-tree edges is done through a data provider that is bound to the graph. See Related Classes.

Related Classes

Classes EdgeBundling and EdgeBundleDescriptor provide the means to configure drawing options related to the edge bundling support in RadialLayouter.

Class EdgeBundling defines global settings regarding the edge bundling, for example, the strength and the quality of the bundling. It also holds a default EdgeBundleDescriptor instance with fallback settings for the edges of a graph.

Class EdgeBundleDescriptor can be used to configure the bundling settings of an individual edge. It can be specified whether or not:

  • an edge shall be bundled
  • the direction of an edge should be taken into consideration
  • an edge should be approximated by a cubic Bezier curve

To configure the global edge bundling settings class EdgeBundling provides the following methods:

Bundling Strength
API
void setBundlingStrength(double strength)
Description Determines the tightness of the edge bundles. It takes values from interval [0.0, 1.0] where 0.0 corresponds to straight-line, non-bundled edges and 1.0 to strongly bundled edges. For good readability featuring clearly visible bundles, a bundling strength greater than 0.8 is recommended.
Bundling Quality
API
void setBundlingQuality(double quality)
Description Determines the quality of the edge bundling. Higher values require more sophisticated methods to calculate the bundles and, thus, the running time can significantly increase. The setting can take values from interval [0.0, 1.0]. For large graphs, values smaller than 0.2 are recommended.

The per-edge settings can be configured via the following methods in class EdgeBundleDescriptor:

Bundle Edge
API
void setBundled(boolean enabled)
Description Determines whether or not an edge shall be bundled.
Consider Edge Direction
API
void setDirectionConsiderationEnabled(boolean enabled)
Description Determines if the direction of an edge should be taken into consideration. If enabled, incoming and outgoing edges incident to a node are bundled separately.
Use Bezier Fitting
API
void setBezierFittingEnabled(boolean enabled)
Description Determines whether or not the path of an edge should be approximated by a cubic Bezier curve. The number of bends may be significantly reduced by the approximation.

An EdgeBundleDescriptor instance can be specified individually for single edges by means of a data provider that is bound to the graph. The data provider is expected to be registered with the graph using key EDGE_BUNDLE_DESCRIPTOR_DPKEY. In the absence of an individual descriptor for an edge, the default EdgeBundleDescriptor instance that is registered with EdgeBundling will be used.

The following table lists the data provider look-up keys that are recognized by EdgeBundling:

Table 5.66. Data provider look-up keys

Key Element Type Value Type Description
EDGE_BUNDLE_DESCRIPTOR_DPKEY Edge EdgeBundleDescriptor For each edge an EdgeBundleDescriptor object that configures edge bundling options.

Tutorial Demo Code

Tutorial demo application RadialLayouterDemo.java presents radial layout and its layout options.

Layout module RadialLayoutModule.java shows configuration aspects of the radial layout algorithm and can also be used to interactively explore the effects of different settings.

Supplemental Layout Data

Class RadialLayouter knows a number of data provider keys which are used to retrieve supplemental layout data for a graph's elements. The data is bound to the graph by means of a data provider, which is registered using a given look-up key. Table 5.67, “Data provider look-up keys” lists all look-up keys for RadialLayouter.

Binding supplemental layout data to a graph is described in the section called “Providing Supplemental Layout Data”.

Table 5.67. Data provider look-up keys

Key Element Type Value Type Description
NODE_HALO_DPKEY Node NodeHalo A NodeHalo object that specifies the halo sizes at each side of a node.