C

OrganicEdgeRouter

This edge routing algorithm applies organic routes to the edges of the graph.

Remarks

Layout Style

Edges are routed organically, i.e. in smooth curves around the nodes observing a minimumDistance to the nodes.

During the routing process, the positions of the nodes are considered to be fixed and the router will not modify their locations or their sizes in any way.

The edge routing algorithm can be applied whenever edge paths should avoid crossing any nodes in organic or cyclic layout styles.

Concept

The edge routing algorithm uses a force-directed approach to calculate the edge paths. Nodes are considered to be repulsive forces while edges will try to become as short as possible.

Each edge is routed separately and is influenced by the nodes in a certain area around it. The algorithm will add bends to the edge path that are placed by balancing the forces.

The quality of the result highly depends on how much space there is between the nodes. More precisely, the distance between each pair of nodes should be at least twice the specified minimumDistance. If it is not necessary that the nodes keep their locations, this can be ensured by enabling allowMovingNodes.

Features

The property minimumDistance will make edges keep a custom distance to the nodes. However, if there is not enough space between the nodes, this distance may be undershot (i.e. edges will be closer to nodes).

OrganicEdgeRouter is able to reuse existing bends. Edges will contain those bends along with other bends added by the layout algorithm. Another feature allows to consider bends such that they influence the route finding, however, their absolute location is not kept (see considerExistingBends).

This layout algorithm handles port placement constraints by applying the portPlacementStage as a postprocessing step.

This edge routing algorithm is realized as a ILayoutStage which can be applied to a graph directly or using a coreLayout.

Default Values of Properties

NameDefaultDescription
allowEdgeNodeOverlapstrue
Edges are allowed to cross nodes.
allowMovingNodesfalse
Nodes are not moved.
considerExistingBendsfalse
Bends in the input graph are not considered for edge routing.
coreLayoutnull
keepExistingBendsfalse
Bends coordinates in the input graph are not kept fixed.
minimumDistance10
routeAllEdgesfalse
Only edges being too close to nodes are rerouted.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new OrganicEdgeRouter with the given coreLayout.

Parameters

coreLayout?: ILayoutAlgorithm
the core layout algorithm

Properties

Gets or sets whether or not edges are allowed to cross nodes.
Allowing edges to overlap with nodes will produce smoother edges, because the edge paths can be closer to the nodes.
If nodes can not be moved (see property allowMovingNodes), allowing overlaps between nodes and edges may lead to better results in case the distances between nodes are small. The minimumDistance cannot always be maintained.
final

Property Value

true if edge-node overlaps are allowed, false otherwise

Default Value

The default value is: true
Edges are allowed to cross nodes.

Sample Graphs

ShownSetting: false

See Also

Developer's Guide
API
allowMovingNodes, minimumDistance
Gets or sets whether nodes are allowed to move, which can increase the routing quality and reduce the probability of overlaps between nodes and edges.
When edges should not overlap with nodes (see property allowEdgeNodeOverlaps), enabling this property has the effect that edges keep a greater distance to the nodes and therefore, won't cross them.
final

Property Value

true if nodes are allowed to move a bit to increase the routing quality, false otherwise

Default Value

The default value is: false
Nodes are not moved.

See Also

Developer's Guide
API
allowEdgeNodeOverlaps
Gets or sets whether or not the initial bend coordinates influence the path routing such that the calculated routes tend to have a similar overall shape.
The existing bend coordinates are considered but not kept. If they shall be kept, enable property keepExistingBends.
This setting is ignored when keepExistingBends is enabled.
final

Property Value

true if the existing bends are considered, false otherwise

Default Value

The default value is: false
Bends in the input graph are not considered for edge routing.
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
final

Property Value

the core layout routine

Default Value

The default value is: null
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.

By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false.

Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.

final
Gets or sets whether or not the initial bend coordinates are kept when determining the edge path.
The bends are considered as fixed nodes and stay part of the path.
If existing bends should not be absolutely fixed but just considered for the routing, use property considerExistingBends instead and disable this one.
final

Property Value

true if the initial bend coordinates are kept, false otherwise

Default Value

The default value is: false
Bends coordinates in the input graph are not kept fixed.

Sample Graphs

ShownSetting: Initial graph

See Also

Developer's Guide
Gets or sets the minimum distance the algorithm should guarantee between nodes and non-incident edges.

The distance also influences how many bends are added to the path (a higher distance leads to fewer bends).

The minimum distance is defined to be a non-negative value.

For best results, the distance should be at least 10.
If there is not enough space, the minimum distance may not be respected.
final

Property Value

the non-negative minimum distance between edges and nodes

Throws

Exception ({ name: 'ArgumentError' })
if the given minimum distance is negative

Default Value

The default value is: 10

Sample Graphs

ShownSetting: 10

See Also

Developer's Guide
Gets a LayoutStageBase that provides support for EdgePortCandidates, NodePortCandidates or port groups ids.

Since these features are not natively supported by the OrganicEdgeRouter itself, but through additional preprocessing by the portPlacementStage, the quality may vary.

To specify LayoutPortCandidates, NodePortCandidatess, or port group IDs, use the corresponding properties in the OrganicEdgeRouterData<TNode, TEdge, TNodeLabel, TEdgeLabel>.

The stage is enabled by default.

readonlyfinal

See Also

API
ports
Gets or sets whether a rerouting step is performed on all edges or just on a subset where distances are violated.
If only a subset of edges is rerouted, only those edges which cross nodes or come too close to a node are included. During rerouting, more bends are added to the edges that will be influenced by the repulsive forces.
Rerouting all edges will result in a more organic routing that considers the minimumDistances more closely. Disabling this feature, i.e., keeping the first calculated path will take less runtime.
final

Property Value

true if all edges are rerouted, false if only a subset is rerouted

Default Value

The default value is: false
Only edges being too close to nodes are rerouted.

Sample Graphs

ShownSetting: false

Methods

Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
This implementation checks the enabled state and when it's not enabled, will delegate to the coreLayout, directly. When the stage is enabled, all the work will be delegated to applyLayoutImpl, instead.
final

Parameters

graph: LayoutGraph
The graph to apply the layout to.
Performs the organic routing of the edges of the input graph.
The given graph will not be copied during the edge routing process and the result will be immediately applied to the input graph.
protected

Parameters

graph: LayoutGraph
the input graph
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrganicEdgeRouter.
The generic type arguments of the created layout data are compatible with instances of LayoutGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.

Parameters

graph: LayoutGraph
the graph that determines the generic type arguments of the created layout data

Return Value

OrganicEdgeRouterData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
an instance of layout data that can be used to perform item-specific configurations for the given OrganicEdgeRouter.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrganicEdgeRouter.
The generic type arguments of the created layout data are compatible with instances of IGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.

Parameters

graph?: IGraph
the graph that determines the generic type arguments of the created layout data

Return Value

OrganicEdgeRouterData<INode, IEdge, ILabel, ILabel>
an instance of layout data that can be used to perform item-specific configurations for the given OrganicEdgeRouter.