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
allowEdgeNodeOverlaps | true | Edges are allowed to cross nodes. |
allowMovingNodes | false | Nodes are not moved. |
considerExistingBends | false | Bends in the input graph are not considered for edge routing. |
keepExistingBends | false | Bends coordinates in the input graph are not kept fixed. |
minimumDistance | 10 | |
routeAllEdges | false | Only edges being too close to nodes are rerouted. |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new OrganicEdgeRouter with the given coreLayout.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the core layout algorithm
- allowEdgeNodeOverlaps - boolean
- Whether or not edges are allowed to cross nodes. This option sets the allowEdgeNodeOverlaps property on the created object.
- allowMovingNodes - boolean
- Whether nodes are allowed to move, which can increase the routing quality and reduce the probability of overlaps between nodes and edges. This option sets the allowMovingNodes property on the created object.
- minimumDistance - number
- The minimum distance the algorithm should guarantee between nodes and non-incident edges. This option sets the minimumDistance property on the created object.
- keepExistingBends - boolean
- Whether or not the initial bend coordinates are kept when determining the edge path. This option sets the keepExistingBends property on the created object.
- considerExistingBends - boolean
- Whether or not the initial bend coordinates influence the path routing such that the calculated routes tend to have a similar overall shape. This option sets the considerExistingBends property on the created object.
- routeAllEdges - boolean
- Whether a rerouting step is performed on all edges or just on a subset where distances are violated. This option sets the routeAllEdges property on the created object.
- enabled - boolean
Properties
Gets or sets whether or not edges are allowed to cross nodes.
Remarks
Default Value
true
.Edges are allowed to cross nodes.
Property Value
true
if edge-node overlaps are allowed, false
otherwiseSee Also
Sample Graphs
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.
Remarks
Default Value
false
.Nodes are not moved.
Property Value
true
if nodes are allowed to move a bit to increase the routing quality, false
otherwiseSee Also
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.
Remarks
Default Value
false
.Bends in the input graph are not considered for edge routing.
Property Value
true
if the existing bends are considered, false
otherwiseGets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Default Value
null
.Property Value
See Also
Implements
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
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.
See Also
Implements
Gets or sets whether or not the initial bend coordinates are kept when determining the edge path.
Remarks
Default Value
false
.Bends coordinates in the input graph are not kept fixed.
Property Value
true
if the initial bend coordinates are kept, false
otherwiseSee Also
Sample Graphs
Gets or sets the minimum distance the algorithm should guarantee between nodes and non-incident edges.
Remarks
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.
Default Value
10
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given minimum distance is negative
See Also
Sample Graphs
10
.Gets a LayoutStageBase that provides support for EdgePortCandidates, NodePortCandidates or port groups ids.
Remarks
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.
See Also
Gets or sets whether a rerouting step is performed on all edges or just on a subset where distances are violated.
Remarks
Default Value
false
.Only edges being too close to nodes are rerouted.
Property Value
true
if all edges are rerouted, false
if only a subset is reroutedSample Graphs
Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
See Also
Implements
Performs the organic routing of the edges of the input graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
createLayoutData
(graph: LayoutGraph) : OrganicEdgeRouterData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the OrganicEdgeRouter.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪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.
Remarks
Parameters
A map of options to pass to the method.
- graph - IGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪OrganicEdgeRouterData<INode,IEdge,ILabel,ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given OrganicEdgeRouter.
LayoutExecutor
type is available at runtime.