Search this API

y.layout.organic
Class OrganicLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.organic.OrganicLayouter
All Implemented Interfaces:
Layouter

public class OrganicLayouter
extends CanonicMultiStageLayouter

A layout algorithm that arranges graphs in an organic fashion, using a force-directed drawing approach.

Layout Style

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

Concept

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.

Features

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 y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setComponentLayouterEnabled, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setParallelEdgeLayouter, setParallelEdgeLayouterEnabled, setSelfLoopLayouter, setSelfLoopLayouterEnabled, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPHERE_OF_ACTION_NODES

public static final java.lang.Object SPHERE_OF_ACTION_NODES
A DataProvider key for marking the nodes that are part of the current scope

 
The specified subset is only considered if the scope of the algorithm is set to ONLY_SELECTION, MAINLY_SELECTION or MAINLY_SELECTION_GEOMETRIC.
See Also:
setSphereOfAction(byte)

FIXED_GROUP_NODES_DPKEY

public static final 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.

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.

See Also:
setGroupNodePolicy(byte), FIXED_GROUPS_POLICY, LAYOUT_GROUPS_POLICY

RANDOM

public static final byte RANDOM
Initial placement strategy for starting with randomly chosen node locations.

See Also:
setInitialPlacement(byte), Constant Field Values

ZERO

public static final byte ZERO
Initial placement strategy for starting with all node location coordinates set to 0.

This strategy is best if the initial placement should be maximally neutral, ignoring the existing layout of the input graph.

See Also:
setInitialPlacement(byte), Constant Field Values

AS_IS

public static final byte AS_IS
Initial placement strategy for starting with the node locations as they are in the input graph.

This strategy is best if the existing layout should change as little as possible.

See Also:
setInitialPlacement(byte), Constant Field Values

LAYOUT_GROUPS_POLICY

public static final byte LAYOUT_GROUPS_POLICY
Group handling policy for considering and arranging the nodes contained in a group such that their togetherness is highlighted.

 
Groups whose content should not be arranged but kept fixed can be marked by registering a DataProvider with key FIXED_GROUP_NODES_DPKEY.
See Also:
setGroupNodePolicy(byte), Constant Field Values
Sample Graphs:

Initial graph

Group policy LAYOUT_GROUPS_POLICY

FIXED_GROUPS_POLICY

public static final byte FIXED_GROUPS_POLICY
Group handling policy for keeping the relative positions of nodes that belong to the same group fixed.

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.

See Also:
setGroupNodePolicy(byte), Constant Field Values
Sample Graphs:

Initial graph

Group policy FIXED_GROUPS_POLICY

IGNORE_GROUPS_POLICY

public static final byte IGNORE_GROUPS_POLICY
Group handling policy for completely ignoring group nodes during the layout process.

See Also:
setGroupNodePolicy(byte), Constant Field Values
Sample Graphs:

Initial graph

Group policy IGNORE_GROUPS_POLICY

ALL

public static final byte ALL
Scope mode indicating that the algorithm should place all nodes of the graph.

See Also:
setSphereOfAction(byte), Constant Field Values
Sample Graphs:

Initial graph

All nodes are placed

MAINLY_SELECTION

public static final 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.

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.

See Also:
setSphereOfAction(byte), SPHERE_OF_ACTION_NODES, Constant Field Values
Sample Graphs:

Initial graph

The subset and structurally close nodes were placed

MAINLY_SELECTION_GEOMETRIC

public static final 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.

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.

See Also:
setSphereOfAction(byte), SPHERE_OF_ACTION_NODES, Constant Field Values
Sample Graphs:

Initial graph

The subset and geometrically close nodes were placed

ONLY_SELECTION

public static final byte ONLY_SELECTION
Scope mode indicating that the algorithm should only place a subset of nodes.

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.

See Also:
setSphereOfAction(byte), SPHERE_OF_ACTION_NODES, Constant Field Values
Sample Graphs:

Initial graph

Only the selected subset was placed

PREFERRED_EDGE_LENGTH_DATA

public static final java.lang.Object PREFERRED_EDGE_LENGTH_DATA
A DataProvider key for defining an individual preferred length for each edge

 
The 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

