OrganicEdgeRouter produces extreme bends
Applies to: yFiles for Java 2.6, yFiles for Java 2.5, yFiles for Java 2.4 print article email article

Type: Troubleshooting

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.

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);
Note
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.

Keywords: OrganicEdgeRouter - route - edges - edge - bends - organic - router

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2008 yWorks · ALL RIGHTS RESERVED imprint | top | home