documentationfor yFiles for HTML 2.6

SeriesParallelLayout

This layout algorithm arranges series-parallel graphs.

Inheritance Hierarchy
MultiStageLayout
SeriesParallelLayout
Implemented Interfaces

Remarks

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.

SeriesParallelLayout 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

SeriesParallelLayout 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 IDataProvider key MINIMUM_NODE_SIZE_DP_KEY.

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

SeriesParallelLayout supports custom sorting of the outgoing edges of a node. A IComparer<T> can be assigned individually for the nodes using a IDataProvider registered with key OUT_EDGE_COMPARER_DP_KEY. For all nodes for which the IDataProvider 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.

Default Values of Properties

componentLayoutEnabledtrueThe stage that arranges connected graph components is activated.
considerNodeLabelsfalseNode labels are not considered.
defaultOutEdgeComparerDefaultOutEdgeComparerThe order of the edges is used along with a special and edge group handling.
defaultPortAssignmentDefaultSeriesParallelLayoutPortAssignmentAll ports are on the borders of the nodes.
fromSketchModefalseThe initial coordinates of the nodes are not considered.
generalGraphHandlingfalseOnly series-parallel graphs are handled.
hideGroupsStageEnabledfalseThe stage responsible for hiding group nodes is activated.
integratedEdgeLabelingfalseIntegrated edge labeling is disabled.
minimumEdgeToEdgeDistance5
minimumNodeToEdgeDistance10
minimumNodeToNodeDistance10
nonSeriesParallelEdgeLabelingAlgorithmGenericLabeling
routingStyleORTHOGONAL
selfLoopRouterEnabledtrueThe stage that routes self-loops is activated.
verticalAlignment0.5Subgraphs are center aligned.

Type Details

yfiles module
layout-seriesparallel
yfiles-umd modules
layout-seriesparallel, layout
Legacy UMD name
yfiles.seriesparallel.SeriesParallelLayout

See Also

Constructors

Properties

Methods

Constants

Static Methods