Search this API

y.layout.seriesparallel
Class SeriesParallelLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.seriesparallel.SeriesParallelLayouter
All Implemented Interfaces:
Layouter

public class SeriesParallelLayouter
extends CanonicMultiStageLayouter

This layout algorithm arranges series-parallel graphs.

Layout Style

Series-parallel graphs are directed graphs with a single source (node without incoming edges) and a single sink (node without outgoing edges). The layout algorithm highlights the main layout direction (from source to sink). It also emphasizes the paths through the graph because edges are routed with few bends.

SeriesParallelLayouter is suitable for the visualization of circuits, call trees or flowcharts.

Concept

Series-parallel graphs are directed graphs with a single source (node without incoming edges) and a single sink (node without outgoing edges) that are built using only the following two rules:

  1. Series composition: The source of a subgraph is merged with the sink of a second subgraph.
  2. Parallel composition: The sources and sinks of two subgraphs are merged.

From the recursive structure of series-parallel graphs, the layout algorithm retrieves a decomposition tree where each node represents one of the decomposition types. Then, this tree is traversed recursively from bottom to top, aligning subgraphs above (series) or next to (parallel) each other until the whole graph is arranged. The edges are routed when both end nodes are placed. Different routing styles can be used.

To avoid moving all nodes several times and to be aware of the area that the subtrees occupy, the layout algorithm keeps track of the shape of the subtrees. These shapes are moved and merged during the layout calculation. The layout algorithm also stores the connections between nodes and nodes that haven't already been placed in these shapes.

Features

SeriesParallelLayouter can take strong PortConstraints into account. It will connect the edges to the specified locations, the directions, however, will be ignored.

Grouping of nodes can also be handled by this layout algorithm. It is important that a group node contains a whole series-parallel subgraph. Otherwise, the group nodes may overlap with each other or with other nodes. Edges which are connected to non-empty group nodes are not allowed. Furthermore, the user may specify minimum size constraints for each group node using DataProvider key GroupingKeys.MINIMUM_NODE_SIZE_DPKEY.

The layout algorithm can be configured to reserve space for node labels and to place the edge labels along the edge such that the labels won't overlap with other graph elements. Edge labels are placed according to the information stored in a PreferredPlacementDescriptor instance. However, labels that should be centered between source and target are placed close to the target node, unless this edge connects to the local source and sink of a subgraph.

Parallel subgraphs can be aligned in different ways. Depending on the node sizes, a different alignment can increase the compactness of the layout.

The way in which edges are distributed around their incident nodes is computed by an instance of PortAssignment. The default assignment is able to consider PortConstraints and edge groups.

The From Sketch mode allows to take the initial locations of the nodes into account. However, the layout algorithm won't insert crossings because it maintains the order of children of each node.

SeriesParallelLayouter supports custom sorting of the outgoing edges of a node. A Comparator can be assigned individually for the nodes using a DataProvider registered with key OUT_EDGE_COMPARATOR_DPKEY. For all nodes for which the DataProvider returns null, the layout algorithm falls back to the default comparator.

By default, this layout algorithm can only handle graphs with a series-parallel structure. To apply it to a general graph, general graph handling needs to be activated. Then, the layout algorithm will temporarily add and/or remove some edges from the input graph until a series-parallel graph is obtained. The edges that were removed will be routed separately afterwards.

 

Field Summary
static java.lang.String EDGE_LAYOUT_DESCRIPTOR_DPKEY
          A DataProvider key for storing individual settings for edges If no edge layout descriptor is mapped for an edge, a default edge layout descriptor will be obtained by method getDefaultEdgeLayoutDescriptor().
static java.lang.Object NON_SERIES_PARALLEL_EDGE_LABELS_DPKEY
          A DataProvider key for marking edge labels of non-series-parallel edges
static java.lang.Object OUT_EDGE_COMPARATOR_DPKEY
          A DataProvider key for assigning different orderings for outgoing edges of the nodes If the Comparator associated with a node is null, the outgoing edges maintain their initial order.
static java.lang.Object PORT_ASSIGNMENT_DPKEY
          A DataProvider key for providing an individual port distribution at nodes If there is no PortAssignment specified for a node, the layout algorithm uses the default assignment.
static byte ROUTING_STYLE_OCTILINEAR
          Style constant describing an octilinear edge style.
