-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoidable Crossing, while respecting the tailport and headport #1263
Comments
Technically, this isn't a bug, as dot can only promise to reduce crossings, not eliminate them. For directed acyclic graphs, minimizing crossings is NP-complete, so dot uses a heuristic. On the other hand, part of the heuristic does some local optimization, and I'm surprised it didn't catch this. |
I called it a bug, because it was too obvious to avoid the crossing. I hope someone can enhance the heuristic. |
Yes, I agree that the crossing seems to be a bug, since local optimization should
detect that exchanging the virtual node for the middle of the red edge with the
rectangular node labeled (3,6) that is adjacent in the same level would decrease crossings.
It might be more fruitful to improve the debugging framework of the mincross phase
or perform a light overhaul of its whole structure, than to chase this particular bug.
About this 3D to 2D projection technique: I think you are saying that you can find
a crossing-free projection. This idea was explored in the graph layout community
over 15 years ago; see https://cs.brown.edu/~rt/gdhandbook/chapters/3d.pdf <https://cs.brown.edu/~rt/gdhandbook/chapters/3d.pdf>
(p. 478, “Good Viewpoints”) and they studied variants of the same problem.
I am not sure if this work had much practical impact so far.
Stephen North
|
It does look like a bug... but if you need a work-around, removing some of the forcing elements seems to help.. |
Sorry, the function I was talking about is inverse function and not identity. In other words, p and q are inverse of each other under df (depth-first), i.e. df(p) = q and df(q) = p. Enis |
I'm not understanding your approach. How do the position information and edge properties specify the drawing? In particular, the routing of the back edge 6->2 can got either to the left or the right of node 5 and satisfy the edge properties, unless by "precede" you mean an edge must be to the left of the entire other edge. As to the node positions, they produce a fairly unattractive drawing that wastes too much space. These are common traits of layout algorithms that try to guarantee planarity or few bends or ... This is probably the reason behind Stephen's comment that such approaches haven't had much practical impact so far. Graphviz does allow you to just use the rendering engine by running either neato -n or neato -n2. The former assumes you have supplied the node positions. It does the edge routing based on the value of the splines attribute. (Of course, this degree of freedom could still introduce edge crossings.) neato -n2 assumes you have also supplied the edge routing. A nice compromise would be to allow the user to specify the graph layout topology (nodes ordered in ranks; edges specifying where they cross each rank) and then feed this to the dot phase that determines the actual node positions. This would produce a more aesthetic layout while honoring the given topology. I started to implement this once, but gave up when I realized how complicated it would be. |
I think I brought some confusion to the discussion. My aim is to have a drawing, which makes the causal relationship among nodes as comprehensible as possible. Having this in mind:
This approach should come close to the compromise you mentioned, I hope. What if the digraph is not plane, i.e. the edges unavoidably cross each other. One can still achieve edge-crossing in an orderly manner. I’ll try to explain what I mean in another comment. |
This seems to be a bug. The edge from (6,2) to (2,3) should be drawn left to (3,6). This would avoid the crossings.
Here is the drawing:
Here is the ".dot" file:
Proc.dot.txt
Thanks, Enis
The text was updated successfully, but these errors were encountered: