Packagecom.yworks.yfiles.layout.seriesparallel
Classpublic class SeriesParallelLayouter
InheritanceSeriesParallelLayouter Inheritance CanonicMultiStageLayouter Inheritance YObject Inheritance Object

This class implements a layout algorithm for drawing series-parallel graphs.

Series parallel graphs are directed graphs with a single source (node without incoming edges) and a single sink (node without outgoing edges) that are build 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.

Features:

See also

preferred placement
port assignment
vertical alignments
edge routing styles
order
from-sketch mode
com.yworks.yfiles.layout.PortConstraint


Public Properties
 PropertyDefined By
 InheritedcomponentLayouter : LayoutStage
Specifies the LayoutStage responsible for laying out the connected components of the graph.
CanonicMultiStageLayouter
 InheritedcomponentLayouterEnabled : Boolean
Getter: Returns whether or not ComponentLayouter is enabled.
CanonicMultiStageLayouter
  considerNodeLabels : Boolean
Specifies whether or not node labels are considered.
SeriesParallelLayouter
  defaultEdgeLayoutDescriptor : EdgeLayoutDescriptor
Specifies the default com.yworks.yfiles.layout.seriesparallel.EdgeLayoutDescriptor.
SeriesParallelLayouter
  defaultOutEdgeComparator : Comparator
Getter: Returns the default java.util.Comparator that will be used for those nodes, that don't have their own specific instance set via appropriate DataProvider (PORT_ASSIGNMENT_DPKEY).
SeriesParallelLayouter
  defaultPortAssignment : PortAssignment
Specifies the default com.yworks.yfiles.layout.seriesparallel.PortAssignment that will be used for those nodes, that don't have their own specific instance set via the appropriate DataProvider (PORT_ASSIGNMENT_DPKEY).
SeriesParallelLayouter
  fromSketchModeEnabled : Boolean
Specifies whether or not to take the coordinates of the input diagram into account when arranging the nodes.
SeriesParallelLayouter
  generalGraphHandling : Boolean
Specifies whether or not general graphs are handled by this layouter.
SeriesParallelLayouter
 InheritedgroupNodeHider : LayoutStage
Specifies the LayoutStage that is responsible for hiding away grouping information for the layout algorithm.
CanonicMultiStageLayouter
 InheritedhideGroupNodes : Boolean
Specifies whether or not to hide away group nodes before the layout begins.
CanonicMultiStageLayouter
  integratedEdgeLabeling : Boolean
Specifies whether or not integrated edge labeling is enabled.
SeriesParallelLayouter
 InheritedlabelLayouter : LayoutStage
Getter: Returns the algorithm used for placing labels.
CanonicMultiStageLayouter
 InheritedlabelLayouterEnabled : Boolean
Getter: Returns whether or not LabelLayouter is enabled.
CanonicMultiStageLayouter
 InheritedlayoutOrientation : int
Specifies the main layout orientation.
CanonicMultiStageLayouter
  minimumEdgeToEdgeDistance : Number
Specifies the minimum distance between edges.
SeriesParallelLayouter
  minimumNodeToEdgeDistance : Number
Specifies the minimum distance between nodes and edges.
SeriesParallelLayouter
  minimumNodeToNodeDistance : Number
Specifies the minimum distance between nodes.
SeriesParallelLayouter
  minimumPolylineSegmentLength : Number
Specifies the minimum segment length for a polyline edge segment.
SeriesParallelLayouter
  minimumSlope : Number
Specifies the minimum slope which a polyline edge segment should have.
SeriesParallelLayouter
  nonSeriesParallelEdgeRouter : Layouter
Specifies the edge router used for edges of a general graph that are not part of the series-parallel subgraph whose layout is calculated.
SeriesParallelLayouter
  nonSeriesParallelEdgesDpKey : Object
Specifies the key that is used to mark non-series-parallel edges.
SeriesParallelLayouter
 InheritedorientationLayouter : LayoutStage
Specifies the LayoutStage that is responsible for changing the orientation of the computed layout.
CanonicMultiStageLayouter
 InheritedorientationLayouterEnabled : Boolean
Getter: Returns whether or not the OrientationLayouter is enabled.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouter : LayoutStage
Getter: Returns the LayoutStage responsible for routing parallel edges.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouterEnabled : Boolean
Getter: Returns whether or not the ParallelEdgeLayouter is enabled.
CanonicMultiStageLayouter
  preferredOctilinearSegmentLength : Number
Specifies the preferred length for non-orthogonal segments in octilinear edge routes.
SeriesParallelLayouter
  routingStyle : int
Specifies the currently used routing style for edges.
SeriesParallelLayouter
 InheritedselfLoopLayouter : LayoutStage
Getter: Returns the LayoutStage used for routing Self-loops.
CanonicMultiStageLayouter
 InheritedselfLoopLayouterEnabled : Boolean
Getter: Returns whether or not the SelfLoopLayouter is enabled.
CanonicMultiStageLayouter
 InheritedsubgraphLayouter : LayoutStage
Specifies the LayoutStage that is responsible for constraining the layout process to a subgraph of the target graph.
CanonicMultiStageLayouter
 InheritedsubgraphLayouterEnabled : Boolean
Getter: Returns whether or not the SubgraphLayouter is enabled.
CanonicMultiStageLayouter
  verticalAlignment : Number
Specifies the vertical alignment of parallel subgraphs.
SeriesParallelLayouter
Public Methods
 MethodDefined By
  
SeriesParallelLayouter(init:Boolean = true)
Creates a new SeriesParallelLayouter with default settings.
SeriesParallelLayouter
 Inherited
Appends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given layout graph.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given graph interface and layout.
CanonicMultiStageLayouter
 Inherited
canLayout(graph:LayoutGraph):Boolean
Tests whether or not the given graph can be laid out by this layouter.
CanonicMultiStageLayouter
  
canLayoutCore(graph:LayoutGraph):Boolean
[override] Checks whether or not the given graph is series-parallel and can be layouted by com.yworks.yfiles.layout.seriesparallel.SeriesParallelLayouter.
SeriesParallelLayouter
 Inherited
doLayout(layoutGraph:LayoutGraph):void
Calculates a layout for the given graph.
CanonicMultiStageLayouter
 Inherited
Calculates a layout for the given graph interface and layout.
CanonicMultiStageLayouter
  
[override] Calculates a series-parallel layout for the given graph.
SeriesParallelLayouter
 Inherited
Disables all layout stages and performs only the core layouter.
CanonicMultiStageLayouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
SeriesParallelLayouter
 Inherited
hashCode():int
YObject
  
[static] Determines whether or not the given graph has a series-parallel structure.
SeriesParallelLayouter
  
[static] Creates a new SeriesParallelLayouter with default settings.
SeriesParallelLayouter
 Inherited
Prepends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Removes a LayoutStage that has been previously added by the methods appendStage() or prependStage().
CanonicMultiStageLayouter
Protected Methods
 MethodDefined By
 Inherited
checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero.
CanonicMultiStageLayouter
 Inherited
checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero.
CanonicMultiStageLayouter
 Inherited
CanonicMultiStageLayouter
  
Initializes this object.
SeriesParallelLayouter
Public Constants
 ConstantDefined By
  EDGE_LAYOUT_DESCRIPTOR_DPKEY : String = y.layout.seriesparallel.SeriesParallelLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
[static] com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.seriesparallel.EdgeLayoutDescriptor for each edge.
SeriesParallelLayouter
  OUT_EDGE_COMPARATOR_DPKEY : Object = y.layout.seriesparallel.SeriesParallelLayouter.OUT_EDGE_COMPARATOR_DPKEY
[static] DataProvider key that can be registered with the graph to provide each node with its own java.util.Comparator instance that will be used to sort the outgoing edges.
SeriesParallelLayouter
  PORT_ASSIGNMENT_DPKEY : Object = y.layout.tree.GenericTreeLayouter.PORT_ASSIGNMENT_DPKEY