static byte ROUTING_STYLE_ORTHOGONAL
          Style constant describing an orthogonal edge style.
static byte ROUTING_STYLE_POLYLINE
          Style constant describing a polyline edge style.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
SeriesParallelLayouter()
          Creates a new SeriesParallelLayouter instance with default settings.
 
Method Summary
protected  boolean canLayoutCore(LayoutGraph graph)
          Checks whether or not the given graph is series-parallel and can be arranged by this layout algorithm.
protected  void doLayoutCore(LayoutGraph graph)
          Calculates a series-parallel layout for the given graph.
 EdgeLayoutDescriptor getDefaultEdgeLayoutDescriptor()
          Returns the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned.
 java.util.Comparator getDefaultOutEdgeComparator()
          Returns the default Comparator used for sorting the outgoing edges incident to nodes that do not have a specific Comparator.
 PortAssignment getDefaultPortAssignment()
          Returns the default PortAssignment used for those nodes that do not have their own specific instance.
 double getMinimumEdgeToEdgeDistance()
          Returns the minimum distance between edges.
 double getMinimumNodeToEdgeDistance()
          Returns the minimum distance between nodes and edges.
 double getMinimumNodeToNodeDistance()
          Returns the minimum distance between nodes.
 double getMinimumPolylineSegmentLength()
          Returns the minimum vertical distance of the edge segments that are not orthogonal.
 double getMinimumSlope()
          Returns the minimum slope which a non-orthogonal edge segment should have.
 Layouter getNonSeriesParallelEdgeLabelingAlgorithm()
          Returns the labeling algorithm that is applied to all edge labels that belong to non-series-parallel edges.
 java.lang.Object getNonSeriesParallelEdgeLabelSelectionKey()
          Returns the key to register a DataProvider that is used by the non-series-parallel edge labeling algorithm to determine which edge labels it should place.
 Layouter getNonSeriesParallelEdgeRouter()
          Returns the edge routing algorithm used for the edges of a general graph that are not part of the series-parallel subgraph whose layout is calculated.
 java.lang.Object getNonSeriesParallelEdgesDpKey()
          Returns the key to register a DataProvider that is used for marking non-series-parallel edges.
 double getPreferredOctilinearSegmentLength()
          Returns the preferred length for non-orthogonal segments in octilinear edge routes.
 byte getRoutingStyle()
          Returns the currently used routing style for edges.
 double getVerticalAlignment()
          Returns the vertical alignment of parallel subgraphs.
 boolean isConsiderNodeLabelsEnabled()
          Returns whether or not the layout algorithm reserves space for node labels to avoid overlaps.
 boolean isFromSketchModeEnabled()
          Returns whether or not to take the coordinates of the input diagram into account when arranging the nodes.
 boolean isGeneralGraphHandlingEnabled()
          Returns whether or not the layout algorithm can handle general graphs.
 boolean isIntegratedEdgeLabelingEnabled()
          Returns whether or not the layout algorithm will place edge labels and reserve space for them.
