Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.


How are edges ordered during edge routing?

0 votes
I'm using the Channel Edge Router to clean up my edges.

It's very good at neatening up the edges, but I can't figure why it keeps swapping the relative placement of some of the edges.

For example, I have two edges running back & forth between the same two nodes and I put them in a specific order (one higher than the other on the screen), and then when I run the edge router, it swaps them round.

Can anyone tell me what parameters the algorithm is using to determine relative placement, or if I can avoid this by using one of the other edge routing algorithms?
in Help by (320 points)

1 Answer

+1 vote
Best answer

Edge routing algorithms usually use complex strategies to determine relative edge placements.

However, in the case of channel edge router, it is possible to force the algorithm to keep the exact port coordinates of some or all edges and only adjust the path between ports. (In this context, port means the connection point of an edge at a node.) To do so, first select the edges in question. Then use "Tools" -> "Constraints" -> "Port Constraints" to assign source and target port constraints from sketch:

Click "Ok", then run channel edge router.

Note the "Remove all Port Constraints" option. If you later on decide to rearrange the same diagram again, but you do not care for port constraints anymore, you need to remove the constraints by running the tool again with said option selected.

Since this approach fixes the existing ports, you may need to manually adjust ports before running channel edge router. To adjust a port, select an edge and either use the "Source Port X", "Source Port Y", "Target Port X", and "Target Port Y" properties of the edge to specify exact coordinates (relative to the center of the corresponding node) or use the mouse to drag the small black squares at the end of the edges to the desired location.

by [yWorks] (161k points)
selected by
Excellent - thanks Thomas - exactly what I needed - really appreciate the detailed explanation!
Legal Disclosure | Privacy Policy