[static] DataProvider key that can be registered with the graph to provide each node with its own com.yworks.yfiles.layout.seriesparallel.PortAssignment instance.
SeriesParallelLayouter
  ROUTING_STYLE_OCTILINEAR : int = 1
[static] Style constant describing an octilinear edge style.
SeriesParallelLayouter
  ROUTING_STYLE_ORTHOGONAL : int = 0
[static] Style constant describing an orthogonal edge style.
SeriesParallelLayouter
  ROUTING_STYLE_POLYLINE : int = 2
[static] Style constant describing an polyline edge style.
SeriesParallelLayouter
Property Detail
considerNodeLabelsproperty
considerNodeLabels:Boolean

Specifies whether or not node labels are considered. If enabled, the layouter will reserve space for the node labels to avoid overlaps.

By default, node labels are not considered.


Implementation
    public function get considerNodeLabels():Boolean
    public function set considerNodeLabels(value:Boolean):void
defaultEdgeLayoutDescriptorproperty 
defaultEdgeLayoutDescriptor:EdgeLayoutDescriptor

Specifies the default com.yworks.yfiles.layout.seriesparallel.EdgeLayoutDescriptor. This instance is used for all those edges, that do not have a specific layout descriptor assigned.


Implementation
    public function get defaultEdgeLayoutDescriptor():EdgeLayoutDescriptor
    public function set defaultEdgeLayoutDescriptor(value:EdgeLayoutDescriptor):void

See also

defaultOutEdgeComparatorproperty 
defaultOutEdgeComparator:Comparator

Getter: Returns the default java.util.Comparator that will be used for those nodes, that don't have their own specific instance set via appropriate DataProvider (PORT_ASSIGNMENT_DPKEY).

By default, com.yworks.yfiles.layout.seriesparallel.DefaultOutEdgeComparator is used which uses the edge order of the graph along with a special com.yworks.yfiles.layout.PortConstraint and edge group handling.

Setter: Specifies the default java.util.Comparator that will be used for those nodes, that don't have their own specific instance set via the appropriate DataProvider.

By default, com.yworks.yfiles.layout.seriesparallel.DefaultOutEdgeComparator is used which uses the edge order of the graph along with a special com.yworks.yfiles.layout.PortConstraint and edge group handling.

If you simply want to use the graph's current edge order you can set the default comparator to null.


Implementation
    public function get defaultOutEdgeComparator():Comparator
    public function set defaultOutEdgeComparator(value:Comparator):void

See also

defaultPortAssignmentproperty 
defaultPortAssignment:PortAssignment

Specifies the default com.yworks.yfiles.layout.seriesparallel.PortAssignment that will be used for those nodes, that don't have their own specific instance set via the appropriate DataProvider (PORT_ASSIGNMENT_DPKEY).

By default, all ports are placed in the center of the node.


Implementation
    public function get defaultPortAssignment():PortAssignment
    public function set defaultPortAssignment(value:PortAssignment):void

See also

fromSketchModeEnabledproperty 
fromSketchModeEnabled:Boolean

Specifies whether or not to take the coordinates of the input diagram into account when arranging the nodes. The order of edges with the same source node will stay the same an in the original layout.

Note that previously specified comparators (OUT_EDGE_COMPARATOR_DPKEY) will be ignored if from-sketch-mode is activated.

By default this feature is disabled.


Implementation
    public function get fromSketchModeEnabled():Boolean
    public function set fromSketchModeEnabled(value:Boolean):void

See also

generalGraphHandlingproperty 
generalGraphHandling:Boolean

Specifies whether or not general graphs are handled by this layouter.

If general graphs are handled, they will be transformed before layout to fit the criteria of series-parallel graphs. After layout, they will be restored and the edges which weren't series-parallel are routed by an nonSeriesParallelEdgeRouter edge router}.

By default only series-parallel graphs are handled.


Implementation
    public function get generalGraphHandling():Boolean
    public function set generalGraphHandling(value:Boolean):void