static boolean isSeriesParallelGraph(Graph graph)
          Determines whether or not the given graph has a series-parallel structure.
 void setComponentLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.
 void setConsiderNodeLabelsEnabled(boolean enabled)
          Specifies whether or not the layout algorithm reserves space for node labels to avoid overlaps.
 void setDefaultEdgeLayoutDescriptor(EdgeLayoutDescriptor descriptor)
          Specifies the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned.
 void setDefaultOutEdgeComparator(java.util.Comparator defaultOutEdgeComparator)
          Specifies the default Comparator used for sorting the outgoing edges incident to nodes that do not have a specific Comparator.
 void setDefaultPortAssignment(PortAssignment defaultPortAssignment)
          Specifies the default PortAssignment used for those nodes that do not have their own specific instance.
 void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
          Specifies whether or not to take the coordinates of the input diagram into account when arranging the nodes.
 void setGeneralGraphHandlingEnabled(boolean enabled)
          Specifies whether or not the layout algorithm can handle general graphs.
 void setIntegratedEdgeLabelingEnabled(boolean enabled)
          Specifies whether or not the layout algorithm will place edge labels and reserve space for them.
 void setMinimumEdgeToEdgeDistance(double minimumEdgeToEdgeDistance)
          Specifies the minimum distance between edges.
 void setMinimumNodeToEdgeDistance(double minimumNodeToEdgeDistance)
          Specifies the minimum distance between nodes and edges.
 void setMinimumNodeToNodeDistance(double minimumNodeToNodeDistance)
          Specifies the minimum distance between nodes.
 void setMinimumPolylineSegmentLength(double minimumPolylineSegmentLength)
          Specifies the minimum vertical distance of the edge segments that are not orthogonal.
 void setMinimumSlope(double minimumSlope)
          Specifies the minimum slope which a non-orthogonal edge segment should have.
 void setNonSeriesParallelEdgeLabelingAlgorithm(Layouter nonSeriesParallelEdgeLabelingAlgorithm)
          Specifies the labeling algorithm that is applied to all edge labels that belong to non-series-parallel edges.
 void setNonSeriesParallelEdgeLabelSelectionKey(java.lang.Object nonSeriesParallelEdgeLabelSelectionKey)
          Specifies the key to register a DataProvider that is used by the non-series-parallel edge labeling algorithm to determine which edg e labels it should place.
 void setNonSeriesParallelEdgeRouter(Layouter nonSeriesParallelEdgeRouter)
          Specifies the edge routing algorithm used for the edges of a general graph that are not part of the series-parallel subgraph whose layout is calculated.
 void setNonSeriesParallelEdgesDpKey(java.lang.Object nonSeriesParallelSelectionKey)
          Specifies the key to register a DataProvider that is used for marking non-series-parallel edges.
 void setPreferredOctilinearSegmentLength(double preferredOctilinearSegmentLength)
          Specifies the preferred length for non-orthogonal segments in octilinear edge routes.
 void setRoutingStyle(byte routingStyle)
          Specifies the currently used routing style for edges.
 void setSelfLoopLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing self-loops is activated.
 void setVerticalAlignment(double verticalAlignment)
          Specifies the vertical alignment of parallel subgraphs.
 
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, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setParallelEdgeLayouterEnabled, setSelfLoopLayouter, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_LAYOUT_DESCRIPTOR_DPKEY

public static final java.lang.String EDGE_LAYOUT_DESCRIPTOR_DPKEY
A DataProvider key for storing individual settings for edges

If no edge layout descriptor is mapped for an edge, a default edge layout descriptor will be obtained by method getDefaultEdgeLayoutDescriptor().

See Also:
getDefaultEdgeLayoutDescriptor(), Constant Field Values

OUT_EDGE_COMPARATOR_DPKEY

public static final java.lang.Object OUT_EDGE_COMPARATOR_DPKEY
A DataProvider key for assigning different orderings for outgoing edges of the nodes If the Comparator associated with a node is null, the outgoing edges maintain their initial order.

 
For general graphs, the Comparators are only used for the series-parallel part of the graph. Non-series-parallel edges are not included and will be routed by the edge router for non-series-parallel edges.
 
The order cannot be maintained in all cases because the target nodes may not be completely independent.
See Also:
getDefaultOutEdgeComparator()

PORT_ASSIGNMENT_DPKEY

public static final java.lang.Object PORT_ASSIGNMENT_DPKEY
A DataProvider key for providing an individual port distribution at nodes If there is no PortAssignment specified for a node, the layout algorithm uses the default assignment.

See Also:
getDefaultPortAssignment()

NON_SERIES_PARALLEL_EDGE_LABELS_DPKEY

public static final java.lang.Object NON_SERIES_PARALLEL_EDGE_LABELS_DPKEY
A DataProvider key for marking edge labels of non-series-parallel edges

 
This key only serves as default value for property setNonSeriesParallelEdgeLabelSelectionKey(Object). During the layout, a DataProvider marking the non-series-parallel edges will automatically be registered with the graph. Thus, data provided by the user registered with this specific key is ignored.
See Also:
setNonSeriesParallelEdgeLabelSelectionKey(Object), setNonSeriesParallelEdgeLabelingAlgorithm(Layouter)

ROUTING_STYLE_ORTHOGONAL

public static final byte ROUTING_STYLE_ORTHOGONAL
Style constant describing an orthogonal edge style. If this style is used, edges will contain only horizontal and vertical segments.

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

ROUTING_STYLE_OCTILINEAR

public static final byte ROUTING_STYLE_OCTILINEAR
Style constant describing an octilinear edge style. If this style is used, edges will contain horizontal, vertical and 45-degree sloped segments.

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

ROUTING_STYLE_POLYLINE

public static final byte ROUTING_STYLE_POLYLINE
Style constant describing a polyline edge style. If this style is used, edges will contain vertical and other sloped segments.

 
If this routing style is set and the fork style is set to DefaultPortAssignment.FORK_STYLE_AT_NODE, the integrated edge labeling may place labels far away from the associated edges.
See Also:
setRoutingStyle(byte), Constant Field Values
Sample Graph:
Constructor Detail

SeriesParallelLayouter

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

Method Detail

canLayoutCore

protected boolean canLayoutCore(LayoutGraph graph)
Checks whether or not the given graph is series-parallel and can be arranged by this layout algorithm.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph
Returns:
true if the given graph is series-parallel, false otherwise

doLayoutCore

protected void doLayoutCore(LayoutGraph graph)
Calculates a series-parallel layout for the given graph.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph
Throws:
WrongGraphStructure - if the graph is not series-parallel

isSeriesParallelGraph

public static boolean isSeriesParallelGraph(Graph graph)
Determines whether or not the given graph has a series-parallel structure.

The current implementation detects the series-parallel graph structure in linear time.

Parameters:
graph - the input graph
Returns:
true if the given graph is series-parallel, false otherwise

isConsiderNodeLabelsEnabled

public boolean isConsiderNodeLabelsEnabled()
Returns whether or not the layout algorithm reserves space for node labels to avoid overlaps.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if node labels are considered, false otherwise
See Also:
setConsiderNodeLabelsEnabled(boolean)

setConsiderNodeLabelsEnabled

public void setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not the layout algorithm reserves space for node labels to avoid overlaps.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Node labels are not considered.
Parameters:
enabled - true if node labels should be considered, false otherwise
Sample Graphs:

false

true

isIntegratedEdgeLabelingEnabled

public boolean isIntegratedEdgeLabelingEnabled()
Returns whether or not the layout algorithm will place edge labels and reserve space for them.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if edge labels should be placed, false otherwise
See Also:
setIntegratedEdgeLabelingEnabled(boolean)

setIntegratedEdgeLabelingEnabled

public void setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not the layout algorithm will place edge labels and reserve space for them.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Integrated edge labeling is disabled.
Parameters:
enabled - true if edge labels should be placed, false otherwise
Sample Graphs:

false

true

getVerticalAlignment

public double getVerticalAlignment()
Returns the vertical alignment of parallel subgraphs. The alignment is defined by a ratio:

 
In grouped graphs, the vertical alignment only applies to parallel subgraphs that belong to the same group.
 
Values outside interval [0,1] will be matched with the nearest interval end.
Returns:
the vertical alignment ratio from interval [0,1]
See Also:
setVerticalAlignment(double)

setVerticalAlignment

public void setVerticalAlignment(double verticalAlignment)
Specifies the vertical alignment of parallel subgraphs. The alignment is defined by a ratio:

 
In grouped graphs, the vertical alignment only applies to parallel subgraphs that belong to the same group.
 
Values outside interval [0,1] will be matched with the nearest interval end.
Default Value:
The default value is 0.5. Subgraphs are center aligned.
Parameters:
verticalAlignment - the vertical alignment ratio from interval [0,1]
Sample Graphs:

Top vertical alignment (0)

Centered vertical alignment (0.5)

Bottom vertical alignment (1)

setGeneralGraphHandlingEnabled

public void setGeneralGraphHandlingEnabled(boolean enabled)
Specifies whether or not the layout algorithm can handle general graphs.

General graphs are required to be transformed before being laid out (by adding or removing some edges) such that they satisfy the criteria of a series-parallel graph. After the layout, the graph will be restored and the initial edges which weren't included in the series-parallel graph are routed by a separate edge routing algorithm. Furthermore, the labels of these edges are placed by a customizable edge labeling algorithm.

Default Value:
The default value is false. Only series-parallel graphs are handled.
Parameters:
enabled - true if general graphs should be handled, false otherwise

isGeneralGraphHandlingEnabled

public boolean isGeneralGraphHandlingEnabled()
Returns whether or not the layout algorithm can handle general graphs.

