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.

Categories

Center edge anchors while maintaining orthogonality.

0 votes

I have a large graph with sometimes too many edges attaching to nodes (hard to read). Simple example: 

Screenshot of too many parallel edges on nodes - want to combine by centering anchors.

I am trying to center all edge anchors [Select All Edges → Properties → Ports: change all to 0]. But it skews/slopes the segment attached to that port, creating non-orthogonal edges:Screenshot of non-orthogonal centered edge anchors via Properties→Ports.

Is there a way to do this while maintaining orthogonality? Desired result:

Screenshot of desired result - anchors are centered and orthogonality is maintained.

Also, can this option to center all anchors be enabled when choosing a layout?

ATTEMPTS:
○ Fixing afterwards: [Layout → Edge Routing ...] does not work, because my graph is too large (> 2000 nodes, > 5000 edges) - it keeps calculating for over 10 minutes - should I wait longer?
○ [Preferences → Editor tab → Center Edge Anchors] only works for manually creating edges. Does not apply when changing layout, or importing graph from Excel.

Thank you very much for your time.

in Help by (350 points)

1 Answer

0 votes

Re:

Is there a way to do this while maintaining orthogonality?

Yes, there is. Do not adjust all edges at once, but work in four steps:

  1. Select all edges whose first segment connects to the top or bottom of the source node. Set "Source Port Y" to "0".
  2. Select all edges whose first segment connects to the left or right of the source node. Set "Source Port X" to "0".
  3. Select all edges whose last segment connects to the top or bottom of the target node. Set "Target Port Y" to "0".
  4. Select all edges whose last segment connects to the left or right of the target node. Set "Target Port X" to "0".

May I ask why you want to move the ports to the center of the node?

Re:

Also, can this option to center all anchors be enabled when choosing a layout?

Unfortunately, no.
 


 

by [yWorks] (130k points)
Thomas, I appreciate your time and promptness. However, I need to do that which your answer tries to avoid - I want the vertical first&last segments to center on X, and horizontal segments - on Y. In other words, I am trying to combine the ports.

As I said initially, I have too many edges attaching to nodes which makes the graph hard to read. So I want to align/combine all the segments that attach to nodes.

Example from my screenshots above: 1st image, left node, top side - I want to slide the 4 segments into a single line → see the result in 3rd image.

Thank you very much for the additional information and the new screenshot.

I have to admit that I completely misunderstood what you wanted to do. The good news is, yEd offers several ways to achieve the desired result.

  1. With Hierarchic Layout, enable "Automatic Edge Grouping" on tab "Edges" in the hierarchic layout settings.
  2. For Hierarchic Layout or Orthogonal/Polyline Edge Routing explicitly define edge groups. More specifically, use "Tools" -> "Constraints" -> "Edge Grouping" prior to running the layout or routing algorithm with the following settings:
    "Configuration Method": "Enter Manually"
    "Group Id at Source": 1
    "Group Id at Target": 2
    "Act on": "All ports"
    The actual group ID values do not really matter. Just make sure to enter two different values.
    Finally, run the constraints tool once more with option "Remove all Grouping Constraints" enabled to prevent the constraints from affecting future layout runs.
  3. Arrange your diagram with hierarchic layout. Select all edges and set all source and target ports to "0.0". Use "Tools" -> "Constraints" -> "Port Constraints" with the following settings:
    "Configuration Method": "From Sketch"
    "Fix Source Port": enabled
    "Fix Target Port": enabled
    "Act on": "All Ports"
    Run hierarchic layout once more or run orthogonal/polyline edge router.
    Finally, run the constraints tool once more with option "Remove all Port Constraints" enabled to prevent the constraints from affecting future layout runs.

Hope this helps.

Legal Disclosure | Privacy Policy
...