See also

integratedEdgeLabelingproperty 
integratedEdgeLabeling:Boolean

Specifies whether or not integrated edge labeling is enabled. If enabled, the layouter will place edge labels and reserve space for them.

By default, integrated edge labeling is disabled.


Implementation
    public function get integratedEdgeLabeling():Boolean
    public function set integratedEdgeLabeling(value:Boolean):void
minimumEdgeToEdgeDistanceproperty 
minimumEdgeToEdgeDistance:Number

Specifies the minimum distance between edges.

By default the distance between edges is 5.


Implementation
    public function get minimumEdgeToEdgeDistance():Number
    public function set minimumEdgeToEdgeDistance(value:Number):void
minimumNodeToEdgeDistanceproperty 
minimumNodeToEdgeDistance:Number

Specifies the minimum distance between nodes and edges.

By default the distance between nodes and edges is 10.


Implementation
    public function get minimumNodeToEdgeDistance():Number
    public function set minimumNodeToEdgeDistance(value:Number):void
minimumNodeToNodeDistanceproperty 
minimumNodeToNodeDistance:Number

Specifies the minimum distance between nodes.

By default the distance between nodes is 10.


Implementation
    public function get minimumNodeToNodeDistance():Number
    public function set minimumNodeToNodeDistance(value:Number):void
minimumPolylineSegmentLengthproperty 
minimumPolylineSegmentLength:Number

Specifies the minimum segment length for a polyline edge segment. This distance will only be considered when the routing style property is set to polyline edge routes.

By default, this distance is 30.


Implementation
    public function get minimumPolylineSegmentLength():Number
    public function set minimumPolylineSegmentLength(value:Number):void

See also

minimumSlopeproperty 
minimumSlope:Number

Specifies the minimum slope which a polyline edge segment should have. A higher minimum slope prevents polyline segments in very wide graphs to get nearly horizontal. This distance will only be considered when the routing style property is set to polyline edge routes.

By default, the minimum slope is 0.25.


Implementation
    public function get minimumSlope():Number
    public function set minimumSlope(value:Number):void

See also

nonSeriesParallelEdgeRouterproperty 
nonSeriesParallelEdgeRouter:Layouter

Specifies the edge router used for 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 (nonSeriesParallelEdgesDpKey) is used.

By default com.yworks.yfiles.layout.router.polyline.EdgeRouter is used.


Implementation
    public function get nonSeriesParallelEdgeRouter():Layouter
    public function set nonSeriesParallelEdgeRouter(value:Layouter):void

See also

nonSeriesParallelEdgesDpKeyproperty 
nonSeriesParallelEdgesDpKey:Object

Specifies the key that is used to mark non-series-parallel edges. Note that this layouter automatically marks these edges and registers the DataProvider using the specified key. This key is used to determine the edges that are not part of the series-parallel structure in a general graph, so the specified non-series parallel edge router should only route marked edges.


Implementation
    public function get nonSeriesParallelEdgesDpKey():Object
    public function set nonSeriesParallelEdgesDpKey(value:Object):void

See also

preferredOctilinearSegmentLengthproperty 
preferredOctilinearSegmentLength:Number

Specifies the preferred length for non-orthogonal segments in octilinear edge routes. This segment length will only be considered when the routing style property is set to octilinear edge routes.

By default, the preferred length is 10.


Implementation
    public function get preferredOctilinearSegmentLength():Number
    public function set preferredOctilinearSegmentLength(value:Number):void

See also

routingStyleproperty 
routingStyle:int

Specifies the currently used routing style for edges. Note that the routing style has no effect on non-series-parallel (generalGraphHandling) edges.

By default, edges are routed orthogonally.


Implementation
    public function get routingStyle():int
    public function set routingStyle(value:int):void

See also

verticalAlignmentproperty 
verticalAlignment:Number

