OrganicEdgeRouter produces extreme bends

Troubleshooting

Summary

This article describes a problem which might occur when OrganicEdgeRouter shall route edges inside graphs, where nodes are close to each other and shows how to avoid it.

This article was written for an older version. It is only online as a reference for customers using this old version. The information it contains is probably out of date.

The latest information can be found in the yFiles documentation

Description

For OrganicEdgeRouter to function properly it has to be guaranteed that nodes are at least approximately twice as far away from each other as the minimal edge distance, which has been set for this algorithm. If this is not the case this might lead to very long edges and extreme bends.
To achieve the right behavior, one can prepend a layout stage which is provided by OrganicEdgeRouter's method createNodeEnlargementStage() in combination with a stage that removes node overlaps as the core of this layouter.

The following code snippet shows how to prepend these stages to the router:

OrganicEdgeRouter router = new OrganicEdgeRouter();

CompositeLayoutStage cls = new CompositeLayoutStage();
cls.appendStage(router.createNodeEnlargementStage());
cls.appendStage(new BendConverter());
cls.appendStage(new RemoveOverlapsLayoutStage(0));

router.setCoreLayouter(cls);
//router.doLayout(myGraph);
Since version 2.7 of yFiles for Java, "bad" edges are automatically detected and relayouted. Hence, using the above layout stages is not necessary. However omitting the stages may introduce overlaps among nodes and edges.

Categories this article belongs to:
yFiles for Java > yFiles Layout > Automatic Graph Layout > Organic Edge Routing
Applies to:
yFiles for Java 2: 2.4, 2.5, 2.6
Keywords:
OrganicEdgeRouter - route - edges - edge - bends - organic - router