OrganicLayouter

public OrganicLayouter()
Creates a new OrganicLayouter with default settings.

Method Detail

isMultiThreadingAllowed

public boolean isMultiThreadingAllowed()
Returns whether or not the layout algorithm may use multi-threading to reduce the running time.

Returns:
true if multi-threading is used, false otherwise
See Also:
setMultiThreadingAllowed(boolean)

setMultiThreadingAllowed

public void setMultiThreadingAllowed(boolean multiThreadingAllowed)
Specifies whether or not the layout algorithm may use multi-threading to reduce the running time.

Default Value:
The default value is false. The layout algorithm runs single-threaded.
Parameters:
multiThreadingAllowed - true if multi-threading should be used, false otherwise

getRepulsion

public int getRepulsion()
Returns the node repulsion value.

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.

Returns:
the node repulsion value from the interval [0,2]
See Also:
setRepulsion(int)

setRepulsion

public void setRepulsion(int repulsion)
Sets the node repulsion value.

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.

Default Value:
The default value is 1.
Parameters:
repulsion - the node repulsion value from the interval [0,2]
Throws:
java.lang.IllegalArgumentException - if the repulsion value is negative or greater than 2
Sample Graphs:

Repulsion set to 0

Repulsion set to 2

getAttraction

public int getAttraction()
Returns the edge attraction value.

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.

Returns:
the edge attraction value from the interval [0,2]
See Also:
setAttraction(int)

setAttraction

public void setAttraction(int attraction)
Sets the edge attraction value.

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.

Default Value:
The default value is 1.
Parameters:
attraction - the edge attraction value from the interval [0,2]
Throws:
java.lang.IllegalArgumentException - if the attraction value is negative or greater than 2
Sample Graphs:

Attraction set to 0

Attraction set to 2

getGroupBoundsCalculator

public GroupBoundsCalculator getGroupBoundsCalculator()
Returns the GroupBoundsCalculator instance used for calculating the size of group nodes.

Returns:
the GroupBoundsCalculator instance
See Also:
setGroupBoundsCalculator(GroupBoundsCalculator)

setGroupBoundsCalculator

public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Specifies the GroupBoundsCalculator instance used for calculating the size of group nodes.

Default Value:
The default value is MinimumSizeGroupBoundsCalculator
Parameters:
groupBoundsCalculator - the GroupBoundsCalculator instance

getGroupNodeCompactness

public double getGroupNodeCompactness()
Returns the compactness of group nodes.

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].

Returns:
the compactness value for group nodes
See Also:
setGroupNodeCompactness(double)

setGroupNodeCompactness

public void setGroupNodeCompactness(double groupNodeCompactness)
Specifies the compactness of group nodes.

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].

Default Value:
The default value is 0.2.
Parameters:
groupNodeCompactness - the compactness value for group nodes
Throws:
java.lang.IllegalArgumentException - if compactness value does not lie within the interval [0,1]
Sample Graphs:

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

getGroupNodePolicy

public byte getGroupNodePolicy()
Returns the policy for the handling of group nodes.

The group policy defines whether this algorithm ignores groups, leaves them fixed or actively arranges them.

 
The group node policy will have an effect on the layout only if the input graph is grouped.
Returns:
one of the predefined group node policies
See Also:
setGroupNodePolicy(byte)

setGroupNodePolicy

public void setGroupNodePolicy(byte groupNodePolicy)
Specifies the policy for the handling of group nodes.

The group policy defines whether this algorithm ignores groups, leaves them fixed or actively arranges them.

 
The group node policy will have an effect on the layout only if the input graph is grouped.
Default Value:
The default value is LAYOUT_GROUPS_POLICY
Parameters:
groupNodePolicy - one of the predefined group node policies
Throws:
java.lang.IllegalArgumentException - if the given policy is unknown

getInitialTemperature

public double getInitialTemperature()
Returns the initial temperature for the force-directed layout process.

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.

Returns:
the initial temperature value
See Also:
setInitialTemperature(double), setFinalTemperature(double)

setInitialTemperature

public void setInitialTemperature(double initialTemperature)
Specifies the initial temperature for the force-directed layout process.

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.

Default Value:
The default value is 0.65.
Parameters:
initialTemperature - the initial temperature value
See Also:
setFinalTemperature(double)

getFinalTemperature

public double getFinalTemperature()
Returns the absolute, final temperature value, which will cause the algorithm to stop if the average temperature falls under this value.

The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature decreases.

Returns:
the final temperature value
See Also:
setFinalTemperature(double), setInitialTemperature(double)

setFinalTemperature

public 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.

The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature decreases.

Default Value:
The default value is 1.
Parameters:
finalTemperature - the final temperature value
See Also:
setInitialTemperature(double)

setActivateDeterministicMode

public void setActivateDeterministicMode(boolean activate)
Specifies whether or not the deterministic mode of the layout algorithm is enabled.

In deterministic mode, the layout algorithm will yield the same results if the exact same input and same settings are given as input.

Default Value:
The default value is false. The layout algorithm is non-deterministic.
Parameters:
activate - true if the layout algorithm should operate in deterministic mode, false otherwise

getActivateDeterministicMode

public boolean getActivateDeterministicMode()
Returns whether or not the deterministic mode of the layout algorithm is enabled.

In deterministic mode, the layout algorithm will yield the same results if the exact same input and same settings are given as input.

Returns:
true if the layout algorithm operates in deterministic mode, false otherwise
See Also:
setActivateDeterministicMode(boolean)

setActivateTreeBeautifier

public void setActivateTreeBeautifier(boolean activate)
Specifies whether or not to arrange subtrees of the input graph in a special, optimized tree style.

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.

 
This feature is only supported for graphs without group structure.
Default Value:
The default value is false. Subtrees are not handled differently.
Parameters:
activate - true if subtrees should be arranged in an special way, false otherwise
Sample Graphs:

false - nodes belonging to a subtree are highlighted

true - nodes belonging to a subtree are highlighted

getActivateTreeBeautifier

public boolean getActivateTreeBeautifier()
Returns whether or not to arrange subtrees of the input graph in a special, optimized tree style.

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.

 
Subtrees will be arranged in a balloon-like fashion.
 
This feature is only supported for graphs without group structure.
Returns:
true if subtrees are arranged in an special way, false otherwise
See Also:
setActivateTreeBeautifier(boolean)

setGravityFactor

public void setGravityFactor(double factor)
Specifies the gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph.

 
Although the gravity factor is not restricted to a certain range, it is recommended to only use a range from slightly negative values up to 2.0.
Default Value:
The default value is 0.
Parameters:
factor - the gravity factor
Sample Graphs:

0.0

2.0

getGravityFactor

public double getGravityFactor()
Returns the gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph.

 
Although the gravity factor is not restricted to a certain range, it is recommended to only use a range from slightly negative values up to 2.0.
Returns:
the gravity factor
See Also:
setGravityFactor(double)

setSphereOfAction

public void setSphereOfAction(byte scope)
Specifies the scope that determines which nodes are placed by this algorithm.

 
When using scopes that consider only a subset of the nodes, this subset needs to be marked using a DataProvider registered with key SPHERE_OF_ACTION_NODES. If this DataProvider is missing, all nodes will be arranged.
Default Value:
The default value is ALL
Parameters:
scope - one of the predefined scopes
Throws:
java.lang.IllegalArgumentException - if the given scope is unknown
See Also:
SPHERE_OF_ACTION_NODES

getSphereOfAction

public byte getSphereOfAction()
Returns the scope that determines which nodes are placed by this algorithm.

 
When using scopes that consider only a subset of the nodes, this subset needs to be marked using a DataProvider registered with key SPHERE_OF_ACTION_NODES. If this DataProvider is missing, all nodes will be arranged.
Returns:
one of the predefined scopes
See Also:
setSphereOfAction(byte)

setInitialPlacement

public void setInitialPlacement(byte initialPlacement)
Specifies the strategy for the initial placement of nodes.

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.

 
Choose mode AS_IS if the changes to the input layout should be kept minimum and ZERO if a neutral start placement should be used.
Default Value:
The default value is ZERO
Parameters:
initialPlacement - one of the predefined initial placement modes
Throws:
java.lang.IllegalArgumentException - if the given initial placement mode is unknown

getInitialPlacement

public byte getInitialPlacement()
Returns the strategy for the initial placement of nodes.

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.

 
Choose mode AS_IS if the changes to the input layout should be kept minimum and ZERO if a neutral start placement should be used.
Returns:
one of the predefined initial placement modes
See Also:
setInitialPlacement(byte)

setMaximumDuration

public void setMaximumDuration(long maximumDurationMillis)
Specifies the maximum duration in milliseconds that this layout algorithm is allowed to run.

The duration needs to be non-negative.

 
This is a soft limit. When it is reached, the layout algorithm may take some additional time to finish.
Default Value:
The default value is 30000.
Parameters:
maximumDurationMillis - the non-negative duration in milliseconds
Throws:
java.lang.IllegalArgumentException - if the specified duration has a negative value

getMaximumDuration

public long getMaximumDuration()
Returns the maximum duration in milliseconds that this layout algorithm is allowed to run.

The duration needs to be non-negative.

 
This is a soft limit. When it is reached, the layout algorithm may take some additional time to finish.
Returns:
the non-negative duration in milliseconds
See Also:
setMaximumDuration(long)

setIterationFactor

public void setIterationFactor(double factor)
Specifies the iteration factor which influences the maximum number of optimization iterations the algorithm may perform.

 
Generally, a higher iteration factor means better layout quality and longer running time.
Default Value:
The default value is 3.
Parameters:
factor - the iteration factor influencing the maximum number of allowed iterations

getIterationFactor

public double getIterationFactor()
Returns the iteration factor which influences the maximum number of optimization iterations the algorithm may perform.

 
Generally, a higher iteration factor means better layout quality and longer running time.
Returns:
the iteration factor influencing the maximum number of allowed iterations
See Also:
setIterationFactor(double)

setPreferredEdgeLength

public void setPreferredEdgeLength(double edgeLength)
Specifies the default preferred edge length.

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.

Default Value:
The default value is 80.
Parameters:
edgeLength - the non-negative preferred edge length
Throws:
java.lang.IllegalArgumentException - if the specified edge length is negative
Sample Graphs:

Preferred edge length 40

Preferred edge length 100

getPreferredEdgeLength

public double getPreferredEdgeLength()
Returns the default preferred edge length.

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.

Returns:
the non-negative preferred edge length
See Also:
setPreferredEdgeLength(double)

setObeyNodeSize

public void setObeyNodeSize(boolean obey)
Specifies whether or not to consider node sizes during layout calculation.

If this feature is disabled, overlaps between nodes (e.g. due to large node sizes) may occur.

Default Value:
The default value is true. Node sizes are considered.
Parameters:
obey - true if the sizes of nodes should be taken into account, false otherwise
Sample Graphs:

true

false

getObeyNodeSize

public boolean getObeyNodeSize()
Returns whether or not to consider node sizes during layout calculation.

If this feature is disabled, overlaps between nodes (e.g. due to large node sizes) may occur.

Returns:
true if the sizes of nodes are taken into account, false otherwise
See Also:
setObeyNodeSize(boolean)

setOrientationLayouterEnabled

public void setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated.

Overrides:
setOrientationLayouterEnabled in class CanonicMultiStageLayouter
 
If the current layout orientation is LayoutOrientation.TOP_TO_BOTTOM, the orientation of the layout will not be modified.
 
Based on the undirected layout style, disabling OrientationLayouter has no significant effect.
Default Value:
The default value is true. The orientation LayoutStage is activated.
Parameters:
enabled - true if the stage that modifies the orientation is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isOrientationLayouterEnabled(), CanonicMultiStageLayouter.setOrientationLayouter(LayoutStage), CanonicMultiStageLayouter.setLayoutOrientation(byte), OrientationLayouter

canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
Accepts general graphs without exception.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph
Returns:
true for all inputs

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Calculates an organic arrangement of the given graph.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter
 
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph.
Parameters:
graph - the input graph

dispose

public void dispose()
Frees internal resources which were in use during a previous algorithm run.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.