Specifies the vertical alignment of parallel subgraphs. A value of 0 means nodes are top aligned; a value of 1 means nodes are bottom aligned; a value of 0.5 means nodes are center aligned. Values outside the interval [0,1] will be matched with the nearest interval end.

In grouped graphs, the vertical alignment only applies to parallel subgraphs that belong to the same group.

By default the subgraphs are center aligned.


Implementation
    public function get verticalAlignment():Number
    public function set verticalAlignment(value:Number):void
Constructor Detail
SeriesParallelLayouter()Constructor
public function SeriesParallelLayouter(init:Boolean = true)

Creates a new SeriesParallelLayouter with default settings.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
canLayoutCore()method
override public function canLayoutCore(graph:LayoutGraph):Boolean

Checks whether or not the given graph is series-parallel and can be layouted by com.yworks.yfiles.layout.seriesparallel.SeriesParallelLayouter.

Parameters

graph:LayoutGraph — the graph to be checked.

Returns
Booleantrue if the given graph is series-parallel, false otherwise.

See also

doLayoutCore()method 
override public function doLayoutCore(graph:LayoutGraph):void

Calculates a series-parallel layout for the given graph.

Parameters

graph:LayoutGraph — the graph to be layouted.


Throws
InvalidGraphStructureException — if the graph is not series-parallel.
getClass()method 
override public function getClass():Class

Returns
Class
initSeriesParallelLayouter()method 
protected final function initSeriesParallelLayouter():void

Initializes this object. See the documentation of the corresponding factory method newSeriesParallelLayouter() for details.

See also

isSeriesParallelGraph()method 
public static function isSeriesParallelGraph(graph:Graph):Boolean

Determines whether or not the given graph has a series-parallel structure.

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

Parameters

graph:Graph — the graph to be checked.

Returns
Booleantrue if the given graph is series-parallel, false otherwise.
newSeriesParallelLayouter()method 
public static function newSeriesParallelLayouter():SeriesParallelLayouter

Creates a new SeriesParallelLayouter with default settings.

Returns
SeriesParallelLayouter
Constant Detail
EDGE_LAYOUT_DESCRIPTOR_DPKEYConstant
public static const EDGE_LAYOUT_DESCRIPTOR_DPKEY:String = y.layout.seriesparallel.SeriesParallelLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY

com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.seriesparallel.EdgeLayoutDescriptor for each edge. If there is no descriptor mapped for an edge, the default descriptor is used.

See also

OUT_EDGE_COMPARATOR_DPKEYConstant 
public static const OUT_EDGE_COMPARATOR_DPKEY:Object = y.layout.seriesparallel.SeriesParallelLayouter.OUT_EDGE_COMPARATOR_DPKEY

DataProvider key that can be registered with the graph to provide each node with its own java.util.Comparator instance that will be used to sort the outgoing edges. If the Comparator associated with a node is null, the outgoing edges are not sorted.

Note that the order cannot be kept in all cases because the target nodes may not be completely independent.

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 (nonSeriesParallelEdgeRouter).

See also

PORT_ASSIGNMENT_DPKEYConstant 
public static const PORT_ASSIGNMENT_DPKEY:Object = y.layout.tree.GenericTreeLayouter.PORT_ASSIGNMENT_DPKEY

DataProvider key that can be registered with the graph to provide each node with its own com.yworks.yfiles.layout.seriesparallel.PortAssignment instance.

See also

ROUTING_STYLE_OCTILINEARConstant 
public static const ROUTING_STYLE_OCTILINEAR:int = 1

Style constant describing an octilinear edge style. If this style is used, edges will have horizontal, vertical and 45-degree sloped segments.

See also

ROUTING_STYLE_ORTHOGONALConstant 
public static const ROUTING_STYLE_ORTHOGONAL:int = 0

Style constant describing an orthogonal edge style. If this style is used, edges will have only horizontal or vertical segments.

See also

ROUTING_STYLE_POLYLINEConstant 
public static const ROUTING_STYLE_POLYLINE:int = 2

Style constant describing an polyline edge style. If this style is used, edges will have vertical and sloped segments.

See also