Closed saulshanabrook closed 3 weeks ago
You can solve this by putting the edge in the correct hierarchy level as seen here. This issue is already tracked https://github.com/eclipse/elk/issues/901but it seems to be a bigger effort to fix this.
Thank you.
So it looks for all the edges, if they go from a child to it's parent node, they have to be in the parent node. But if they go from a child of one node to a different parent container, they should be in the outer root node.
I am re-opening this because I realize I would like the edge to leave the compound node then come back and connect to the port from the outside.
Is this possible currently? So like the original code I posted, but just instead of leaving and going to a very far away place, it just goes out a little bit then comes back, sort of like this self loop example, but where the target port is on the parent node https://rtsys.informatik.uni-kiel.de/elklive/examples.html?e=general%2Fspacing%2Flabels
To give more context, I am trying to make a layout that is suitable for visualizing e-graphs
Here is a manually laid out e-graph:
And the same e-graph with an automatic ELK layout (shown here using my custom renderer with React Flow, but the layout is the same as the ELK Live editor):
All edges go from an e-node to an e-class, so I have "elk.hierarchyHandling": "INCLUDE_CHILDREN"
set.
However, as you can see, this causes edges to cross and stay in their e-class. Instead, they should leave the e-class as soon as possible. It doesn't make sense for it to grow to accommodate the size of any edge movements. I asked @soerendomroes about this on Gitter and said that maybe I shouldn't use INCLUDE_CHILDREN
:
Additionally, the size may increase if we have edge crossings in a compound node. This is why I typically not use INCLUDE_CHILDREN and rather use explicit ports to break the hierarchical edges in two and control the order of nodes and ports in the compound node
I am open to any ideas here. Would the suggestion here be then to create two edges, one from the node to the edge of their compound node, then from that port to the destination compound node? If so, can I have ELK position those ports automatically where they need to go?
Thank you for your support and for sharing this library!
I think your issue may be that the port and edge spacing might be different in this example.
Wow, setting "elk.spacing.portPort": "0"
in the compound nodes fixed the weird bends, thank you!
Now the only remaining thing is how to get the self edge from an inner node to an outer to node to actually leave the node and come back around instead of going from the inside. That will also make the compound nodes smaller still by not having that edge inside:
If I understand your request correctly, you need explicit ports for this, as shown here.
Thank you! That seemed to do.
I appreciate all of your help with this, it's looking a lot more reasonable now:
I am still getting some odd behavior with the ports that I can't seem to figure out. I would like the edges not to be merged, so that each incoming edge to an e-class can connect to the e-class wherever fits best with the layout instead of having to be combined into one location. I tried to accomplish this by making separate ports for each edge, but it still seems to combine them, but only some of the time.
This seems to compound for larger graphs, where multiple edges from a single e-class have the same destination, and then we get the issue where they combine in the class, instead of exiting through different ports:
I thought that by making separate ports for edge edge, and making two edges, it would fix this, but they seem to be combined for some reason. There was this existing issue on port's being overlapping in the layered layout but it was fixed previously https://github.com/eclipse/elk/issues/316
I am happy to make a new issue for this, if you would prefer instead of me re-opening this one.
I managed to resolve this by turning off "elk.hierarchyHandling": "INCLUDE_CHILDREN"
and laying out each e-class separately. Sorry for all the noise here, hopefully this can be useful to someone else in the future.
Describe the bug
When I try to lay out graphs with edges that go from a child node to the parent node, the edge for some reason also travels to the top left of the screen first. I have created a minimal example to reproduce this:
ELKLive link
Is there a way I can tweak my layout options or my graph in order to get better edge routing behavior here? I notice it is the case regardless of the edge routing strategy.
Expected behavior
The edge routing should place the edge back to the parent node, without stopping first at the top left of the screen.
Screenshots
ELK Version @latest 0.9.3
Additional context
here is a larger realistic example that shows off this issue as well