documentationfor yFiles for HTML 2.6

ParallelEdgeRouter

ParallelEdgeRouter is a ILayoutStage that routes parallel edges which connect the same pair of nodes in a graph.

Inheritance Hierarchy
LayoutStageBase
ParallelEdgeRouter
Implemented Interfaces

Remarks

Layout Style

The edge paths of parallel edges consist of parallel segments. At the end points, the edges can either still be parallel or joined in one point.

The master edge determining the routing is highlighted

Concept

ParallelEdgeRouter performs four basic steps:

  1. For each set of parallel edges between the same endpoints, the algorithm removes all edges but one from the input graph (the remaining edge is called the leading or master edge)
  2. Invoke the core layout algorithm on the graph without parallel edges
  3. Reinsert all previously removed parallel edges
  4. Route the parallel edges such that their path is parallel to that of the associated master edge.

Features

ParallelEdgeRouter can either be used as a ILayoutStage wrapping a layout algorithm which cannot handle parallel edges. Then it will hide the parallel edges from this core layout algorithm and take over the routing of them.

If no core layout algorithm is specified, ParallelEdgeRouter can work alone. It will route only the parallel edges and keep the remaining graph unchanged. Note that, since the parallel edges' paths are parallel to the path of the associated master edge, the master edge should always have a suitable route before calling the ParallelEdgeRouter.

To find out which edges this stage routed, a IDataAcceptor can be registered with the graph with key ROUTED_PARALLEL_EDGES_DP_KEY. Parallel edges that were hidden during the core layout and then routed by this stage are marked. Leading edges are not marked. This may be convenient if parallel edges require further consideration, e.g., to place labels their labels (the core layout could not do that because they were hidden).

Parallel edges can either be all edges between the same two nodes, ignoring the direction, or edges are only considered parallel if they share the same source node and target node. Hence, they share the same direction.

To make sure that the ports of all parallel edges are on the end nodes, the first and last segments can be joined. However, these segments won't be parallel.

There are two ways to define the distance between two parallel edges. First, an absolute distance can be defined. Parallel segments will keep this distance. Second, the distance can be determined relative to the node bounds. Depending on the size of the nodes and the number of parallel edges between them, the distance between parallel edges is adjusted. This will keep the edges straight in most cases.

It is possible to select custom master edges. All edges that are parallel to the selected edges will be temporarily removed.

Default Values of Properties

adaptiveLineDistancestrueThe distances between parallel edges are adjusted to the nodes' bounds.
adjustLeadingEdgetrueThe leading edge is adjusted for more symmetric results.
coreLayoutnull
directedModefalseAll edges that connect the same pair of nodes are considered parallel, ignoring their directions.
joinEndsfalseParallel edges have only parallel segments.
lineDistance10

Type Details

yfiles module
layout-core
yfiles-umd modules
All layout modules, view-layout-bridge
Legacy UMD name
yfiles.router.ParallelEdgeRouter

See Also

In order to obtain suitable routes for the parallel edges, the associated leading/master edges must have suitable routes, too. This can be achieved by either specifying a suitable core layout algorithm or by any other method that ensures that the input graph already has suitable routes (e.g., by calling resetPaths) before applying the ParallelEdgeRouter if the edges should receive straight-line routes).

Constructors

Properties

Methods

Fields

Constants