documentationfor yFiles for HTML 3.0.0.2

SelfLoopRouter

A SelfLoopRouter routes the self-loops (reflexive edges) of a graph.

Inheritance Hierarchy
LayoutStageBase
SelfLoopRouter
Implemented Interfaces

Remarks

Layout Style

This layout algorithm only handles the paths of self-loops, that is, edges where the source node is equal to the target node. The nodes and other edges are optionally arranged by the coreLayout.

Self-loops are routed either ORTHOGONAL or with ROUNDED corners. The layout algorithm places the self-loops in the least crowded quadrant around a node. The default, when there is space, is a route starting at the top and ending at the right node side.

Small graph with self-loops

Concept

Self-loops are handled in four steps:

  1. Remove all self-loops of the input graph
  2. Invoke the core layout algorithm on the now self-loops free graph
  3. Reinsert all formerly removed self-loops
  4. Route the self-loops of the input graph

Features

SelfLoopRouter can either be used as a ILayoutStage wrapping an ILayoutAlgorithm which cannot handle self-loops. Then it will hide the self-loops from this coreLayout and take over the routing of them.

If no coreLayout is specified, SelfLoopRouter can work alone. It will route only the self-loops and keep the remaining graph unchanged.

Default Values of Properties

coreLayoutnull
routingStyleROUNDED

Examples

To only include some self-loops in the routing process, define those self-loops using the EdgeScopeData<TNode,TEdge,TNodeLabel,TEdgeLabel,TEdgeScope>.
Creating an instance of EdgeScopeData
const selfLoopRouter = new SelfLoopRouter()
const layoutData = selfLoopRouter.createLayoutData(graph)

// route only edges with a specific tag
layoutData.edges = (edge) => edge.tag == 'selected'

Type Details

yFiles module
algorithms

See Also

Constructors

Properties

Methods

Constants