|
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.organic.OrganicLayouter
public class OrganicLayouter
A layout algorithm that arranges graphs in an organic fashion, using a force-directed drawing approach.
The organic layout style is characterized by a natural distribution of nodes. It is well suited to exhibit clusters and symmetric properties of a graph. Nodes are placed in a space-saving manner, close to their adjacent nodes. Distances between neighbors and edge lengths are highly uniform and edges are drawn as straight-line segments without bends.
Organic diagrams are well suited for visualizing relations in large networks, for example, in bioinformatics, enterprise networking, social networks visualization, mesh visualization or system management.
Organic layout obtained using default settings
Organic layout exposing symmetries of the graph structure
This algorithm uses a force-directed approach to place the nodes of the input graph. The graph is modeled as a physical system with forces acting on it. Nodes are considered as electrically charged particles with mutually repulsive forces. Edges are modeled as springs that attract adjacent nodes. A good diagram is obtained from an equilibrium state of the system, i.e., the nodes are rearranged based on the physical forces until the system reaches a (local) minimum of the sum of the forces.
The tree beautifier
feature activates a special layout style for
subgraphs with a tree structure. These subgraphs will be arranged using an algorithm
dedicated to tree graphs and incorporated into the main organic diagram.
Several parameters for the internal force-directed drawing algorithm can be modified. For example,
the repulsion
, attraction
and
initial temperature
can be controlled.
This allows experts to configure and fine-tune the algorithm with respect to their needs.
Field Summary | |
---|---|
static byte |
ALL
Scope mode indicating that the algorithm should place all nodes of the graph. |
static byte |
AS_IS
Initial placement strategy for starting with the node locations as they are in the input graph. |
static java.lang.Object |
FIXED_GROUP_NODES_DPKEY
A DataProvider key for marking group nodes as fixed
The content of a fixed group node will not be changed by this algorithm but be treated as fixed. |
static byte |
FIXED_GROUPS_POLICY
Group handling policy for keeping the relative positions of nodes that belong to the same group fixed. |
static byte |
IGNORE_GROUPS_POLICY
Group handling policy for completely ignoring group nodes during the layout process. |
static byte |
LAYOUT_GROUPS_POLICY
Group handling policy for considering and arranging the nodes contained in a group such that their togetherness is highlighted. |
static byte |
MAINLY_SELECTION
Scope mode indicating that the algorithm should place a subset of nodes but may to a certain degree also move nodes that are structurally close to a node from the subset. |
static byte |
MAINLY_SELECTION_GEOMETRIC
Scope mode indicating that the algorithm should place a subset of nodes but may to a certain degree also move nodes that are geometrically close to a node from the subset. |
static byte |
ONLY_SELECTION
Scope mode indicating that the algorithm should only place a subset of nodes. |
static java.lang.Object |
PREFERRED_EDGE_LENGTH_DATA
A DataProvider key for defining an individual preferred length for each edge
|
static byte |
RANDOM
Initial placement strategy for starting with randomly chosen node locations. |
static java.lang.Object |
SPHERE_OF_ACTION_NODES
A DataProvider key for marking the nodes that are part of the current scope
|
static byte |
ZERO
Initial placement strategy for starting with all node location coordinates set to 0 . |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrganicLayouter()
Creates a new OrganicLayouter with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts general graphs without exception. |
void |
dispose()
Frees internal resources which were in use during a previous algorithm run. |
void |
doLayoutCore(LayoutGraph graph)
Calculates an organic arrangement of the given graph. |
boolean |
getActivateDeterministicMode()
Returns whether or not the deterministic mode of the layout algorithm is enabled. |
boolean |
getActivateTreeBeautifier()
Returns whether or not to arrange subtrees of the input graph in a special, optimized tree style. |
int |
getAttraction()
Returns the edge attraction value. |
double |
getFinalTemperature()
Returns the absolute, final temperature value, which will cause the algorithm to stop if the average temperature falls under this value. |
double |
getGravityFactor()
Returns the gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph. |
GroupBoundsCalculator |
getGroupBoundsCalculator()
Returns the GroupBoundsCalculator instance used for calculating the size of group nodes. |
double |
getGroupNodeCompactness()
Returns the compactness of group nodes. |
byte |
getGroupNodePolicy()
Returns the policy for the handling of group nodes. |
byte |
getInitialPlacement()
Returns the strategy for the initial placement of nodes. |
double |
getInitialTemperature()
Returns the initial temperature for the force-directed layout process. |
double |
getIterationFactor()
Returns the iteration factor which influences the maximum number of optimization iterations the algorithm may perform. |
long |
getMaximumDuration()
Returns the maximum duration in milliseconds that this layout algorithm is allowed to run. |
boolean |
getObeyNodeSize()
Returns whether or not to consider node sizes during layout calculation. |
double |
getPreferredEdgeLength()
Returns the default preferred edge length. |
int |
getRepulsion()
Returns the node repulsion value. |
byte |
getSphereOfAction()
Returns the scope that determines which nodes are placed by this algorithm. |
boolean |
isMultiThreadingAllowed()
Returns whether or not the layout algorithm may use multi-threading to reduce the running time. |
void |
setActivateDeterministicMode(boolean activate)
Specifies whether or not the deterministic mode of the layout algorithm is enabled. |
void |
setActivateTreeBeautifier(boolean activate)
Specifies whether or not to arrange subtrees of the input graph in a special, optimized tree style. |
void |
setAttraction(int attraction)
Sets the edge attraction value. |
void |
setFinalTemperature(double finalTemperature)
Specifies the absolute, final temperature value, which will cause the algorithm to stop if the average temperature falls under this value. |
void |
setGravityFactor(double factor)
Specifies the gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph. |
void |
setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Specifies the GroupBoundsCalculator instance used for calculating the size of group nodes. |
void |
setGroupNodeCompactness(double groupNodeCompactness)
Specifies the compactness of group nodes. |
void |
setGroupNodePolicy(byte groupNodePolicy)
Specifies the policy for the handling of group nodes. |
void |
setInitialPlacement(byte initialPlacement)
Specifies the strategy for the initial placement of nodes. |
void |
setInitialTemperature(double initialTemperature)
Specifies the initial temperature for the force-directed layout process. |
void |
setIterationFactor(double factor)
Specifies the iteration factor which influences the maximum number of optimization iterations the algorithm may perform. |
void |
setMaximumDuration(long maximumDurationMillis)
Specifies the maximum duration in milliseconds that this layout algorithm is allowed to run. |
void |
setMultiThreadingAllowed(boolean multiThreadingAllowed)
Specifies whether or not the layout algorithm may use multi-threading to reduce the running time. |
void |
setObeyNodeSize(boolean obey)
Specifies whether or not to consider node sizes during layout calculation. |
void |
setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. |
void |
setPreferredEdgeLength(double edgeLength)
Specifies the default preferred edge length. |
void |
setRepulsion(int repulsion)
Sets the node repulsion value. |
void |
setSphereOfAction(byte scope)
Specifies the scope that determines which nodes are placed by this algorithm. |
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 SPHERE_OF_ACTION_NODES
DataProvider
key for marking the nodes that are part of the current scope
scope
of the algorithm
is set to ONLY_SELECTION
, MAINLY_SELECTION
or MAINLY_SELECTION_GEOMETRIC
.setSphereOfAction(byte)
public static final java.lang.Object FIXED_GROUP_NODES_DPKEY
DataProvider
key for marking group nodes as fixed
The content of a fixed group node will not be changed by this algorithm but be treated as fixed.
The groups marked as fixed will be considered for the group node policy
settings FIXED_GROUPS_POLICY
and LAYOUT_GROUPS_POLICY
.
When IGNORE_GROUPS_POLICY
is chosen, the data provider registered with this key will be ignored.
setGroupNodePolicy(byte)
,
FIXED_GROUPS_POLICY
,
LAYOUT_GROUPS_POLICY
public static final byte RANDOM
setInitialPlacement(byte)
,
Constant Field Valuespublic static final byte ZERO
0
.
This strategy is best if the initial placement should be maximally neutral, ignoring the existing layout of the input graph.
setInitialPlacement(byte)
,
Constant Field Valuespublic static final byte AS_IS
This strategy is best if the existing layout should change as little as possible.
setInitialPlacement(byte)
,
Constant Field Valuespublic static final byte LAYOUT_GROUPS_POLICY
DataProvider
with key FIXED_GROUP_NODES_DPKEY
.setGroupNodePolicy(byte)
,
Constant Field ValuesInitial graph | Group policy LAYOUT_GROUPS_POLICY |
public static final byte FIXED_GROUPS_POLICY
The fixed groups will be taken into account when placing the other nodes of the graph.
By registering a DataProvider
with key FIXED_GROUP_NODES_DPKEY
, the individual
group nodes can be marked as fixed or not fixed. If there is no data provider registered with the
mentioned key, then all group nodes of the graph will be treated as fixed.
setGroupNodePolicy(byte)
,
Constant Field ValuesInitial graph | Group policy FIXED_GROUPS_POLICY |
public static final byte IGNORE_GROUPS_POLICY
setGroupNodePolicy(byte)
,
Constant Field ValuesInitial graph | Group policy IGNORE_GROUPS_POLICY |
public static final byte ALL
public static final byte MAINLY_SELECTION
Nodes that don't belong to the actual subset may be moved if they are structurally close to nodes from the subset, but they will keep their relative positions to the other nodes outside the subset.
The actual subset is determined by a boolean value returned by a DataProvider
registered
with key SPHERE_OF_ACTION_NODES
.
public static final byte MAINLY_SELECTION_GEOMETRIC
Nodes that don't belong to the actual subset may be moved if they are geometrically close to nodes from the subset. To measure the geometric distance, the euclidean distance between node bounds is calculated and if a node that is not in the subset has a distance smaller than some threshold, it may be moved. The threshold depends on the specified preferred edge length and minimum node distance of the algorithm. Larger values of these properties increase the threshold.
The actual subset is determined by a boolean value returned by a DataProvider
registered
with key SPHERE_OF_ACTION_NODES
.
public static final byte ONLY_SELECTION
The subset is determined by a boolean value returned by a DataProvider
registered
with key SPHERE_OF_ACTION_NODES
. Nodes not being part of the subset will remain at
their location.
public static final java.lang.Object PREFERRED_EDGE_LENGTH_DATA
DataProvider
key for defining an individual preferred length for each edge
default preferred length
will be used for edges that have
no individual length defined. For those that have, the default preferred length will be ignored.Constructor Detail |
---|
public OrganicLayouter()
OrganicLayouter
with default settings.
Method Detail |
---|
public boolean isMultiThreadingAllowed()
true
if multi-threading is used, false
otherwisesetMultiThreadingAllowed(boolean)
public void setMultiThreadingAllowed(boolean multiThreadingAllowed)
multiThreadingAllowed
- true
if multi-threading should be used, false
otherwisepublic int getRepulsion()
The repulsion influences the forces between nodes. A higher repulsion value can lead to more compact drawings, whereas a lower repulsion value potentially enlarges drawings.
The repulsion is defined to range from 0
to 2
.
[0,2]
setRepulsion(int)
public void setRepulsion(int repulsion)
The repulsion influences the forces between nodes. A higher repulsion value can lead to more compact drawings, whereas a lower repulsion value potentially enlarges drawings.
The repulsion is defined to range from 0
to 2
.
public int getAttraction()
The attraction influences the attractive force associated with edges. A higher attraction value can lead to more compact drawings, whereas a lower value potentially enlarges drawings.
The attraction is defined to range from 0
to 2
.
[0,2]
setAttraction(int)
public void setAttraction(int attraction)
The attraction influences the attractive force associated with edges. A higher attraction value can lead to more compact drawings, whereas a lower value potentially enlarges drawings.
The attraction is defined to range from 0
to 2
.
public GroupBoundsCalculator getGroupBoundsCalculator()
GroupBoundsCalculator
instance used for calculating the size of group nodes.
GroupBoundsCalculator
instancesetGroupBoundsCalculator(GroupBoundsCalculator)
public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
GroupBoundsCalculator
instance used for calculating the size of group nodes.
MinimumSizeGroupBoundsCalculator
groupBoundsCalculator
- the GroupBoundsCalculator
instancepublic double getGroupNodeCompactness()
The compactness ranges from 0
to 1
where 0
results in group nodes not
affecting the overall layout too much while 1
forces nodes in the same group to be clustered tightly.
The compactness values needs to lie within [0,1]
.
setGroupNodeCompactness(double)
public void setGroupNodeCompactness(double groupNodeCompactness)
The compactness ranges from 0
to 1
where 0
results in group nodes not
affecting the overall layout too much while 1
forces nodes in the same group to be clustered tightly.
The compactness values needs to lie within [0,1]
.
groupNodeCompactness
- the compactness value for group nodes
java.lang.IllegalArgumentException
- if compactness value does not lie within the interval [0,1]
Compactness of group nodes is set to 0.2 | Compactness of group nodes is set to 0.6 | Compactness of group nodes is set to 1.0 |
public byte getGroupNodePolicy()
The group policy defines whether this algorithm ignores
groups, leaves them
fixed
or actively arranges
them.
is grouped
.setGroupNodePolicy(byte)
public void setGroupNodePolicy(byte groupNodePolicy)
The group policy defines whether this algorithm ignores
groups, leaves them
fixed
or actively arranges
them.
is grouped
.LAYOUT_GROUPS_POLICY
groupNodePolicy
- one of the predefined group node policies
java.lang.IllegalArgumentException
- if the given policy is unknownpublic double getInitialTemperature()
The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature
decreases and if it reaches a certain limit, the process terminates. This limit can be controlled
using setFinalTemperature(double)
.
The initial temperature will be multiplied by the preferred edge length
and then assigned as the actual initial heat of nodes.
setInitialTemperature(double)
,
setFinalTemperature(double)
public void setInitialTemperature(double initialTemperature)
The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature
decreases and if it reaches a certain limit, the process terminates. This limit can be controlled
using setFinalTemperature(double)
.
The initial temperature will be multiplied by the preferred edge length
and then assigned as the actual initial heat of nodes.
initialTemperature
- the initial temperature valuesetFinalTemperature(double)
public double getFinalTemperature()
The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature decreases.
setFinalTemperature(double)
,
setInitialTemperature(double)
public void setFinalTemperature(double finalTemperature)
The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature decreases.
finalTemperature
- the final temperature valuesetInitialTemperature(double)
public void setActivateDeterministicMode(boolean activate)
In deterministic mode, the layout algorithm will yield the same results if the exact same input and same settings are given as input.
activate
- true
if the layout algorithm should operate in deterministic mode,
false
otherwisepublic boolean getActivateDeterministicMode()
In deterministic mode, the layout algorithm will yield the same results if the exact same input and same settings are given as input.
true
if the layout algorithm operates in deterministic mode,
false
otherwisesetActivateDeterministicMode(boolean)
public void setActivateTreeBeautifier(boolean activate)
Subtrees will be arranged in a balloon-like fashion
.
If this feature is disabled, subgraphs with a tree structure are arranged using the same style as for the rest of the graph.
In case that the input graph is a tree
and this feature
is enabled, the whole graph will be drawn in a tree-like style.
activate
- true
if subtrees should be arranged in an special way,
false
otherwisefalse - nodes belonging to a subtree are highlighted | true - nodes belonging to a subtree are highlighted |
public boolean getActivateTreeBeautifier()
Subtrees will be arranged in a balloon-like fashion
.
If this feature is disabled, subgraphs with a tree structure are arranged using the same style as for the rest of the graph.
In case that the input graph is a tree
and this feature
is enabled, the whole graph will be drawn in a tree-like style.
balloon-like fashion
.true
if subtrees are arranged in an special way,
false
otherwisesetActivateTreeBeautifier(boolean)
public void setGravityFactor(double factor)
public double getGravityFactor()
2.0
.setGravityFactor(double)
public void setSphereOfAction(byte scope)
DataProvider
registered with key SPHERE_OF_ACTION_NODES
.
If this DataProvider
is missing, all nodes will be arranged.ALL
scope
- one of the predefined scopes
java.lang.IllegalArgumentException
- if the given scope is unknownSPHERE_OF_ACTION_NODES
public byte getSphereOfAction()
DataProvider
registered with key SPHERE_OF_ACTION_NODES
.
If this DataProvider
is missing, all nodes will be arranged.setSphereOfAction(byte)
public void setInitialPlacement(byte initialPlacement)
The initial placement has an influence on the final result, because this force-directed algorithm starts with some positions and then uses forces between nodes to finally aim for a stable result drawing.
AS_IS
if the changes to the input layout should be kept minimum and
ZERO
if a neutral start placement should be used.ZERO
initialPlacement
- one of the predefined initial placement modes
java.lang.IllegalArgumentException
- if the given initial placement mode is unknownpublic byte getInitialPlacement()
The initial placement has an influence on the final result, because this force-directed algorithm starts with some positions and then uses forces between nodes to finally aim for a stable result drawing.
AS_IS
if the changes to the input layout should be kept minimum and
ZERO
if a neutral start placement should be used.setInitialPlacement(byte)
public void setMaximumDuration(long maximumDurationMillis)
The duration needs to be non-negative.
maximumDurationMillis
- the non-negative duration in milliseconds
java.lang.IllegalArgumentException
- if the specified duration has a negative valuepublic long getMaximumDuration()
The duration needs to be non-negative.
setMaximumDuration(long)
public void setIterationFactor(double factor)
factor
- the iteration factor influencing the maximum number of allowed iterationspublic double getIterationFactor()
setIterationFactor(double)
public void setPreferredEdgeLength(double edgeLength)
The default preferred edge length will be used for edges that don't have an individual length preference
defined via a DataProvider
registered with key PREFERRED_EDGE_LENGTH_DATA
.
The preferred edge length needs to be non-negative.
public double getPreferredEdgeLength()
The default preferred edge length will be used for edges that don't have an individual length preference
defined via a DataProvider
registered with key PREFERRED_EDGE_LENGTH_DATA
.
The preferred edge length needs to be non-negative.
setPreferredEdgeLength(double)
public void setObeyNodeSize(boolean obey)
If this feature is disabled, overlaps between nodes (e.g. due to large node sizes) may occur.
public boolean getObeyNodeSize()
If this feature is disabled, overlaps between nodes (e.g. due to large node sizes) may occur.
true
if the sizes of nodes are taken into account, false
otherwisesetObeyNodeSize(boolean)
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(LayoutStage)
,
CanonicMultiStageLayouter.setLayoutOrientation(byte)
,
OrientationLayouter
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all inputspublic void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graphpublic void dispose()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |