Search this API

y.layout.organic
Class SmartOrganicLayouter

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

public class SmartOrganicLayouter
extends CanonicMultiStageLayouter

This layout algorithm arranges graphs in an organic fashion.

Layout Style

The organic layout style is characterized by a natural distribution of nodes that exhibits clusters and symmetric properties of the graph. Nodes are placed space-saving, close to their adjacent nodes. Edges maintain uniform lengths and are routed with straight-line segments without bends.

Organic diagrams are commonly used for visualizing relations in large networks for example in bioinformatics, enterprise networking, visualizing social networks, mesh visualization or system management.


Organic Layout obtained with default settings


Organic Layout exhibiting symmetric properties

Concept

SmartOrganicLayouter uses a force-directed approach to place the nodes of the input graph. According to this approach, the graph is modeled as a physical system with appropriate 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 ratio between the layout quality and the running time is conveniently adjustable. Another way to decrease the running time is to execute the layout algorithm multi-threaded.

This layout algorithm is able to consider a PartitionGrid structure. However, for common nodes (i.e. non-group nodes) it only considers single partition cells. Furthermore, the layout algorithm will throw a WrongGraphStructure if there is a partition grid and the descendants of a group node are assigned to different partition grid cells or if there are group nodes that are associated with a group node mode other than GROUP_NODE_MODE_NORMAL.

Although overlaps between edges and nodes are avoided, this layout algorithm doesn't guarantee that they won't appear in the resulting layout. To avoid overlaps, it is possible to route the edges afterwards using an edge routing algorithm, e.g., OrganicEdgeRouter.

The algorithm is also able to detect certain types of substructures in a graph (i.e., chains, stars, cycles and parallel structures) and arrange these structures with special-purpose layout styles. Using substructure styles ensures that the corrsponding structures are easily recognized in the graph.


Organic Layout without applying specific layout styles to substructures


Organic Layout of the same graph applying specific layout styles to the detected substructures

 

Field Summary
static byte CHAIN_SUBSTRUCTURE_STYLE_NONE
          Substructure style specifier for chains that indicates that the algorithm does not handle such structures in a special way.
static byte CHAIN_SUBSTRUCTURE_STYLE_RECTANGULAR
          Substructure style specifier for chains that leads to a compact (rotated) rectangular layout style for chains.
static byte CHAIN_SUBSTRUCTURE_STYLE_STRAIGHT_LINE
          Substructure style specifier for chains that leads to a straight-line layout style for chains.
static byte CYCLE_SUBSTRUCTURE_STYLE_CIRCULAR
          Substructure style specifier for cycle structures that leads to a circular layout style.
static byte CYCLE_SUBSTRUCTURE_STYLE_NONE
          Substructure style specifier for cycle structures that indicates that the algorithm does not handle such structures in a special way.
static java.lang.Object EDGE_DIRECTEDNESS_DPKEY
          A DataProvider key for specifying the directedness of edges.
static java.lang.Object GROUP_NODE_MODE_DATA
          A DataProvider key for assigning individual modes for all group nodes The modes specify how a group's content is handled and if it is resized during layout calculation.
static java.lang.Object GROUP_NODE_MODE_FIX_BOUNDS
          A mode constant for placing the group nodes and their content with respect to the original bounds of the group node.
static java.lang.Object GROUP_NODE_MODE_FIX_CONTENTS
          A mode constant for placing group nodes with fixed content.
static java.lang.Object GROUP_NODE_MODE_NORMAL
          A mode constant for placing and resizing the group nodes and their content by the layout algorithm.
static java.lang.Object NODE_INERTIA_DPKEY
          A DataProvider key for specifying the inertia of nodes.
static java.lang.Object NODE_STRESS_DPKEY
          A DataProvider key for specifying the stress of nodes.
static java.lang.Object NODE_SUBSET_DATA
          A DataProvider key for marking the nodes that are part of the relevant subset
static byte PARALLEL_SUBSTRUCTURE_STYLE_NONE
          Substructure style specifier for parallel structures that indicates that the algorithm does not handle such structures in a special way.
static byte PARALLEL_SUBSTRUCTURE_STYLE_RADIAL
          Substructure style specifier for parallel structures that leads to a radial layout style for the inner nodes.
static byte PARALLEL_SUBSTRUCTURE_STYLE_RECTANGULAR
          Substructure style specifier for parallel structures that leads to a (rotated) rectangular layout style for the inner nodes.
static byte PARALLEL_SUBSTRUCTURE_STYLE_STRAIGHT_LINE
          Substructure style specifier for parallel structures that places the inner nodes on a straight-line.
static java.lang.Object PREFERRED_EDGE_LENGTH_DATA
          A DataProvider key for defining an individual preferred length for each edge
static byte SCOPE_ALL
          Scope mode indicating that the algorithm should place all nodes of the graph.
static byte SCOPE_MAINLY_SUBSET
          Scope mode indicating that the algorithm should mainly place a subset of nodes.
static byte SCOPE_SUBSET
          Scope mode indicating that the algorithm should only place a subset of nodes.
static byte STAR_SUBSTRUCTURE_STYLE_CIRCULAR
          Substructure style specifier for stars that leads to a circular layout style for stars where the root is placed in the middle.
static byte STAR_SUBSTRUCTURE_STYLE_NONE
          Substructure style specifier for stars that indicates that the algorithm does not handle such structures in a special way.
static byte STAR_SUBSTRUCTURE_STYLE_RADIAL
          Substructure style specifier for stars that leads to a radial layout style for stars where the root is placed in the middle.
static byte STAR_SUBSTRUCTURE_STYLE_SEPARATED_RADIAL
          Substructure style specifier for stars that leads to a radial layout style for stars where the root is placed on the outside (separated from the nodes with degree one).
static java.lang.Object Z_COORDINATE_DPKEY
          A DataAcceptor key for publishing the z-coordinate for all non-group nodes in the graph.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
SmartOrganicLayouter()
          Creates a new SmartOrganicLayouter instance with default settings.
 
Method Summary
protected  boolean canLayoutCore(LayoutGraph graph)
          Accepts general graphs without exception.
protected  void configureComponentLayouter(LayoutGraph graph, ComponentLayouter layouter)
          Configures the given ComponentLayouter to take fixed nodes in components into account.
 void doLayout(LayoutGraph graph)
          Calculates an organic arrangement of the graph.
protected  void doLayoutCore(LayoutGraph graph)
          Calculates an organic arrangement of the graph.
 double getAutoClusteringQuality()
          Returns the quality measure of the clustering algorithm.
 byte getChainSubstructureStyle()
          Returns the style specifier for chain substructures.
 double getCompactness()
          Returns the compactness factor for the layout algorithm.
 byte getCycleSubstructureStyle()
          Returns the style specifier for cycle substructures.
 GroupBoundsCalculator getGroupBoundsCalculator()
          Returns the GroupBoundsCalculator instance used for calculating the size of group nodes.
 double getGroupNodeCompactness()
          Specifies the compactness of group nodes.
 long getMaximumDuration()
          Returns the maximum duration in milliseconds that this layout algorithm is allowed to run.
 double getMinimalNodeDistance()
          Returns the minimum node distance that this algorithm should enforce between all pairs of nodes.
 OutputRestriction getOutputRestriction()
          Returns the area restriction for the result of the layout algorithm.
 byte getParallelSubstructureStyle()
          Returns the style specifier for parallel substructures.
 double getPreferredEdgeLength()
          Returns the default preferred edge length.
 double getPreferredMinimalNodeDistance()
          Returns the minimum preferred distance between nodes and edges when node-edge overlaps are not allowed.
 double getQualityTimeRatio()
          Returns the ratio of layout quality versus running time.
 byte getScope()
          Returns the scope that determines which nodes are placed by this algorithm.
 byte getStarSubstructureStyle()
          Returns the style specifier for star substructures.
 boolean is3DEnabled()
          Returns whether or not the layout algorithm should create a 3D result.
 boolean isAutoClusteringEnabled()
          Returns whether or not a clustering algorithm should be applied to the input graph.
 boolean isAutomaticGroupNodeCompactionEnabled()
          Specifies whether or not group nodes are compacted automatically.
 boolean isConsiderNodeLabelsEnabled()
          Returns whether or not to reserve space for node labels during layout calculation.
 boolean isDeterministic()
          Returns whether or not the deterministic mode of this algorithm is enabled.
 boolean isMultiThreadingAllowed()
          Returns whether or not the layout algorithm may use multi-threading to reduce the running time.
 boolean isNodeEdgeOverlapAvoided()
          Returns whether or not the layout algorithm tries to avoid node/edge overlaps.
 boolean isNodeOverlapsAllowed()
          Returns whether or not overlaps between nodes are allowed.
 boolean isNodeSizeAware()
          Returns whether or not to consider node sizes during layout calculation.
 boolean isSmartComponentLayoutEnabled()
          Returns whether or not this instance should configure the ComponentLayouter to respect subsets of nodes.
 void set3DEnabled(boolean enabled)
          Specifies whether or not the layout algorithm should create a 3D result.
 void setAutoClusteringEnabled(boolean autoClusteringEnabled)
          Specifies whether or not a clustering algorithm should be applied to the input graph.
 void setAutoClusteringQuality(double autoClusteringQuality)
          Specifies the quality measure of the clustering algorithm.
 void setAutomaticGroupNodeCompactionEnabled(boolean enabled)
          Specifies whether or not group nodes are compacted automatically.
 void setChainSubstructureStyle(byte chainSubstructureStyle)
          Sets the style specifier for chain substructures.
 void setCompactness(double compactness)
          Specifies the compactness factor for the layout algorithm.
 void setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
          Specifies whether or not to reserve space for node labels during layout calculation.
 void setCycleSubstructureStyle(byte cycleSubstructureStyle)
          Sets the style specifier for cycle substructures.
 void setDeterministic(boolean deterministic)
          Specifies whether or not the deterministic mode of this algorithm is enabled.
 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 setMaximumDuration(long maximumDurationMillis)
          Specifies the maximum duration in milliseconds that this layout algorithm is allowed to run.
 void setMinimalNodeDistance(double minimalNodeDistance)
          Specifies the minimum node distance this algorithm should enforce between all pairs of nodes.
 void setMultiThreadingAllowed(boolean multiThreadingAllowed)
          Specifies whether or not the layout algorithm may use multi-threading to reduce the running time.
 void setNodeEdgeOverlapAvoided(boolean nodeEdgeOverlapAvoided)
          Specifies whether or not the layout algorithm tries to avoid node/edge overlaps.
 void setNodeOverlapsAllowed(boolean nodeOverlapsAllowed)
          Specifies whether or not overlaps between nodes are allowed.
 void setNodeSizeAware(boolean nodeSizeAware)
          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 setOutputRestriction(OutputRestriction restriction)
          Specifies the area restriction for the result of the layout algorithm.
 void setParallelSubstructureStyle(byte parallelSubstructureStyle)
          Sets the style specifier for parallel substructures.
 void setPreferredEdgeLength(double preferredEdgeLength)
          Specifies the default preferred edge length.
 void setPreferredMinimalNodeDistance(double preferredMinimumNodeToEdgeDistance)
          Specifies the minimum preferred distance between nodes and edges when node-edge overlaps are not allowed.
 void setQualityTimeRatio(double qualityTimeRatio)
          Specifies the ratio of layout quality versus running time.
 void setScope(byte scope)
          Sets the scope that determines which nodes are placed by this algorithm.
 void setSmartComponentLayoutEnabled(boolean smartComponentLayoutEnabled)
          Specifies whether or not this instance should configure the ComponentLayouter to respect subsets of nodes.
 void setStarSubstructureStyle(byte starSubstructureStyle)
          Sets the style specifier for star substructures.
protected  void unconfigureComponentLayouter(LayoutGraph graph, ComponentLayouter layouter)
          Disposes of the ComponentLayouter instance.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, 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

EDGE_DIRECTEDNESS_DPKEY

public static final java.lang.Object EDGE_DIRECTEDNESS_DPKEY
A DataProvider key for specifying the directedness of edges.

Generally, the organic layout algorithm doesn't consider the edge direction. Nevertheless, this DataProvider allows the user to specify hints on the directedness of edges. More precisely, a value of 1 indicates that the edge should be considered to be directed from source to target, a value of -1 that it is directed from target to source, and a value of 0 means that it is undirected.

Currently, the specified values are only considered during the detection of special substructures, see setChainSubstructureStyle(byte), setCycleSubstructureStyle(byte), setParallelSubstructureStyle(byte) and setStarSubstructureStyle(byte).

 
If no DataProvider is registered with this key, the algorithm assumes that all edges are undirected.

Z_COORDINATE_DPKEY

public static final java.lang.Object Z_COORDINATE_DPKEY
A DataAcceptor key for publishing the z-coordinate for all non-group nodes in the graph.

For each non-group node, the center z-coordinate will be stored in this DataAcceptor after the layout run. This coordinate is only required if property set3DEnabled(boolean) is enabled. Otherwise, the algorithm produces a 2D result.

 
If no DataProvider is registered with this key, the z-coordinate information of the nodes is dropped.
See Also:
set3DEnabled(boolean)

NODE_INERTIA_DPKEY

public static final java.lang.Object NODE_INERTIA_DPKEY
A DataProvider key for specifying the inertia of nodes.

The inertia can be specified for each non-group node if the scope is set to SCOPE_ALL. It is defined to be a value from the interval [0,1].

 
If this DataProvider is registered and there is at least one node with inertia value greater than 0.0, the algorithm considers the initial coordinates of the nodes (similar as for SCOPE_SUBSET).
 
The inertia values are only considered for non-group nodes and if the scope is set to SCOPE_ALL. Furthermore, the specified inertia is not considered for nodes of sub-structures.
See Also:
NODE_STRESS_DPKEY, setScope(byte)

NODE_STRESS_DPKEY

public static final java.lang.Object NODE_STRESS_DPKEY
A DataProvider key for specifying the stress of nodes.

The stress value indicates how far a node will possibly move. The higher the stress of a node is, the farther it may move.

The stress can be specified for each non-group node if the scope is set to SCOPE_ALL. It is defined to be a value from the interval [0,1].

 
If this DataProvider is registered and there is at least one node with stress value less than 1.0, the algorithm considers the initial coordinates of the nodes (similar as for SCOPE_SUBSET).
 
The stress values are only considered for non-group nodes and if the scope is set to SCOPE_ALL. Furthermore, the specified stress is not considered for nodes of sub-structures.
See Also:
NODE_INERTIA_DPKEY, setScope(byte)

CHAIN_SUBSTRUCTURE_STYLE_NONE

public static final byte CHAIN_SUBSTRUCTURE_STYLE_NONE
Substructure style specifier for chains that indicates that the algorithm does not handle such structures in a special way.

See Also:
setChainSubstructureStyle(byte), Constant Field Values
Sample Graph:

No special handling of the chain (marked nodes)

CHAIN_SUBSTRUCTURE_STYLE_RECTANGULAR

public static final byte CHAIN_SUBSTRUCTURE_STYLE_RECTANGULAR
Substructure style specifier for chains that leads to a compact (rotated) rectangular layout style for chains.

See Also:
setChainSubstructureStyle(byte), Constant Field Values
Sample Graph:

A compact (rotated) rectangular layout style of the chain (marked nodes)

CHAIN_SUBSTRUCTURE_STYLE_STRAIGHT_LINE

public static final byte CHAIN_SUBSTRUCTURE_STYLE_STRAIGHT_LINE
Substructure style specifier for chains that leads to a straight-line layout style for chains.

See Also:
setChainSubstructureStyle(byte), Constant Field Values
Sample Graph:

A straight-line layout style of the chain (marked nodes)

STAR_SUBSTRUCTURE_STYLE_NONE

public static final byte STAR_SUBSTRUCTURE_STYLE_NONE
Substructure style specifier for stars that indicates that the algorithm does not handle such structures in a special way.

See Also:
setStarSubstructureStyle(byte), Constant Field Values
Sample Graph:

No special handling of the star (marked nodes)

STAR_SUBSTRUCTURE_STYLE_RADIAL

public static final byte STAR_SUBSTRUCTURE_STYLE_RADIAL
Substructure style specifier for stars that leads to a radial layout style for stars where the root is placed in the middle.

See Also:
setStarSubstructureStyle(byte), Constant Field Values
Sample Graph:

A radial layout style of the star (marked nodes) where the root is placed in the middle

STAR_SUBSTRUCTURE_STYLE_SEPARATED_RADIAL

public static final byte STAR_SUBSTRUCTURE_STYLE_SEPARATED_RADIAL
Substructure style specifier for stars that leads to a radial layout style for stars where the root is placed on the outside (separated from the nodes with degree one).

 
If the edges are grouped at the root node (see PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY), the algorithm uses a grouped routing style.
See Also:
setStarSubstructureStyle(byte), Constant Field Values
Sample Graphs:

A radial layout style of the star (marked nodes) where the root is placed outside

A radial layout style with edges grouped at the root

STAR_SUBSTRUCTURE_STYLE_CIRCULAR

public static final byte STAR_SUBSTRUCTURE_STYLE_CIRCULAR
Substructure style specifier for stars that leads to a circular layout style for stars where the root is placed in the middle. In contrast to the radial layout style, all nodes (except the root) are placed on a single cycle.

See Also:
setStarSubstructureStyle(byte), Constant Field Values
Sample Graph:

A circular layout style of the star (marked nodes) where the root is placed in the middle

PARALLEL_SUBSTRUCTURE_STYLE_NONE

public static final byte PARALLEL_SUBSTRUCTURE_STYLE_NONE
Substructure style specifier for parallel structures that indicates that the algorithm does not handle such structures in a special way.

See Also:
setParallelSubstructureStyle(byte), Constant Field Values
Sample Graph:

No special handling of the parallel structure

PARALLEL_SUBSTRUCTURE_STYLE_RECTANGULAR

public static final byte PARALLEL_SUBSTRUCTURE_STYLE_RECTANGULAR
Substructure style specifier for parallel structures that leads to a (rotated) rectangular layout style for the inner nodes.

 
If the edges are grouped at the outer nodes (see PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY), the algorithm uses a grouped routing style.
See Also:
setParallelSubstructureStyle(byte), Constant Field Values
Sample Graphs:

A (rotated) rectangular layout style of the inner (marked) nodes of the parallel structure

A (rotated) rectangular layout style with edges grouped at the outer nodes

PARALLEL_SUBSTRUCTURE_STYLE_RADIAL

public static final byte PARALLEL_SUBSTRUCTURE_STYLE_RADIAL
Substructure style specifier for parallel structures that leads to a radial layout style for the inner nodes.

 
If the edges are grouped at the outer nodes (see PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY), the algorithm uses a grouped routing style.
See Also:
setParallelSubstructureStyle(byte), Constant Field Values
Sample Graphs:

A radial layout style of the inner (marked) nodes of the parallel structure

A radial layout style with edges grouped at the outer nodes

PARALLEL_SUBSTRUCTURE_STYLE_STRAIGHT_LINE

public static final byte PARALLEL_SUBSTRUCTURE_STYLE_STRAIGHT_LINE
Substructure style specifier for parallel structures that places the inner nodes on a straight-line.

 
If the edges are grouped at the outer nodes (see PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY), the algorithm uses a grouped routing style.
See Also:
setParallelSubstructureStyle(byte), Constant Field Values
Sample Graphs:

The inner (marked) nodes of the parallel structure are placed on a straight-line

The edges are grouped at the outer nodes

CYCLE_SUBSTRUCTURE_STYLE_NONE

public static final byte CYCLE_SUBSTRUCTURE_STYLE_NONE
Substructure style specifier for cycle structures that indicates that the algorithm does not handle such structures in a special way.

See Also:
setCycleSubstructureStyle(byte), Constant Field Values
Sample Graph:

No special handling of the cycle (marked nodes)

CYCLE_SUBSTRUCTURE_STYLE_CIRCULAR

public static final byte CYCLE_SUBSTRUCTURE_STYLE_CIRCULAR
Substructure style specifier for cycle structures that leads to a circular layout style.

See Also:
setCycleSubstructureStyle(byte), Constant Field Values
Sample Graph:

A circular layout style of the nodes of the cycle (marked nodes)

SCOPE_ALL

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

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

Initial graph

All nodes are placed

SCOPE_SUBSET

public static final byte SCOPE_SUBSET
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 NODE_SUBSET_DATA. Nodes not being part of the subset will remain at their location.

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

Initial graph

Only the selected subset was placed

SCOPE_MAINLY_SUBSET

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

The subset is determined by a boolean value returned by a DataProvider registered with key NODE_SUBSET_DATA. Nodes that don't belong to the subset may be moved to a certain degree but will keep their relative positions to the other nodes outside the subset.

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

Initial graph

Mainly the selected subset was placed

NODE_SUBSET_DATA

public static final java.lang.Object NODE_SUBSET_DATA
A DataProvider key for marking the nodes that are part of the relevant subset

 
The specified subset is only considered if the scope is set to SCOPE_SUBSET or SCOPE_MAINLY_SUBSET.
See Also:
setScope(byte)

GROUP_NODE_MODE_DATA

public static final java.lang.Object GROUP_NODE_MODE_DATA
A DataProvider key for assigning individual modes for all group nodes

The modes specify how a group's content is handled and if it is resized during layout calculation.


GROUP_NODE_MODE_NORMAL

public static final java.lang.Object GROUP_NODE_MODE_NORMAL
A mode constant for placing and resizing the group nodes and their content by the layout algorithm. The size of the group is adjusted to the space that is needed by the placement of its contained nodes.

See Also:
GROUP_NODE_MODE_DATA

GROUP_NODE_MODE_FIX_BOUNDS

public static final java.lang.Object GROUP_NODE_MODE_FIX_BOUNDS
A mode constant for placing the group nodes and their content with respect to the original bounds of the group node. The bounds of the group nodes are treated as fixed and cannot be exceeded by the content of the group nodes.

 
If property setConsiderNodeLabelsEnabled(boolean) is enabled, property setNodeOverlapsAllowed(boolean) is disabled or if there are NodeHalos, the bounds restriction may be violated because the algorithm has to adjust the graph elements such that there are no overlaps.
See Also:
GROUP_NODE_MODE_DATA

GROUP_NODE_MODE_FIX_CONTENTS

public static final java.lang.Object GROUP_NODE_MODE_FIX_CONTENTS
A mode constant for placing group nodes with fixed content. Although these particular group nodes can move like all other ordinary group nodes, their content remains fixed relative to the position of the group node.

 
This implicitly fixes all descendants of the group node.
 
If property setConsiderNodeLabelsEnabled(boolean) is enabled, property setNodeOverlapsAllowed(boolean) is disabled or if there are NodeHalos, the bounds restriction may be violated because the algorithm has to adjust the graph elements such that there are no overlaps.
See Also:
GROUP_NODE_MODE_DATA

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

Constructor Detail

SmartOrganicLayouter

public SmartOrganicLayouter()
Creates a new SmartOrganicLayouter instance with default settings.

Method Detail

is3DEnabled

public boolean is3DEnabled()
Returns whether or not the layout algorithm should create a 3D result.

In order to retrieve the z-coordinates, a DataAcceptor with key Z_COORDINATE_DPKEY must be registered with the input graph.

 
For graphs drawn on a plane, disabling this option produces better results.
Returns:
true if the layout algorithm creates a 3D result, false otherwise
See Also:
set3DEnabled(boolean), Z_COORDINATE_DPKEY

set3DEnabled

public void set3DEnabled(boolean enabled)
Specifies whether or not the layout algorithm should create a 3D result.

In order to retrieve the z-coordinates, a DataAcceptor with key Z_COORDINATE_DPKEY must be registered with the input graph.

 
For graphs drawn on a plane, disabling this option produces better results.
Default Value:
The default value is false. The layout algorithm doesn't produce a 3D result.
Parameters:
enabled - true if the layout algorithm should create a 3D result, false otherwise
See Also:
Z_COORDINATE_DPKEY

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. Multi-threading is disabled.
Parameters:
multiThreadingAllowed - true if multi-threading should be used, false otherwise

getGroupNodeCompactness

public double getGroupNodeCompactness()
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 values need to lie in [0,1].

 
The specified value is only considered if automatic group node compaction is disabled and if there is no PartitionGrid structure.
Returns:
groupNodeCompactness the compactness value for group nodes
See Also:
setGroupNodeCompactness(double), setAutomaticGroupNodeCompactionEnabled(boolean)

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 values need to lie in [0,1].

 
The specified value is only considered if automatic group node compaction is disabled and if there is no PartitionGrid structure.
Default Value:
The default value is 0.4.
Parameters:
groupNodeCompactness - the compactness value for group nodes
Throws:
java.lang.IllegalArgumentException - if specified compactness value is outside the interval [0,1]
See Also:
setAutomaticGroupNodeCompactionEnabled(boolean)
Sample Graphs:

Compactness of group nodes is set to 0.4

Compactness of group nodes is set to 0

Compactness of group nodes is set to 1

isAutomaticGroupNodeCompactionEnabled

public boolean isAutomaticGroupNodeCompactionEnabled()
Specifies whether or not group nodes are compacted automatically.

When enabled, the compactness factor is determined automatically, i.e. it only depends on the general compactness specified by option setCompactness(double).

 
If this option is enabled, the value specified by option setGroupNodeCompactness(double) is ignored.
Returns:
true if automatic group node compaction is enabled, false otherwise
See Also:
setAutomaticGroupNodeCompactionEnabled(boolean), setGroupNodeCompactness(double), setCompactness(double)

setAutomaticGroupNodeCompactionEnabled

public void setAutomaticGroupNodeCompactionEnabled(boolean enabled)
Specifies whether or not group nodes are compacted automatically.

When enabled, the compactness factor is determined automatically, i.e. it only depends on the general compactness specified by option setCompactness(double).

 
If this option is enabled, the value specified by option setGroupNodeCompactness(double) is ignored.
Default Value:
The default value is true. Automatic group node compaction is enabled.
Parameters:
enabled - true if automatic group node compaction should be enabled, false otherwise
See Also:
setGroupNodeCompactness(double), setCompactness(double)

isAutoClusteringEnabled

public boolean isAutoClusteringEnabled()
Returns whether or not a clustering algorithm should be applied to the input graph.

When this option is enabled, the following steps are performed during the layout:

  1. A clustering algorithm is applied to the input graph.
  2. All nodes of the same cluster are put into a newly created group node.
  3. The layout is applied to the modified graph.
  4. Group nodes denoting clusters (inserted during step 2) are removed.
The user can also specify customized clusters by defining appropriate groups.

 
The running time of the clustering algorithm does not depend on the specified maximum duration.
Returns:
true if a clustering algorithm is used, false otherwise
See Also:
setAutoClusteringEnabled(boolean), setMaximumDuration(long)

setAutoClusteringEnabled

public void setAutoClusteringEnabled(boolean autoClusteringEnabled)
Specifies whether or not a clustering algorithm should be applied to the input graph.

When this option is enabled, the following steps are performed during the layout:

  1. A clustering algorithm is applied to the input graph.
  2. All nodes of the same cluster are put into a newly created group node.
  3. The layout is applied to the modified graph.
  4. Group nodes denoting clusters (inserted during step 2) are removed.
The user can also specify customized clusters by defining appropriate groups.

 
The running time of the clustering algorithm does not depend on the specified maximum duration.
Default Value:
The default value is false. Automatic clustering is disabled.
Parameters:
autoClusteringEnabled - true if a clustering algorithm should be used, false otherwise
See Also:
setMaximumDuration(long)

getAutoClusteringQuality

public double getAutoClusteringQuality()
Returns the quality measure of the clustering algorithm.

The higher the value, the higher the clustering quality.

The value needs to lie in [0,1].

 

The expected running time of the clustering algorithm increases with the quality measure. The running time does not depend on the specified maximum duration.

 
The clustering quality only has an effect if automatic clustering is enabled.
Returns:
a value from interval [0,1]
See Also:
setAutoClusteringQuality(double), setAutoClusteringEnabled(boolean), setMaximumDuration(long)

setAutoClusteringQuality

public void setAutoClusteringQuality(double autoClusteringQuality)
Specifies the quality measure of the clustering algorithm.

The higher the value, the higher the clustering quality.

The value needs to lie in [0,1].

 

The expected running time of the clustering algorithm increases with the quality measure. The running time does not depend on the specified maximum duration.

 
The clustering quality only has an effect if automatic clustering is enabled.
Default Value:
The default value is 1.
Parameters:
autoClusteringQuality - a value from the interval [0,1]
Throws:
java.lang.IllegalArgumentException - if the specified quality measure is outside the interval [0,1]
See Also:
setAutoClusteringEnabled(boolean), setMaximumDuration(long)

isConsiderNodeLabelsEnabled

public boolean isConsiderNodeLabelsEnabled()
Returns whether or not to reserve space for node labels during layout calculation.

 
Note that this option only works correctly if the layout orientation is set to LayoutOrientation.TOP_TO_BOTTOM (which is the default). Changing the layout orientation for an undirected layout algorithm like the SmartOrganicLayouter doesn't make sense.
 
Enabling this setting overrides the value of setNodeSizeAware(boolean), i.e. node sizes are always considered.
Returns:
true if the labels of nodes are taken into account, false otherwise
See Also:
setConsiderNodeLabelsEnabled(boolean)

setConsiderNodeLabelsEnabled

public void setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
Specifies whether or not to reserve space for node labels during layout calculation.

 
Note that this option only works correctly if the layout orientation is set to LayoutOrientation.TOP_TO_BOTTOM (which is the default). Changing the layout orientation for an undirected layout algorithm like the SmartOrganicLayouter doesn't make sense.
 
Enabling this setting overrides the value of setNodeSizeAware(boolean), i.e. node sizes are always considered.
Default Value:
The default value is false. Node labels are not considered.
Parameters:
considerNodeLabelsEnabled - true if the labels of nodes should be taken into account, false otherwise
Sample Graphs:

false

true

getGroupBoundsCalculator

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

 
The specified GroupBoundsCalculator is not applied to empty group nodes (i.e. group nodes without children). Such group nodes will not be resized by the algorithm even if that leads to a violation of the minimum group node size specified by GroupingKeys.MINIMUM_NODE_SIZE_DPKEY.
Returns:
the GroupBoundsCalculator instance
See Also:
setGroupBoundsCalculator(GroupBoundsCalculator)

isSmartComponentLayoutEnabled

public boolean isSmartComponentLayoutEnabled()
Returns whether or not this instance should configure the ComponentLayouter to respect subsets of nodes.

When only a subset of nodes is placed by the layout algorithm, the fixed nodes will keep their locations even if they reside in different components.

 
This option is only considered if SCOPE_SUBSET or SCOPE_MAINLY_SUBSET is used.
Returns:
true if ComponentLayouter should be configured for subsets, false otherwise
See Also:
CanonicMultiStageLayouter.setComponentLayouterEnabled(boolean), CanonicMultiStageLayouter.getComponentLayouter(), getScope()

setSmartComponentLayoutEnabled

public void setSmartComponentLayoutEnabled(boolean smartComponentLayoutEnabled)
Specifies whether or not this instance should configure the ComponentLayouter to respect subsets of nodes.

When only a subset of nodes is placed by the layout algorithm, the fixed nodes will keep their locations even if they reside in different components.

 
This option is only considered if SCOPE_SUBSET or SCOPE_MAINLY_SUBSET is used.
Default Value:
The default value is false. Smart component layout is disabled.
Parameters:
smartComponentLayoutEnabled - true if ComponentLayouter should be configured for subsets, false otherwise
See Also:
CanonicMultiStageLayouter.getComponentLayouter(), getScope()

setGroupBoundsCalculator

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

 
The specified GroupBoundsCalculator is not applied to empty group nodes (i.e. group nodes without children). Such group nodes will not be resized by the algorithm even if that leads to a violation of the minimum group node size specified by GroupingKeys.MINIMUM_NODE_SIZE_DPKEY.
Default Value:
The default value is MinimumSizeGroupBoundsCalculator
Parameters:
groupBoundsCalculator - the GroupBoundsCalculator instance
Throws:
java.lang.IllegalArgumentException - if the specified GroupBoundsCalculator is null

isNodeEdgeOverlapAvoided

public boolean isNodeEdgeOverlapAvoided()
Returns whether or not the layout algorithm tries to avoid node/edge overlaps.

 
The current implementation does not guarantee the non-existence of overlaps but tries to avoid them. Furthermore, the post-processing step that removes node overlaps ignores node/edge overlaps, i.e., the number of node/edge overlaps may increase if option setNodeOverlapsAllowed(boolean) is disabled.
Returns:
true if the layout algorithm tries to avoid node/edge overlaps, false otherwise
See Also:
setNodeEdgeOverlapAvoided(boolean), setNodeOverlapsAllowed(boolean)

setNodeEdgeOverlapAvoided

public void setNodeEdgeOverlapAvoided(boolean nodeEdgeOverlapAvoided)
Specifies whether or not the layout algorithm tries to avoid node/edge overlaps.

 
The current implementation does not guarantee the non-existence of overlaps but tries to avoid them. Furthermore, the post-processing step that removes node overlaps ignores node/edge overlaps, i.e., the number of node/edge overlaps may increase if option setNodeOverlapsAllowed(boolean) is disabled.
Default Value:
The default value is false. Overlaps between nodes and edges are not avoided.
Parameters:
nodeEdgeOverlapAvoided - true if the layout algorithm should try to avoid node/edge overlaps, false otherwise
See Also:
setNodeOverlapsAllowed(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(y.layout.LayoutStage), CanonicMultiStageLayouter.setLayoutOrientation(byte), OrientationLayouter

configureComponentLayouter

protected void configureComponentLayouter(LayoutGraph graph,
                                          ComponentLayouter layouter)
Configures the given ComponentLayouter to take fixed nodes in components into account.

Components that contain fixed nodes will not be rearranged.

This method is called by doLayout(LayoutGraph) before the actual layout is calculated. It may be overridden in order to manually configure the ComponentLayouter.

 
Everything that is added to the graph or the ComponentLayouter needs to be removed in unconfigureComponentLayouter(LayoutGraph, ComponentLayouter).
Parameters:
graph - the input graph
layouter - the ComponentLayouter instance to reconfigure
See Also:
setSmartComponentLayoutEnabled(boolean)

doLayout

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

In contrast to doLayoutCore(LayoutGraph), graph and layouter are prepared for an independent layout run.

Specified by:
doLayout in interface Layouter
Overrides:
doLayout 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
See Also:
CanonicMultiStageLayouter.appendStage(LayoutStage), CanonicMultiStageLayouter.prependStage(LayoutStage), CanonicMultiStageLayouter.doLayoutCore(LayoutGraph)

unconfigureComponentLayouter

protected void unconfigureComponentLayouter(LayoutGraph graph,
                                            ComponentLayouter layouter)
Disposes of the ComponentLayouter instance.

This method is called by doLayout(LayoutGraph) after the actual layout is calculated. It may be overridden in order to revert a custom configuration made in configureComponentLayouter(LayoutGraph, ComponentLayouter).

 
Everything that was added to the graph or to the ComponentLayouter in configureComponentLayouter(LayoutGraph, ComponentLayouter) needs to be removed here.
Parameters:
graph - the input graph
layouter - the ComponentLayouter to reset
See Also:
setSmartComponentLayoutEnabled(boolean)

canLayoutCore

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

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph
Returns:
true for all general graphs, false if the given graph is null

doLayoutCore

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

In contrast to doLayout(LayoutGraph), graph and algorithm are not prepared specifically. This method should only be called directly when using SmartOrganicLayouter as a LayoutStage.

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

getQualityTimeRatio

public double getQualityTimeRatio()
Returns the ratio of layout quality versus running time.

The larger the ratio, the better the quality of the resulting layout but the longer it may take to perform the layout calculation.

The value needs to lie within [0,1].

Returns:
a value between 0.0 (low quality, fast) and 1.0 (high quality, slow)
See Also:
setQualityTimeRatio(double)

setQualityTimeRatio

public void setQualityTimeRatio(double qualityTimeRatio)
Specifies the ratio of layout quality versus running time.

The larger the ratio, the better the quality of the resulting layout but the longer it may take to perform the layout calculation.

The value needs to lie within [0,1].

Default Value:
The default value is 0.6.
Parameters:
qualityTimeRatio - a value between 0.0 (low quality, fast) and 1.0 (high quality, slow)
Throws:
java.lang.IllegalArgumentException - if the specified ratio is outside the interval [0,1]

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:
a non-negative duration in milliseconds
See Also:
setMaximumDuration(long)

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 - a non-negative duration in milliseconds
Throws:
java.lang.IllegalArgumentException - if the specified duration has a negative value

getScope

public byte getScope()
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 NODE_SUBSET_DATA. If this DataProvider is missing, all nodes will be arranged.
Returns:
one of the predefined scopes
See Also:
setScope(byte), NODE_SUBSET_DATA

setScope

public void setScope(byte scope)
Sets 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 NODE_SUBSET_DATA. If this DataProvider is missing, all nodes will be arranged.
Default Value:
The default value is SCOPE_ALL
Parameters:
scope - one of the predefined scopes
Throws:
java.lang.IllegalArgumentException - if the given scope is unknown
See Also:
NODE_SUBSET_DATA

getChainSubstructureStyle

public byte getChainSubstructureStyle()
Returns the style specifier for chain substructures.

A chain is a simple edge path where the degree of the nodes is less than or equal to 2.

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the chain must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Returns:
one of the predefined styles for chain substructures
See Also:
setChainSubstructureStyle(byte), setScope(byte), EDGE_DIRECTEDNESS_DPKEY

setChainSubstructureStyle

public void setChainSubstructureStyle(byte chainSubstructureStyle)
Sets the style specifier for chain substructures.

A chain is a simple edge path where the degree of the nodes is less than or equal to 2.

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the chain must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Default Value:
The default value is CHAIN_SUBSTRUCTURE_STYLE_NONE
Parameters:
chainSubstructureStyle - one of the predefined styles for chain substructures
Throws:
java.lang.IllegalArgumentException - if the given style is unknown
See Also:
setScope(byte), EDGE_DIRECTEDNESS_DPKEY

getCycleSubstructureStyle

public byte getCycleSubstructureStyle()
Returns the style specifier for cycle substructures.

A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where the number of edges connecting nodes of the cycle with the remaining nodes is less than or equal to 2.

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the cycle must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Returns:
one of the predefined styles for cycle substructures
See Also:
setCycleSubstructureStyle(byte), setScope(byte), EDGE_DIRECTEDNESS_DPKEY

setCycleSubstructureStyle

public void setCycleSubstructureStyle(byte cycleSubstructureStyle)
Sets the style specifier for cycle substructures.

A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where the number of edges connecting nodes of the cycle with the remaining nodes is less than or equal to 2.

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the cycle must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Default Value:
The default value is CYCLE_SUBSTRUCTURE_STYLE_NONE
Parameters:
cycleSubstructureStyle - one of the predefined styles for cycle substructures
Throws:
java.lang.IllegalArgumentException - if the given style is unknown
See Also:
setScope(byte), EDGE_DIRECTEDNESS_DPKEY

getParallelSubstructureStyle

public byte getParallelSubstructureStyle()
Returns the style specifier for parallel substructures.

A parallel structure consists of a set of nodes (called the inner nodes) such that all nodes have degree two and are connected to the same pair of neighbors (called the outer nodes).

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the parallel structure must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Returns:
one of the predefined styles for parallel substructures
See Also:
setParallelSubstructureStyle(byte), setScope(byte), EDGE_DIRECTEDNESS_DPKEY

setParallelSubstructureStyle

public void setParallelSubstructureStyle(byte parallelSubstructureStyle)
Sets the style specifier for parallel substructures.

A parallel structure consists of a set of nodes (called the inner nodes) such that all nodes have degree two and are connected to the same pair of neighbors (called the outer nodes).

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the parallel structure must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Default Value:
The default value is PARALLEL_SUBSTRUCTURE_STYLE_NONE
Parameters:
parallelSubstructureStyle - one of the predefined styles for parallel substructures
Throws:
java.lang.IllegalArgumentException - if the given style is unknown
See Also:
setScope(byte), EDGE_DIRECTEDNESS_DPKEY

getStarSubstructureStyle

public byte getStarSubstructureStyle()
Returns the style specifier for star substructures.

A star consists of a set of degree one nodes that are all connected to the same node (called the root of the star).

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY, all edges of the star must have the same direction.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Returns:
one of the predefined styles for star substructures
See Also:
setStarSubstructureStyle(byte), setScope(byte), EDGE_DIRECTEDNESS_DPKEY

setStarSubstructureStyle

public void setStarSubstructureStyle(byte starSubstructureStyle)
Sets the style specifier for star substructures.

A star consists of a set of degree one nodes that are all connected to the same node (called the root of the star).

 
If a DataProvider is registered with key EDGE_DIRECTEDNESS_DPKEY and the style is set to STAR_SUBSTRUCTURE_STYLE_SEPARATED_RADIAL, all edges of the star must have the same direction. Otherwise, the edge directedness is ignored.
 
If the algorithm only considers a subset of nodes, only these nodes may be contained in a substructure.
Default Value:
The default value is STAR_SUBSTRUCTURE_STYLE_NONE
Parameters:
starSubstructureStyle - one of the predefined styles for star substructures
Throws:
java.lang.IllegalArgumentException - if the given style is unknown
See Also:
setScope(byte), EDGE_DIRECTEDNESS_DPKEY

getCompactness

public double getCompactness()
Returns the compactness factor for the layout algorithm.

Smaller values result in less compact drawings, greater values result in more compact drawings.

The compactness value needs to lie in [0,1].

Returns:
the compactness value in [0,1]
See Also:
setCompactness(double)

setCompactness

public void setCompactness(double compactness)
Specifies the compactness factor for the layout algorithm.

Smaller values result in less compact drawings, greater values result in more compact drawings.

The compactness value needs to lie in [0,1].

Default Value:
The default value is 0.5.
Parameters:
compactness - the compactness value in [0,1]
Throws:
java.lang.IllegalArgumentException - if the specified value is outside the interval [0,1]
Sample Graphs:

Compactness is set to 0

Compactness is set to 1

getPreferredEdgeLength

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

If there is no specific preferred edge length assigned to an edge, this default preferred edge length is used.

The preferred edge length needs to be non-negative.

 
If the option setNodeOverlapsAllowed(boolean) is disabled, the preferred edge length may be violated because then the nodes are moved in a post-processing step to resolve overlaps.
Returns:
a non-negative edge length
See Also:
setPreferredEdgeLength(double), PREFERRED_EDGE_LENGTH_DATA

setPreferredEdgeLength

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

If there is no specific preferred edge length assigned to an edge, the default preferred edge length is used.

The preferred edge length needs to be non-negative.

 
If the option setNodeOverlapsAllowed(boolean) is disabled, the preferred edge length may be violated because then the nodes are moved in a post-processing step to resolve overlaps.
Default Value:
The default value is 40.
Parameters:
preferredEdgeLength - a non-negative edge length
Throws:
java.lang.IllegalArgumentException - if the specified edge length is negative
See Also:
PREFERRED_EDGE_LENGTH_DATA
Sample Graphs:

Preferred edge length 40

Preferred edge length 100

getPreferredMinimalNodeDistance

public double getPreferredMinimalNodeDistance()
Returns the minimum preferred distance between nodes and edges when node-edge overlaps are not allowed.

The minimum preferred distance needs to be non-negative.

 
The algorithm doesn't guarantee that the specified minimum value is always maintained.
 
This value has an effect only if node-edge overlaps are not allowed.
Returns:
a non-negative minimum preferred distance
See Also:
setPreferredMinimalNodeDistance(double)

setPreferredMinimalNodeDistance

public void setPreferredMinimalNodeDistance(double preferredMinimumNodeToEdgeDistance)
Specifies the minimum preferred distance between nodes and edges when node-edge overlaps are not allowed.

The minimum preferred distance needs to be non-negative.

 
The algorithm doesn't guarantee that the specified minimum value is always maintained.
 
This value has an effect only if node-edge overlaps are not allowed.
Default Value:
The default value is 40.
Parameters:
preferredMinimumNodeToEdgeDistance - a non-negative minimum distance
Throws:
java.lang.IllegalArgumentException - if the specified distance is negative

isNodeSizeAware

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

If this option is enabled, the circumcircles of the nodes are used. If it is disabled, points will be used instead.

 
This option doesn't affect the minimum node distance property.
Returns:
true if the sizes of nodes are considered, false otherwise
See Also:
setNodeSizeAware(boolean)

setNodeSizeAware

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

If this option is enabled, the circumcircles of the nodes are used. If it is disabled, points will be used instead.

 
This option doesn't affect the minimum node distance property.
Default Value:
The default value is false. Points will be used for modeling the nodes.
Parameters:
nodeSizeAware - true if the sizes of nodes should be considered, false otherwise
Sample Graphs:

false

true

isDeterministic

public boolean isDeterministic()
Returns whether or not the deterministic mode of this 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 this algorithm works deterministically, false otherwise
See Also:
setDeterministic(boolean)

setDeterministic

public void setDeterministic(boolean deterministic)
Specifies whether or not the deterministic mode of this 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:
deterministic - true if this algorithm should work deterministically, false otherwise

getMinimalNodeDistance

public double getMinimalNodeDistance()
Returns the minimum node distance that this algorithm should enforce between all pairs of nodes.

 
If node overlaps are allowed, the specified minimum node distance will be ignored.
Returns:
a non-negative minimum distance between nodes
See Also:
setMinimalNodeDistance(double), setNodeOverlapsAllowed(boolean)

setMinimalNodeDistance

public void setMinimalNodeDistance(double minimalNodeDistance)
Specifies the minimum node distance this algorithm should enforce between all pairs of nodes.

The minimum node distance needs to be non-negative.

 
If node overlaps are allowed, the specified minimum node distance will be ignored.
Default Value:
The default value is 0.
Parameters:
minimalNodeDistance - a non-negative minimum distance between nodes
Throws:
java.lang.IllegalArgumentException - if the specified minimum node distance is negative
See Also:
setNodeOverlapsAllowed(boolean)
Sample Graphs:

Preferred minimum node distance 40

Preferred minimum node distance 100

isNodeOverlapsAllowed

public boolean isNodeOverlapsAllowed()
Returns whether or not overlaps between nodes are allowed.

 
When disabled, a post-processing step is added that resolves node overlaps considering the specified minimum node distance. This procedure may affect other options like output restrictions and edge distances.
 
If only a subset of nodes is considered in the layout algorithm, there might be some overlapping nodes even if this option is disabled.
Returns:
true if node overlaps are allowed, false otherwise
See Also:
setNodeOverlapsAllowed(boolean), setMinimalNodeDistance(double), setScope(byte)

setNodeOverlapsAllowed

public void setNodeOverlapsAllowed(boolean nodeOverlapsAllowed)
Specifies whether or not overlaps between nodes are allowed.

 
When disabled, a post-processing step is added that resolves node overlaps considering the specified minimum node distance. This procedure may affect other options like output restrictions and edge distances.
 
If only a subset of nodes is considered in the layout algorithm, there might be some overlapping nodes even if this option is disabled.
Default Value:
The default value is false. Node overlaps are not allowed.
Parameters:
nodeOverlapsAllowed - true if node overlaps are allowed, false otherwise
See Also:
setMinimalNodeDistance(double), setScope(byte)
Sample Graphs:

false

true

setOutputRestriction

public void setOutputRestriction(OutputRestriction restriction)
Specifies the area restriction for the result of the layout algorithm.

 
If option setNodeOverlapsAllowed(boolean) is disabled, the restriction area might be violated when node overlaps get resolved in a post-processing step.
Default Value:
The default value is OutputRestriction.NONE
Parameters:
restriction - the OutputRestriction instance
See Also:
getOutputRestriction()
Sample Graphs:

No restriction

Circular restriction

Elliptical restriction

Rectangular restriction

getOutputRestriction

public OutputRestriction getOutputRestriction()
Returns the area restriction for the result of the layout algorithm.

 
If option setNodeOverlapsAllowed(boolean) is disabled, the restriction area might be violated when node overlaps get resolved in a post-processing step.
Returns:
the OutputRestriction
See Also:
setOutputRestriction(OutputRestriction)

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