General graphs are required to be transformed before being laid out (by adding or removing some edges) such that they satisfy the criteria of a series-parallel graph. After the layout, the graph will be restored and the initial edges which weren't included in the series-parallel graph are routed by a separate edge routing algorithm. Furthermore, the labels of these edges are placed by a customizable edge labeling algorithm.

Returns:
true if general graphs should be handled, false otherwise
See Also:
setGeneralGraphHandlingEnabled(boolean)

getNonSeriesParallelEdgeRouter

public Layouter getNonSeriesParallelEdgeRouter()
Returns the edge routing algorithm used for the edges of a general graph that are not part of the series-parallel subgraph whose layout is calculated.

 
It is required that a suitable selection key is set.
Returns:
the edge routing algorithm applied to the non-series-parallel edges
See Also:
setNonSeriesParallelEdgeRouter(Layouter), setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgesDpKey(Object)

setNonSeriesParallelEdgeRouter

public void setNonSeriesParallelEdgeRouter(Layouter nonSeriesParallelEdgeRouter)
Specifies the edge routing algorithm used for the edges of a general graph that are not part of the series-parallel subgraph whose layout is calculated.

 
It is required that a suitable selection key is set.
Default Value:
The default value is EdgeRouter
Parameters:
nonSeriesParallelEdgeRouter - the edge routing algorithm applied to the non-series-parallel edges
Throws:
java.lang.IllegalArgumentException - if null is specified
See Also:
setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgesDpKey(Object)

getNonSeriesParallelEdgesDpKey

public java.lang.Object getNonSeriesParallelEdgesDpKey()
Returns the key to register a DataProvider that is used for marking non-series-parallel edges. This key is used for determining the edges that are not part of the series-parallel structure in a general graph, such that the specified non-series-parallel edge router only routes marked edges.

 
The layout algorithm automatically marks these edges and also registers the DataProvider using the specified key.
Returns:
the selection key
See Also:
setNonSeriesParallelEdgesDpKey(Object), setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgeRouter(Layouter)

setNonSeriesParallelEdgesDpKey

public void setNonSeriesParallelEdgesDpKey(java.lang.Object nonSeriesParallelSelectionKey)
Specifies the key to register a DataProvider that is used for marking non-series-parallel edges. This key is used for determining the edges that are not part of the series-parallel structure in a general graph, such that the specified non-series-parallel edge router only routes marked edges.

 
The layout algorithm automatically marks these edges and also registers the DataProvider using the specified key.
Parameters:
nonSeriesParallelSelectionKey - the selection key
Throws:
java.lang.IllegalArgumentException - if the given key is set to null
See Also:
setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgeRouter(Layouter)

getNonSeriesParallelEdgeLabelingAlgorithm

public Layouter getNonSeriesParallelEdgeLabelingAlgorithm()
Returns the labeling algorithm that is applied to all edge labels that belong to non-series-parallel edges.

 
When specifying a custom labeling algorithm, make sure that it uses the according edge label selection key to determine which edge labels it should place. Otherwise, the labeling algorithm might place all labels, including those that belong to actual series-parallel edges.
Returns:
the labeling algorithm used for edge labels of non-series-parallel edges
See Also:
setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgeLabelSelectionKey(Object), setNonSeriesParallelEdgeLabelingAlgorithm(Layouter)

setNonSeriesParallelEdgeLabelingAlgorithm

public void setNonSeriesParallelEdgeLabelingAlgorithm(Layouter nonSeriesParallelEdgeLabelingAlgorithm)
Specifies the labeling algorithm that is applied to all edge labels that belong to non-series-parallel edges.

 
When specifying a custom labeling algorithm, make sure that it uses the according edge label selection key to determine which edge labels it should place. Otherwise, the labeling algorithm might place all labels, including those that belong to actual series-parallel edges.
Default Value:
The default value is SALabeling
Parameters:
nonSeriesParallelEdgeLabelingAlgorithm - the labeling algorithm used for edge labels of non-series-parallel edges
See Also:
setGeneralGraphHandlingEnabled(boolean), setNonSeriesParallelEdgeLabelSelectionKey(Object)

getNonSeriesParallelEdgeLabelSelectionKey

public java.lang.Object getNonSeriesParallelEdgeLabelSelectionKey()
Returns the key to register a DataProvider that is used by the non-series-parallel edge labeling algorithm to determine which edge labels it should place.

During the layout, a DataProvider with this key will be registered with the graph. It will mark all EdgeLabelLayouts that belong to non-series-parallel edges. A specified custom non-series-parallel edge labeling algorithm needs to obey this selection. If using SALabeling as labeling algorithm, set this key as value of property AbstractLabelingAlgorithm.setSelection(Object).

The labeling algorithm set as default is already configured such that it uses the correct selection key.

 
When specifying a custom non-series-parallel edge labeling algorithm but no edge label selection key, then the labeling algorithm might place all labels, including those that belong to actual series-parallel edges.
Returns:
the non-series-parallel edge label selection DataProvider key
See Also:
setNonSeriesParallelEdgeLabelSelectionKey(Object), setNonSeriesParallelEdgeLabelingAlgorithm(Layouter)

setNonSeriesParallelEdgeLabelSelectionKey

public void setNonSeriesParallelEdgeLabelSelectionKey(java.lang.Object nonSeriesParallelEdgeLabelSelectionKey)
Specifies the key to register a DataProvider that is used by the non-series-parallel edge labeling algorithm to determine which edg e labels it should place.

During the layout, a DataProvider with this key will be registered with the graph. It will mark all EdgeLabelLayouts that belong to non-series-parallel edges. A specified custom non-series-parallel edge labeling algorithm needs to obey this selection. If using SALabeling as labeling algorithm, set this key as value of property AbstractLabelingAlgorithm.setSelection(Object).

The labeling algorithm set as default is already configured such that it uses the correct selection key.

 
When specifying a custom non-series-parallel edge labeling algorithm but no edge label selection key, then the labeling algorithm might place all labels, including those that belong to actual series-parallel edges.
Default Value:
The default value is NON_SERIES_PARALLEL_EDGE_LABELS_DPKEY
Parameters:
nonSeriesParallelEdgeLabelSelectionKey - the non-series-parallel edge label selection DataProvider key
See Also:
setNonSeriesParallelEdgeLabelingAlgorithm(Layouter)

getDefaultPortAssignment

public PortAssignment getDefaultPortAssignment()
Returns the default PortAssignment used for those nodes that do not have their own specific instance.

A PortAssignment instance is defined using a DataProvider registered with the graph with key PORT_ASSIGNMENT_DPKEY.

Returns:
the port assignment
See Also:
setDefaultPortAssignment(PortAssignment)

setDefaultPortAssignment

public void setDefaultPortAssignment(PortAssignment defaultPortAssignment)
Specifies the default PortAssignment used for those nodes that do not have their own specific instance.

A PortAssignment instance is defined using a DataProvider registered with the graph with key PORT_ASSIGNMENT_DPKEY.

Default Value:
The default value is DefaultPortAssignment. All ports are distributed on the borders of the nodes.
Parameters:
defaultPortAssignment - the port assignment
Throws:
java.lang.IllegalArgumentException - if null is specified

getDefaultOutEdgeComparator

public java.util.Comparator getDefaultOutEdgeComparator()
Returns the default Comparator used for sorting the outgoing edges incident to nodes that do not have a specific Comparator.

Such a comparator is defined using a DataProvider registered with the graph with key OUT_EDGE_COMPARATOR_DPKEY.

 
To maintain the current order of edges, the default comparator can be set to null.
Returns:
the default Comparator for outgoing edges
See Also:
setDefaultOutEdgeComparator(Comparator)

setDefaultOutEdgeComparator

public void setDefaultOutEdgeComparator(java.util.Comparator defaultOutEdgeComparator)
Specifies the default Comparator used for sorting the outgoing edges incident to nodes that do not have a specific Comparator.

Such a comparator is defined using a DataProvider registered with the graph with key OUT_EDGE_COMPARATOR_DPKEY.

 
To maintain the current order of edges, the default comparator can be set to null.
Default Value:
The default value is DefaultOutEdgeComparator. The order of the edges is used along with a special PortConstraint and edge group handling.
Parameters:
defaultOutEdgeComparator - the default Comparator for outgoing edges

getRoutingStyle

public byte getRoutingStyle()
Returns the currently used routing style for edges.

 
The routing style has no effect on non-series-parallel edges, when setGeneralGraphHandlingEnabled(boolean) is enabled.
Returns:
the routing style for the edges

setRoutingStyle

public void setRoutingStyle(byte routingStyle)
Specifies the currently used routing style for edges.

 
The routing style has no effect on non-series-parallel edges, when setGeneralGraphHandlingEnabled(boolean) is enabled.
Default Value:
The default value is ROUTING_STYLE_ORTHOGONAL
Parameters:
routingStyle - the routing style for the edges

getMinimumPolylineSegmentLength

public double getMinimumPolylineSegmentLength()
Returns the minimum vertical distance of the edge segments that are not orthogonal. The distance needs to be non-negative.

 
This distance will only be considered when the routing style is ROUTING_STYLE_POLYLINE.
Returns:
the minimum vertical distance
See Also:
setMinimumPolylineSegmentLength(double), setMinimumSlope(double), setRoutingStyle(byte), ROUTING_STYLE_POLYLINE

setMinimumPolylineSegmentLength

public void setMinimumPolylineSegmentLength(double minimumPolylineSegmentLength)
Specifies the minimum vertical distance of the edge segments that are not orthogonal. The distance needs to be non-negative.

 
This distance will only be considered when the routing style is ROUTING_STYLE_POLYLINE.
Default Value:
The default value is 30.
Parameters:
minimumPolylineSegmentLength - the given minimum vertical distance
Throws:
java.lang.IllegalArgumentException - if the specified length is smaller than 0
See Also:
setMinimumSlope(double), setRoutingStyle(byte), ROUTING_STYLE_POLYLINE
Sample Graphs:

30

60

getMinimumSlope

public double getMinimumSlope()
Returns the minimum slope which a non-orthogonal edge segment should have. A higher minimum slope prevents those segments in very wide graphs from becoming nearly horizontal. The slope needs to have a non-negative value.

 
This distance will only be considered when the routing style is ROUTING_STYLE_POLYLINE.
Returns:
the minimum slope for a non-orthogonal segment
See Also:
setMinimumSlope(double), setMinimumPolylineSegmentLength(double), setRoutingStyle(byte), ROUTING_STYLE_POLYLINE

setMinimumSlope

public void setMinimumSlope(double minimumSlope)
Specifies the minimum slope which a non-orthogonal edge segment should have. A higher minimum slope prevents those segments in very wide graphs from becoming nearly horizontal. The slope needs to have a non-negative value.

 
This distance will only be considered when the routing style is ROUTING_STYLE_POLYLINE.
Default Value:
The default value is 0.25.
Parameters:
minimumSlope - the minimum slope for a non-orthogonal segment
Throws:
java.lang.IllegalArgumentException - if the specified slope is smaller than 0
See Also:
setMinimumPolylineSegmentLength(double), setRoutingStyle(byte), ROUTING_STYLE_POLYLINE
Sample Graphs:

0.25

1.5

getPreferredOctilinearSegmentLength

public double getPreferredOctilinearSegmentLength()
Returns the preferred length for non-orthogonal segments in octilinear edge routes. If there is not enough space, those segments may be shorter than the specified length. The length needs to be non-negative.

 
This segment length will only be considered when the routing style is ROUTING_STYLE_OCTILINEAR.
Returns:
the preferred length for non-orthogonal segments in octilinear edge routes
See Also:
setPreferredOctilinearSegmentLength(double), setRoutingStyle(byte), ROUTING_STYLE_OCTILINEAR

setPreferredOctilinearSegmentLength

public void setPreferredOctilinearSegmentLength(double preferredOctilinearSegmentLength)
Specifies the preferred length for non-orthogonal segments in octilinear edge routes. If there is not enough space, those segments may be shorter than the specified length. The length needs to be non-negative.

 
This segment length will only be considered when the routing style is ROUTING_STYLE_OCTILINEAR.
Default Value:
The default value is 10.
Parameters:
preferredOctilinearSegmentLength - the preferred length for non-orthogonal segments in octilinear edge routes
Throws:
java.lang.IllegalArgumentException - if the specified length is smaller than 0
See Also:
setRoutingStyle(byte), ROUTING_STYLE_OCTILINEAR
Sample Graphs:

10

20

getDefaultEdgeLayoutDescriptor

public EdgeLayoutDescriptor getDefaultEdgeLayoutDescriptor()
Returns the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned.

Returns:
the current EdgeLayoutDescriptor instance
See Also:
setDefaultEdgeLayoutDescriptor(EdgeLayoutDescriptor), EDGE_LAYOUT_DESCRIPTOR_DPKEY

setDefaultEdgeLayoutDescriptor

public void setDefaultEdgeLayoutDescriptor(EdgeLayoutDescriptor descriptor)
Specifies the EdgeLayoutDescriptor instance used for all those edges that do not have a specific layout descriptor assigned.

Default Value:
The default value is EdgeLayoutDescriptor
Parameters:
descriptor - the current EdgeLayoutDescriptor instance
Throws:
java.lang.IllegalArgumentException - if the specified EdgeLayoutDescriptor is null
See Also:
EDGE_LAYOUT_DESCRIPTOR_DPKEY

getMinimumNodeToNodeDistance

public double getMinimumNodeToNodeDistance()
Returns the minimum distance between nodes. This distance needs to be non-negative.

Returns:
the minimum distance between nodes
See Also:
setMinimumNodeToNodeDistance(double)

setMinimumNodeToNodeDistance

public void setMinimumNodeToNodeDistance(double minimumNodeToNodeDistance)
Specifies the minimum distance between nodes. This distance needs to be non-negative.

Default Value:
The default value is 10.
Parameters:
minimumNodeToNodeDistance - the minimum distance between nodes
Throws:
java.lang.IllegalArgumentException - if the specified distance is smaller than 0
Sample Graphs:

10

100

getMinimumNodeToEdgeDistance

public double getMinimumNodeToEdgeDistance()
Returns the minimum distance between nodes and edges. This distance needs to be non-negative.

Returns:
the minimum distance between nodes and edges
See Also:
setMinimumNodeToEdgeDistance(double)

setMinimumNodeToEdgeDistance

public void setMinimumNodeToEdgeDistance(double minimumNodeToEdgeDistance)
Specifies the minimum distance between nodes and edges. This distance needs to be non-negative.

Default Value:
The default value is 10.
Parameters:
minimumNodeToEdgeDistance - the minimum distance between nodes and edges
Throws:
java.lang.IllegalArgumentException - if the specified distance is smaller than 0
Sample Graphs:

10

100

getMinimumEdgeToEdgeDistance

public double getMinimumEdgeToEdgeDistance()
Returns the minimum distance between edges. This distance needs to be non-negative.

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

setMinimumEdgeToEdgeDistance

public void setMinimumEdgeToEdgeDistance(double minimumEdgeToEdgeDistance)
Specifies the minimum distance between edges. This distance needs to be non-negative.

Default Value:
The default value is 5.
Parameters:
minimumEdgeToEdgeDistance - the minimum distance between edges
Throws:
java.lang.IllegalArgumentException - if the specified distance is smaller than 0
Sample Graphs:

5

100

setFromSketchModeEnabled

public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Specifies whether or not to take the coordinates of the input diagram into account when arranging the nodes. The order of edges incident to the same source node will remain the same as in the original layout.

 
Previously specified comparators will be ignored if From Sketch mode is enabled.
Default Value:
The default value is false. The initial coordinates of the nodes are not considered.
Parameters:
fromSketchModeEnabled - true if input coordinates are considered, false otherwise

isFromSketchModeEnabled

public boolean isFromSketchModeEnabled()
Returns whether or not to take the coordinates of the input diagram into account when arranging the nodes. The order of edges incident to the same source node will remain the same as in the original layout.

 
Previously specified comparators will be ignored if From Sketch mode is enabled.
Returns:
true if input coordinates are considered, false otherwise

setComponentLayouterEnabled

public void setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.

Overrides:
setComponentLayouterEnabled in class CanonicMultiStageLayouter
 
SeriesParallelLayouter can only handle single components. Disabling ComponentLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that arranges connected graph components is activated.
Parameters:
enabled - true if the stage that arranges the graph components is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isComponentLayouterEnabled(), CanonicMultiStageLayouter.setComponentLayouter(LayoutStage), ComponentLayouter

setSelfLoopLayouterEnabled

public void setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated.

Overrides:
setSelfLoopLayouterEnabled in class CanonicMultiStageLayouter
 
SeriesParallelLayouter cannot handle self-loops. Disabling SelfLoopLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that routes self-loops is activated.
Parameters:
enabled - true if the stage responsible for routing self-loops is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isSelfLoopLayouterEnabled(), CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage), SelfLoopLayouter

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