This class represents a polyline edge router which calculates an edge layout containing only straight segments.

Namespace: yWorks.yFiles.Layout.Router.Polyline
Assembly: yWorks.yFilesSilverlight.Algorithms (in yWorks.yFilesSilverlight.Algorithms.dll) Version:


public class EdgeRouter : AbstractLayoutStage
Visual Basic
Public Class EdgeRouter _ Inherits AbstractLayoutStage


This class represents a polyline edge router which calculates an edge layout containing only straight segments. The router does not change the location or the size of the nodes in a diagram in any way.


Edges can be routed orthogonally, i.e. only horizontal and vertical segments, or with additional segments with other slopes.

Fig. 1: The same graph with orthogonal (left) and polylinear (right) edge routing.

Polyline routing can be activated using PolylineRouting .

In both routing styles, edges can be grouped so they share common segments in the beginning or end of their routes.

Fig. 2: Same graph as in Fig. 1 with grouped edges.

Edges are marked as grouped by using the data provider keys SourceGroupIdDpKey (for source grouped edges) or TargetGroupIdDpKey (for target grouped edges).

Many settings of the edge layout can be controlled individually for every edge using EdgeLayoutDescriptor instances. So, if at the time of the invocation a IDataProvider instance is bound to the graph using the EdgeLayoutDescriptorDpKey key, the EdgeLayoutDescriptors provided for the individual edges are used. Whenever no descriptor is provided for an edge, a default edge layout descriptor is used as fall-back value. This edge layout descriptor can be obtained with DefaultEdgeLayoutDescriptor .


EdgeRouter coordinates all settings and steps that are needed to achieve a polylinear or orthogonal edge routing.
There are three steps that are executed in the following order:

  1. Dividing the graph's area into several rectangular cells (see: IPartition , GraphPartition , PartitionCell ).
  2. Finding the shortest/cheapest paths for all edges through the Partition (see: PathSearch , Path ).
  3. Assigning coordinates to the edges' segments based on the paths that were calculated before (see: ChannelBasedPathRouting ).
It is possible to customize the first two steps by adding extensions for Partition or for PathSearch , respectively.
IGraphPartitionExtension s add obstacles which the PathSearch will consider. They also can add some information to PartitionCells that, for example, specifies whether or not the PartitionCell belongs to a node.
PathSearchExtension s influence the PathSearch by adding costs for traversing specified PartitionCells or narrowing their intervals to allow a less expensive traversal of a PartitionCell. For example, the PathSearch adds costs to a PartitionCell that was marked as an obstacle that belongs to a node, so the edge will avoid the node.

Inheritance Hierarchy


See Also