|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.radial.RadialLayouter
public class RadialLayouter
This layout algorithm arranges graphs in a radial fashion.
The nodes are distributed into circles (layers) around a common center based on predefined
layering strategies
. Some potential applications include visualization of social
networks, data clustering and bioinformatics.
Sample output of the layout algorithm with default settings and one center node
Sample output of the layout algorithm with straight-line edges and five center nodes using CENTER_NODES_POLICY_SELECTED_NODES
policy
The layout algorithm creates a virtual tree structure for the input graph whose root node is placed in the center of the circles. All children of a tree node are placed on a higher layer (i.e. on a circle of larger radius) than their parent. A sector is calculated for each node such that the sector of each child node in the virtual tree is a sub-sector of its parent's sector. The radii of the circles are calculated based on the sizes of the sectors required to accommodate each whole subtree.
There are different center nodes policies
that can be applied in order to determine
the nodes that will be placed in the center (single center node) or on the innermost circle (more than one center
node). The distribution of the nodes to the circles is specified by a
layering strategy
.
The edges are routed based on the edge routing strategy
.
Note that the edge routing cannot always prevent node-edge overlaps.
The minimum distance between nodes of the same circle is specified using
setMinimalNodeToNodeDistance(double)
. If there are too many nodes assigned to a circle, the
radius of the particular circle will be increased until all nodes fit onto it.
The distance between consecutive layers is specified using setLayerSpacing(double)
. The radii of the
circles are a multiple of this spacing value. If the layer spacing is 0
, the radii are chosen
such that all nodes fit on their corresponding circles. A minimum layer distance is specified by
setMinimalLayerDistance(double)
.
Nested Class Summary | |
---|---|
static class |
RadialLayouter.NodeInfo
Info object used for retrieving information about each node from the layout algorithm. |
Field Summary | |
---|---|
static byte |
CENTER_NODES_POLICY_CENTRALITY
Specifier for a center nodes policy which chooses the node with the highest centrality as center node. |
static byte |
CENTER_NODES_POLICY_DIRECTED
Specifier for a center nodes policy which chooses all nodes with in-degree equal to 0 as center nodes. |
static byte |
CENTER_NODES_POLICY_SELECTED_NODES
Specifier for a center nodes policy which uses center nodes specified by the user. |
static byte |
CENTER_NODES_POLICY_WEIGHTED_CENTRALITY
Specifier for a center nodes policy which chooses the node with the highest weighted centrality as center node. |
static byte |
EDGE_ROUTING_STRATEGY_ARC
Specifier for an edge routing strategy that will route edges as arcs. |
static byte |
EDGE_ROUTING_STRATEGY_POLYLINE
Specifier for an edge routing strategy that will route edges with polyline segments from source to target with one bend on each spanned circle. |
static java.lang.Object |
LAYER_ID_DPKEY
A DataProvider key for providing user-defined layer/circle IDs.
|
static byte |
LAYERING_STRATEGY_BFS
Specifier for a layering strategy that uses breadth first search (BFS) to determine a layering for the graph. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL
Specifier for a layering strategy that uses an optimal hierarchical layering strategy. |
static byte |
LAYERING_STRATEGY_USER_DEFINED
Specifier for a layering strategy that uses a custom, user-defined layer/circle assignment. |
static java.lang.Object |
NODE_INFO_DPKEY
A DataAcceptor key for publishing the circle ID and sector data
For each node, the ID of the circle and data regarding the circular sector on which it was placed will be stored. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
RadialLayouter()
Creates a new RadialLayouter instance with the default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts all general graphs. |
protected NodeList |
determineCenter(LayoutGraph graph)
Determines the center nodes of the graph according to the selected center node policy. |
void |
doLayoutCore(LayoutGraph graph)
Calculates a radial arrangement for the given graph. |
java.lang.Object |
getCenterNodesDpKey()
Returns the DataProvider key used for looking up the selected nodes that should be placed in the center. |
byte |
getCenterNodesPolicy()
Returns the policy that determines which nodes are selected as roots of the (virtual) tree for the layout process and are set in the center of the circles. |
EdgeBundling |
getEdgeBundling()
Returns the EdgeBundling instance that defines the settings of the edge bundling feature. |
byte |
getEdgeRoutingStrategy()
Returns the edge routing strategy. |
byte |
getLayeringStrategy()
Returns the layering strategy that determines how nodes are distributed into different layers. |
double |
getLayerSpacing()
Returns the spacing between two consecutive circles (layers). |
double |
getMaximalChildSectorAngle()
Returns the maximum sector angle around a node within which the node's children will be placed. |
double |
getMinimalBendAngle()
Returns the minimum bend angle (in degrees) between two adjacent edge segments. |
double |
getMinimalLayerDistance()
Returns the minimum distance between two circles. |
double |
getMinimalNodeToNodeDistance()
Returns the minimum distance between two neighboring nodes of the same circle. |
protected double |
getNodeDiameter(LayoutGraph graph,
Node node)
Returns the diameter of the circular space around the center of a given node that should be reserved in order to place the node. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not node labels are taken into account when calculating node positions. |
void |
setCenterNodesDpKey(java.lang.Object centerNodesDpKey)
Specifies the DataProvider key used for looking up the selected nodes that should be placed in the center. |
void |
setCenterNodesPolicy(byte policy)
Specifies the policy that determines which nodes are selected as roots of the (virtual) tree for the layout process and are placed in the center of the circles. |
void |
setConsiderNodeLabelsEnabled(boolean handleNodeLabels)
Specifies whether or not node labels are taken into account when calculating node positions. |
void |
setEdgeRoutingStrategy(byte edgeRoutingStrategy)
Specifies the edge routing strategy. |
void |
setLayeringStrategy(byte layeringStrategy)
Specifies the layering strategy that determines how nodes are distributed into different layers. |
void |
setLayerSpacing(double layerSpacing)
Specifies the spacing between two consecutive circles (layers). |
void |
setMaximalChildSectorAngle(double maximalChildSectorAngle)
Specifies the maximum angle (in degrees) of the sector around a node on which its children will be placed. |
void |
setMinimalBendAngle(double minimalBendAngle)
Specifies the minimum bend angle (in degrees) between two adjacent edge segments. |
void |
setMinimalLayerDistance(double minimalLayerDistance)
Specifies the minimum distance between two circles. |
void |
setMinimalNodeToNodeDistance(double minimalNodeToNodeDistance)
Specifies the minimum distance between two neighboring nodes of the same circle. |
void |
setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object NODE_INFO_DPKEY
DataAcceptor
key for publishing the circle ID and sector data
For each node, the ID of the circle and data regarding the circular sector on which it was placed will be stored.
DataProvider
is registered with this key, information about circle ID and sector data will
be dropped.RadialLayouter.NodeInfo
provided by the DataProvider
registered with this key.
It is only intended to publish information after the layout has been calculated.public static final byte CENTER_NODES_POLICY_DIRECTED
0
as center nodes.
If no node with this property is present, an arbitrary node will be selected.
public static final byte CENTER_NODES_POLICY_CENTRALITY
public static final byte CENTER_NODES_POLICY_WEIGHTED_CENTRALITY
public static final byte CENTER_NODES_POLICY_SELECTED_NODES
DataProvider
registered with the
according key
. The DataProvider
returns true
for nodes that should be placed in the center.
If there exists more than one center node, they will be placed on the innermost circle while the center position stays empty.
public static final byte LAYERING_STRATEGY_BFS
public static final byte LAYERING_STRATEGY_HIERARCHICAL
public static final byte LAYERING_STRATEGY_USER_DEFINED
The nodes' layer/circle assignment must be provided by a DataProvider
registered with the input graph
with the key LAYER_ID_DPKEY
. If no data is provided and this strategy is selected, then the
algorithm will throw an exception.
Using this strategy, the center nodes (nodes on the innermost circle) are not determined by the
specified center nodes policy
anymore. Instead, the nodes with the
smallest given ID (i.e. 0
) are part of the center nodes.
getCenterNodesPolicy()
is ignored.setLayeringStrategy(byte)
,
LAYER_ID_DPKEY
,
Constant Field Valuespublic static final java.lang.Object LAYER_ID_DPKEY
DataProvider
key for providing user-defined layer/circle IDs.
The DataProvider
registered with this key provides for each node the layer/circle ID to which it belongs.
Nodes with the same ID are placed on the same circle while the circles are sorted according to their
IDs such that a smaller ID means that the circle has a smaller radius and is closer to the center of
the radial layout.
When providing user-defined IDs, the center nodes (nodes on the innermost circle) are not determined by the
specified center nodes policy
anymore. Instead, the nodes with the
smallest given ID (i.e. 0
) define the set of center nodes.
LAYERING_STRATEGY_USER_DEFINED
is specified.LAYERING_STRATEGY_USER_DEFINED
public static final byte EDGE_ROUTING_STRATEGY_POLYLINE
public static final byte EDGE_ROUTING_STRATEGY_ARC
Constructor Detail |
---|
public RadialLayouter()
RadialLayouter
instance with the default settings.
Method Detail |
---|
public void setMinimalNodeToNodeDistance(double minimalNodeToNodeDistance)
public double getMinimalNodeToNodeDistance()
setMinimalNodeToNodeDistance(double)
public double getLayerSpacing()
The spacing is a non-negative value, where 0
means that no spacing is considered.
The radius of each circle will be a multiple of this value.
setLayerSpacing(double)
public void setLayerSpacing(double layerSpacing)
The spacing is a non-negative value, where 0
means that no spacing is considered.
The radius of each circle will be a multiple of this value.
public double getMinimalLayerDistance()
setMinimalLayerDistance(double)
public void setMinimalLayerDistance(double minimalLayerDistance)
public double getMaximalChildSectorAngle()
Based on the location of a given node, the sector of its children that lie on the next outer layer is described by this angle. The vertex of the angle is located in the center of the node while its sides point away from the inner circles. The child nodes are placed inside this angle. If there is not enough space, the radius of the child circle is increased.
[0,360]
setMaximalChildSectorAngle(double)
public void setMaximalChildSectorAngle(double maximalChildSectorAngle)
Based on the location of a given node, the sector of its children that lie on the next outer layer is described by this angle. The vertex of the angle is located in the center of the node while its sides point away from the inner circles. The child nodes are placed inside this angle. If there is not enough space, the radius of the child circle is increased.
maximalChildSectorAngle
- the maximum sector angle in degrees from the interval [0,360]
java.lang.IllegalArgumentException
- if the sector angle is negative or greater than 360
degreesMaximum sector angle 90 | Maximum sector angle 180 | Maximum sector angle 360 |
public double getMinimalBendAngle()
The minimum bend angle is defined to be a value between 0
and 90
degrees.
[0,90]
setMinimalBendAngle(double)
public void setMinimalBendAngle(double minimalBendAngle)
The minimum bend angle is defined to be a value between 0
and 90
degrees.
minimalBendAngle
- an angle from the interval [0,90]
java.lang.IllegalArgumentException
- if the given minimum bend angle is negative or greater than 90
Minimum bend angle 1 | Minimum bend angle 20 |
public void setCenterNodesPolicy(byte policy)
LAYERING_STRATEGY_USER_DEFINED
. Instead, the nodes with the smallest provided
layer/circle ID determine the center nodes.CENTER_NODES_POLICY_WEIGHTED_CENTRALITY
. The node determined using weighted centrality is placed
in the center.policy
- one of the predefined center node policies
java.lang.IllegalArgumentException
- if an invalid center node policy is givenpublic byte getCenterNodesPolicy()
LAYERING_STRATEGY_USER_DEFINED
. Instead, the nodes with the smallest provided
layer/circle ID determine the center nodes.setCenterNodesPolicy(byte)
public java.lang.Object getCenterNodesDpKey()
DataProvider
key used for looking up the selected nodes that should be placed in the center.
center node policy
is set to
CENTER_NODES_POLICY_SELECTED_NODES
.DataProvider
key for the selection of center nodessetCenterNodesDpKey(Object)
public void setCenterNodesDpKey(java.lang.Object centerNodesDpKey)
DataProvider
key used for looking up the selected nodes that should be placed in the center.
center node policy
is set to
CENTER_NODES_POLICY_SELECTED_NODES
.Layouter.SELECTED_NODES
. The selected nodes are placed in the center.centerNodesDpKey
- the DataProvider
key for the selection of center nodes
java.lang.IllegalArgumentException
- if the specified key is null
getCenterNodesDpKey()
public byte getLayeringStrategy()
setLayeringStrategy(byte)
public void setLayeringStrategy(byte layeringStrategy)
LAYERING_STRATEGY_BFS
. The layers are determined using BFS.layeringStrategy
- one of the predefined layering strategies
java.lang.IllegalArgumentException
- if an invalid layering strategy is setpublic byte getEdgeRoutingStrategy()
setEdgeRoutingStrategy(byte)
public void setEdgeRoutingStrategy(byte edgeRoutingStrategy)
EDGE_ROUTING_STRATEGY_ARC
. The edges will be routed as arcs.edgeRoutingStrategy
- the edge routing strategy
java.lang.IllegalArgumentException
- if an invalid edge routing strategy is setpublic boolean isConsiderNodeLabelsEnabled()
layout orientation
is set to LayoutOrientation.TOP_TO_BOTTOM
(which is the default).
Changing the layout orientation for an undirected layout algorithm like the
RadialLayouter
doesn't make sense.true
if node labels are considered, false
otherwisesetConsiderNodeLabelsEnabled(boolean)
public void setConsiderNodeLabelsEnabled(boolean handleNodeLabels)
layout orientation
is set to LayoutOrientation.TOP_TO_BOTTOM
(which is the default).
Changing the layout orientation for an undirected layout algorithm like the
RadialLayouter
doesn't make sense.handleNodeLabels
- true
if labels should be considered, false
otherwisefalse | true |
public void setOrientationLayouterEnabled(boolean enabled)
LayoutStage
that modifies the orientation of the layout is activated.
setOrientationLayouterEnabled
in class CanonicMultiStageLayouter
LayoutOrientation.TOP_TO_BOTTOM
, the orientation of
the layout will not be modified.OrientationLayouter
has no significant
effect.LayoutStage
is activated.enabled
- true
if the stage that modifies the orientation is activated,
false
otherwiseCanonicMultiStageLayouter.isOrientationLayouterEnabled()
,
CanonicMultiStageLayouter.setOrientationLayouter(y.layout.LayoutStage)
,
CanonicMultiStageLayouter.setLayoutOrientation(byte)
,
OrientationLayouter
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all kinds of graphspublic void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graphprotected NodeList determineCenter(LayoutGraph graph)
This method may be overridden to introduce a custom policy that selects center nodes.
graph
- the input graph
getCenterNodesPolicy()
,
setCenterNodesPolicy(byte)
protected double getNodeDiameter(LayoutGraph graph, Node node)
This value describes the circular area that a given node requires in order to be arranged on its own circle
without overlapping with other nodes of the same layer. By default, this value equals to the actual diameter of
the given node extended by minimum node to node distance
.
In this manner, nodes maintain enough distance from the remaining nodes.
This method may be overridden to reserve more or different amounts of space around each node of the graph.
graph
- the input graphnode
- the given node
public EdgeBundling getEdgeBundling()
EdgeBundling
instance that defines the settings of the edge bundling feature.
The specified EdgeBundling
defines global bundling properties. Settings for individual
edges can be defined by assigning an EdgeBundleDescriptor
to an edge using a DataProvider
registered with key EdgeBundling.EDGE_BUNDLE_DESCRIPTOR_DPKEY
.
default
bundle descriptor
which has bundling
enabled.hierarchic layering
strategy
is selected.EdgeBundling
instance defining the edge bundling setup
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |