Search this API

y.layout.hierarchic
Class HierarchicLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.hierarchic.HierarchicLayouter
All Implemented Interfaces:
Layouter, PortConstraintKeys
Direct Known Subclasses:
HierarchicGroupLayouter

public class HierarchicLayouter
extends CanonicMultiStageLayouter
implements PortConstraintKeys

This layout algorithm arranges graphs in a hierarchic/layered fashion.

Note that class IncrementalHierarchicLayouter offers a newer, improved implementation and should be used instead.

Layout Style

The nodes are distributed into layers such that most of the edges point to the main layout direction. The order of the nodes within the layers ensures that the number of edge crossings is as small as possible. There are different edge routing styles available. Edges can be orthogonal or polyline.

Hierarchical diagrams are commonly used for the visualization of hierarchical data, since they facilitate the identification of dependencies and relationships among the nodes of the graph. Possible application domains are the following: workflow visualization, call graph visualization, entity-relationship diagrams, biochemical pathways and network management.


Hierarchic layout obtained with default settings

Concept

The layout algorithm runs in three main phases:

Layering
The nodes are distributed into layers by means of getLayerer(). If the layout orientation is top-to-bottom, the nodes in each layer are arranged horizontally while the layers are ordered vertically top-to-bottom.
Sequencing
The order of the nodes in each layer is determined such that the number of edge crossings is as small as possible. To specify the sequencing algorithm, use setLayerSequencer(LayerSequencer).
Drawing
The layout algorithm assigns the final coordinates to all nodes and routes the edges.

Features

In order to customize this layout algorithm, modify the Layerer, getLayerSequencer(), getDrawer() instances.

HierarchicLayouter supports two approaches to connect edges on a specific side or even an exact location to a node. PortConstraints define a single constraint for the ports of an edge. To realize more complex port restrictions, several PortCandidates or PortCandidateSets can be assigned to edges or nodes. If an edge with registered PortCandidates connects to nodes with PortCandidateSets, the layouter will try to match both collections to find an appropriate port. In case there is no matching port candidate, a PortCandidate specified for the edge is preferred. Since their simultaneous existence at the same node may be ambiguous, it is not recommended to use a combination of PortConstraints and PortCandidates in the same layout.

HierarchicLayouter can consider edge label data when laying out a graph. This means that the layout of edge labels will be part of the resulting layout and the layout of nodes and edges is chosen in such a way that the edge labels do not conflict with the rest of the layout. In order to enable integrated edge labeling of this algorithm, make sure LabelLayoutTranslator is registered and edge labels are being translated and written back after the layout.

Moreover, this algorithm supports layer constraints using a ConstraintLayerer instance.

 

Field Summary
static byte LAYERING_BFS
          A layering strategy based on a breadth first search (BFS).
static byte LAYERING_FROM_SKETCH
          A layering strategy which derives the layers from the initial coordinates of the nodes.
static byte LAYERING_HIERARCHICAL_DOWNSHIFT
          A layering strategy which applies a fast heuristic that improves the layering done by LAYERING_HIERARCHICAL_TOPMOST by shifting some nodes down.
static byte LAYERING_HIERARCHICAL_OPTIMAL
          A layering strategy which places each node in the optimal layer to minimize the layer distances.
static byte LAYERING_HIERARCHICAL_TIGHT_TREE
          A layering strategy which applies a heuristic to approximate the optimal layering.
static byte LAYERING_HIERARCHICAL_TOPMOST
          A layering strategy which places each node in the highest possible layer without passing its predecessor in the topological order of nodes.
static byte LAYERING_STRATEGY_UNKNOWN
          A dummy layering strategy which describes a strategy that is not part of the default strategies.
static byte LAYERING_USER_DEFINED
          A layering strategy which uses a layer assignment specified by the user.
static byte LINEAR_SEGMENTS
          A layout style that draws the edges with at most two bends per edge unless two edges cross.
static byte MEDIAN_SIMPLEX
          A layout style that produces layouts similar to SIMPLEX, but more symmetric for the cost of a few more bends.
static byte PENDULUM
          A layout style that draws the edges such that nodes are balanced nicely and the number of bends on an edge is maintained small.
static byte POLYLINE
          A layout style that draws the edges in a polyline fashion.
static byte ROUTE_ORTHOGONAL
          An edge routing style that draws the edges in an orthogonal fashion, i.e.
static byte ROUTE_POLYLINE
          An edge routing style that draws the edges in a polyline fashion.
static byte SIMPLEX
          A layout style that produces tight layouts with rather few bends.
static byte TREE
          A layout style that produces nice layouts if the graph is a tree.
 
Fields inherited from interface y.layout.PortConstraintKeys
SOURCE_GROUPID_KEY, SOURCE_PORT_CONSTRAINT_KEY, SOURCE_PORT_GROUP_ID_DPKEY, TARGET_GROUPID_KEY, TARGET_PORT_CONSTRAINT_KEY, TARGET_PORT_GROUP_ID_DPKEY
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
HierarchicLayouter()
          Creates a new HierarchicLayouter instance with the default settings.
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          Accepts general graphs without exceptions.
 void disposeMementoSupport()
          Disposes of the memento support if there exists one, i.e., if it has been queried before by getMementoSupport().
 void doLayoutCore(LayoutGraph graph)
          Calculates a hierarchic layout of the given graph.
 int getBendReductionThreshold()
          Returns the limit when bends are removed and a straight-line is drawn instead.
 Drawer getDrawer()
          Returns the Drawer instance responsible for assigning the coordinates to the nodes (third phase of the layout algorithm).
 Layerer getLayerer()
          Returns the Layerer instance responsible for generating the layer assignment (first phase of the layout algorithm).
 byte getLayeringStrategy()
          Returns the layering strategy of this layout algorithm.
protected  NodeList[] getLayerSequence(LayoutGraph graph, NodeMap layerID, int maxLayer)
          Determines the order of the nodes within their layers.
 LayerSequencer getLayerSequencer()
          Returns the LayerSequencer instance responsible for calculating the sequence of nodes within each layer (second phase of the layout algorithm).
 byte getLayoutStyle()
          Returns the layout style of this layout algorithm.
 long getMaximalDuration()
          Returns the time limit (in milliseconds) set for the layout algorithm.
 MementoSupport getMementoSupport()
          Returns the cookie for the memento support of the hierarchic layout algorithm.
 double getMinimalEdgeDistance()
          Returns the minimum distance between two edges in the same layer.
 double getMinimalFirstSegmentLength()
          Returns the minimum length of the first segment of the edge path (at the source node).
 double getMinimalLayerDistance()
          Returns the minimum distance between two layers.
 double getMinimalNodeDistance()
          Specifies the minimum distance between two nodes in the same layer.
 boolean getRemoveFalseCrossings()
          Returns whether or not to remove so-called false crossings in an additional phase.
 byte getRoutingStyle()
          Returns the edge routing style.
 boolean isPortConstraintOptimizationEnabled()
          Returns whether or not the algorithm should try to optimize PortConstraints that are either PortConstraint.ANY_SIDE or null.
 boolean isSameLayerEdgeRoutingOptimizationEnabled()
          Returns whether or not the algorithm should try to optimize the routing of same-layer edges whose PortConstraints don't impose the routing.
 void setBendReductionThreshold(int t)
          Specifies the limit when bends are removed and a straight-line is drawn instead.
 void setDrawer(Drawer drawer)
          Specifies the Drawer instance responsible for assigning the coordinates to the nodes (third phase of the layout algorithm).
 void setLayerer(Layerer layerer)
          Specifies the Layerer instance responsible for generating the layer assignment (first phase of the layout algorithm).
 void setLayeringStrategy(byte strategy)
          Specifies the layering strategy of this layout algorithm.
 void setLayerSequencer(LayerSequencer sequencer)
          Specifies the LayerSequencer instance responsible for calculating the sequence of nodes within each layer (second phase of the layout algorithm).
 void setLayoutStyle(byte style)
          Specifies the layout style of this layout algorithm.
 void setMaximalDuration(long msec)
          Specifies the time limit (in milliseconds) set for the layout algorithm.
 void setMinimalEdgeDistance(double d)
          Specifies the minimum distance between two edges of the same layer.
 void setMinimalFirstSegmentLength(double minimalFirstSegmentLength)
          Specifies the minimum length of the first segment of the edge path (at the source node).
 void setMinimalLayerDistance(double d)
          Specifies the minimum distance between two layers.
 void setMinimalNodeDistance(double d)
          Specifies the minimum distance between two nodes in the same layer.
 void setPortConstraintOptimizationEnabled(boolean enabled)
          Specifies whether or not the algorithm should try to optimize PortConstraints, that are either PortConstraint.ANY_SIDE or null.
 void setRemoveFalseCrossings(boolean b)
          Specifies whether or not to remove so-called false crossings in an additional phase.
 void setRoutingStyle(byte style)
          Specifies the edge routing style.
 void setSameLayerEdgeRoutingOptimizationEnabled(boolean enabled)
          Determines whether or not the algorithm should try to optimize the routing of same-layer edges whose PortConstraints don't impose the routing.
 
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, setOrientationLayouterEnabled, 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

PENDULUM

public static final byte PENDULUM
A layout style that draws the edges such that nodes are balanced nicely and the number of bends on an edge is maintained small.

 
This layout style requires more running-time than most of the other ones.
See Also:
setLayoutStyle(byte), Constant Field Values
Sample Graph:

LINEAR_SEGMENTS

public static final byte LINEAR_SEGMENTS
A layout style that draws the edges with at most two bends per edge unless two edges cross.

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

POLYLINE

public static final byte POLYLINE
A layout style that draws the edges in a polyline fashion.

The resulting layout tends to be compact, but the number of edge bends may be high.

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

TREE

public static final byte TREE
A layout style that produces nice layouts if the graph is a tree.

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

SIMPLEX

public static final byte SIMPLEX
A layout style that produces tight layouts with rather few bends.

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

MEDIAN_SIMPLEX

public static final byte MEDIAN_SIMPLEX
A layout style that produces layouts similar to SIMPLEX, but more symmetric for the cost of a few more bends.

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

ROUTE_POLYLINE

public static final byte ROUTE_POLYLINE
An edge routing style that draws the edges in a polyline fashion.

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

ROUTE_ORTHOGONAL

public static final byte ROUTE_ORTHOGONAL
An edge routing style that draws the edges in an orthogonal fashion, i.e. all edge segments are either vertically or horizontally aligned.

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

LAYERING_HIERARCHICAL_TOPMOST

public static final byte LAYERING_HIERARCHICAL_TOPMOST
A layering strategy which places each node in the highest possible layer without passing its predecessor in the topological order of nodes.

All nodes with indegree zero will be assigned to the topmost layer of the layout. The number of separate layers will be as small as possible.

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

LAYERING_HIERARCHICAL_OPTIMAL

public static final byte LAYERING_HIERARCHICAL_OPTIMAL
A layering strategy which places each node in the optimal layer to minimize the layer distances.

The layer distance of an edge is the absolute difference between the layer numbers of its source and target node. The layer assignment will minimize the overall sum of the layer distances of all edges in the layout.

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

LAYERING_HIERARCHICAL_TIGHT_TREE

public static final byte LAYERING_HIERARCHICAL_TIGHT_TREE
A layering strategy which applies a heuristic to approximate the optimal layering.

The quality of the result may not be as good as with optimal layering but it is usually achieved faster.

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

LAYERING_HIERARCHICAL_DOWNSHIFT

public static final byte LAYERING_HIERARCHICAL_DOWNSHIFT
A layering strategy which applies a fast heuristic that improves the layering done by LAYERING_HIERARCHICAL_TOPMOST by shifting some nodes down.

The quality of the result is usually worse than the one produced by LAYERING_HIERARCHICAL_TOPMOST.

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

LAYERING_BFS

public static final byte LAYERING_BFS
A layering strategy based on a breadth first search (BFS).

All edges will span at most one layer in the resulting drawing. Edges between nodes that belong to the same layer are possible.

The nodes that will be placed in the first layer can be provided by a data provider bound to the input graph using the key BFSLayerer.CORE_NODES. If this data provider is not given, then nodes that have no incoming edges are placed in the first layer.

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

LAYERING_FROM_SKETCH

public static final byte LAYERING_FROM_SKETCH
A layering strategy which derives the layers from the initial coordinates of the nodes.

It tries to find a layering that is similar to the one in the input graph. The layout algorithm may place nodes in the same layer, even though they are connected by an edge.

In a vertically oriented layout, nodes that overlap vertically are placed in the same layer. The same holds for a horizontally oriented layout in the case where the nodes overlap horizontally.

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

Initial graph

Hierarchic layout when the initial drawing is used as sketch

Hierarchic layout when the initial drawing is not used as sketch

LAYERING_USER_DEFINED

public static final byte LAYERING_USER_DEFINED
A layering strategy which uses a layer assignment specified by the user.

The nodes' layer assignment must be provided by a DataProvider bound to the input graph using key GivenLayersLayerer.LAYER_ID_KEY.

This layering strategy allows edges whose source and target share a layer.

See Also:
setLayeringStrategy(byte), Constant Field Values

LAYERING_STRATEGY_UNKNOWN

public static final byte LAYERING_STRATEGY_UNKNOWN
A dummy layering strategy which describes a strategy that is not part of the default strategies.

See Also:
getLayeringStrategy(), Constant Field Values
Constructor Detail

HierarchicLayouter

public HierarchicLayouter()
Creates a new HierarchicLayouter instance with the default settings.

Method Detail

setRoutingStyle

public void setRoutingStyle(byte style)
Specifies the edge routing style.

Default Value:
The default value is ROUTE_POLYLINE. Edges will be routed as polyline segments.
Parameters:
style - one of the predefined edge routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is used

getRoutingStyle

public byte getRoutingStyle()
Returns the edge routing style.

Returns:
one of the predefined edge routing styles
See Also:
setRoutingStyle(byte)

setPortConstraintOptimizationEnabled

public void setPortConstraintOptimizationEnabled(boolean enabled)
Specifies whether or not the algorithm should try to optimize PortConstraints, that are either PortConstraint.ANY_SIDE or null.

Default Value:
The default value is false. PortConstraints are not optimized.
Parameters:
enabled - true if optimization should be performed, false otherwise

isPortConstraintOptimizationEnabled

public boolean isPortConstraintOptimizationEnabled()
Returns whether or not the algorithm should try to optimize PortConstraints that are either PortConstraint.ANY_SIDE or null.

Returns:
true if optimization is performed, false otherwise
See Also:
setPortConstraintOptimizationEnabled(boolean)

setSameLayerEdgeRoutingOptimizationEnabled

public void setSameLayerEdgeRoutingOptimizationEnabled(boolean enabled)
Determines whether or not the algorithm should try to optimize the routing of same-layer edges whose PortConstraints don't impose the routing.

Default Value:
The default value is true. Same-layer edges are not optimized.
Parameters:
enabled - true if optimization should be performed, false otherwise

isSameLayerEdgeRoutingOptimizationEnabled

public boolean isSameLayerEdgeRoutingOptimizationEnabled()
Returns whether or not the algorithm should try to optimize the routing of same-layer edges whose PortConstraints don't impose the routing.

Returns:
true if optimization is performed, false otherwise

setLayoutStyle

public void setLayoutStyle(byte style)
Specifies the layout style of this layout algorithm.

Default Value:
The default value is LINEAR_SEGMENTS. Edges will be drawn with at most two bends per edge.
Parameters:
style - one of the predefined layout styles
Throws:
java.lang.IllegalArgumentException - if an unknown layout style is used

getLayoutStyle

public byte getLayoutStyle()
Returns the layout style of this layout algorithm.

Returns:
one of the predefined layout styles or -1 if the layout style is unknown

setLayeringStrategy

public void setLayeringStrategy(byte strategy)
Specifies the layering strategy of this layout algorithm.

Default Value:
The default value is LAYERING_HIERARCHICAL_TIGHT_TREE
Parameters:
strategy - one of the predefined layering strategies
Throws:
java.lang.IllegalArgumentException - if an unknown strategy is used

getLayeringStrategy

public byte getLayeringStrategy()
Returns the layering strategy of this layout algorithm.

Returns:
one of the predefined layering strategies
See Also:
setLayeringStrategy(byte)

setLayerer

public void setLayerer(Layerer layerer)
Specifies the Layerer instance responsible for generating the layer assignment (first phase of the layout algorithm).

Parameters:
layerer - the given Layerer instance

getLayerer

public Layerer getLayerer()
Returns the Layerer instance responsible for generating the layer assignment (first phase of the layout algorithm).

Returns:
the current Layerer instance
See Also:
setLayerer(Layerer)

setLayerSequencer

public void setLayerSequencer(LayerSequencer sequencer)
Specifies the LayerSequencer instance responsible for calculating the sequence of nodes within each layer (second phase of the layout algorithm).

Parameters:
sequencer - the given LayerSequencer instance

getLayerSequencer

public LayerSequencer getLayerSequencer()
Returns the LayerSequencer instance responsible for calculating the sequence of nodes within each layer (second phase of the layout algorithm).

Returns:
the current LayerSequencer instance
See Also:
setLayerSequencer(LayerSequencer)

setDrawer

public void setDrawer(Drawer drawer)
Specifies the Drawer instance responsible for assigning the coordinates to the nodes (third phase of the layout algorithm).

The Drawer is responsible for the layout style of this layout algorithm.

Parameters:
drawer - the given Drawer instance

getDrawer

public Drawer getDrawer()
Returns the Drawer instance responsible for assigning the coordinates to the nodes (third phase of the layout algorithm).

The Drawer is responsible for the layout style of this layout algorithm.

Returns:
the current Drawer instance
See Also:
setDrawer(Drawer)

setMinimalNodeDistance

public void setMinimalNodeDistance(double d)
Specifies the minimum distance between two nodes in the same layer.

All values have to be greater than or equal to 0.

Default Value:
The default value is 20.0d.
Parameters:
d - the non-negative minimum distance
Throws:
java.lang.IllegalArgumentException - if the distance is negative
Sample Graphs:

Minimum node distance 20

Minimum node distance 100

getMinimalNodeDistance

public double getMinimalNodeDistance()
Specifies the minimum distance between two nodes in the same layer.

All values have to be greater than or equal to 0.

Returns:
the non-negative minimum distance
See Also:
setMinimalNodeDistance(double)

setMinimalEdgeDistance

public void setMinimalEdgeDistance(double d)
Specifies the minimum distance between two edges of the same layer.

Minimum distance must be non-negative.

Default Value:
The default value is 10.0.
Parameters:
d - the minimum distance between two edges
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Edge distance 10

Edge distance 40

getMinimalEdgeDistance

public double getMinimalEdgeDistance()
Returns the minimum distance between two edges in the same layer.

Minimum distance must be non-negative.

Returns:
the minimum distance between two edges
See Also:
setMinimalEdgeDistance(double)

setMinimalLayerDistance

public void setMinimalLayerDistance(double d)
Specifies the minimum distance between two layers.

Minimum distance must be non-negative.

Default Value:
The default value is 40.0.
Parameters:
d - the minimum distance between two edges sharing source/target
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Layer distance 40

Layer distance 100

getMinimalLayerDistance

public double getMinimalLayerDistance()
Returns the minimum distance between two layers.

Minimum distance must be non-negative.

Returns:
the minimum distance between two layers
See Also:
setMinimalLayerDistance(double)

getMinimalFirstSegmentLength

public double getMinimalFirstSegmentLength()
Returns the minimum length of the first segment of the edge path (at the source node).

The minimum length should be greater than or equal to 0.

If the value is 0.0d the first segment does not need to be orthogonal.

Returns:
the minimum length of the first segment
See Also:
setMinimalFirstSegmentLength(double)

setMinimalFirstSegmentLength

public void setMinimalFirstSegmentLength(double minimalFirstSegmentLength)
Specifies the minimum length of the first segment of the edge path (at the source node).

The minimum length should be greater than or equal to 0.

If the value is 0.0d the first segment does not need to be orthogonal.

Default Value:
The default value is 10.0d.
Parameters:
minimalFirstSegmentLength - the minimum length of the first segment
Throws:
java.lang.IllegalArgumentException - if the minimum length of the first segment is negative
Sample Graphs:

Minimum first segment length 10

Minimum first segment length 50

setRemoveFalseCrossings

public void setRemoveFalseCrossings(boolean b)
Specifies whether or not to remove so-called false crossings in an additional phase.

A false crossing is a crossing between two edges that share a common terminal node.

Default Value:
The default value is true. False crossings will be removed.
Parameters:
b - true if false crossings should be removed, false otherwise
Sample Graphs:

false

true

getRemoveFalseCrossings

public boolean getRemoveFalseCrossings()
Returns whether or not to remove so-called false crossings in an additional phase.

A false crossing is a crossing between two edges that share a common terminal node.

Default Value:
The default value is true. False crossings will be removed.
See Also:
setRemoveFalseCrossings(boolean)

setMaximalDuration

public void setMaximalDuration(long msec)
Specifies the time limit (in milliseconds) set for the layout algorithm.

Values have to be greater than or equal to 0.

 
Restricting the maximum duration may result in a lower layout quality. Furthermore, the real runtime may exceed the maximum duration since the layout algorithm still has to find a valid solution.
Default Value:
The default value is Long.MAX_VALUE. The layout algorithm runs unrestricted.
Parameters:
msec - a non-negative value that specifies the time limit
Throws:
java.lang.IllegalArgumentException - if the maximum duration is negative
See Also:
getMaximalDuration()

getMaximalDuration

public long getMaximalDuration()
Returns the time limit (in milliseconds) set for the layout algorithm.

Values have to be greater than or equal to 0.

 
Restricting the maximum duration may result in a lower layout quality. Furthermore, the real runtime may exceed the maximum duration since the layout algorithm still has to find a valid solution.
Returns:
a non-negative value that specifies the time limit
See Also:
setMaximalDuration(long)

setBendReductionThreshold

public void setBendReductionThreshold(int t)
Specifies the limit when bends are removed and a straight-line is drawn instead.

Values should be non-negative.

Default Value:
The default value is 1.
Parameters:
t - the given limit
Throws:
java.lang.IllegalArgumentException - if the threshold is negative
Sample Graphs:

Bend reduction threshold 1

Bend reduction threshold 50

getBendReductionThreshold

public int getBendReductionThreshold()
Returns the limit when bends are removed and a straight-line is drawn instead.

Returns:
the limit when bends are removed and a straight line is drawn instead
See Also:
setBendReductionThreshold(int)

canLayoutCore

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

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

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Calculates a hierarchic layout 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

getLayerSequence

protected NodeList[] getLayerSequence(LayoutGraph graph,
                                      NodeMap layerID,
                                      int maxLayer)
Determines the order of the nodes within their layers.

Parameters:
graph - the input graph
layerID - the NodeMap that returns the zero-based index of the layer to which each node belongs
maxLayer - the number of layers
Returns:
an array of NodeLists containing nodes that belong to the same layer; the order of the nodes within each such list represents the sequence of the nodes within their layer

getMementoSupport

public MementoSupport getMementoSupport()
Returns the cookie for the memento support of the hierarchic layout algorithm.

If there was no memento support registered with this instance before, this call will instantiate the memento support, otherwise the existing instance will be returned.

Returns:
a MementoSupport instance

disposeMementoSupport

public void disposeMementoSupport()
Disposes of the memento support if there exists one, i.e., if it has been queried before by getMementoSupport().


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