Reputation: 4283
Edit: If posted a new question to supersede this question. Align Ranks in Graphviz
First, let me apologize for inventing/abusing some terminology in the title. By "strict" I mean all nodes of the same rank need the same y position in the output image, whereas by default they are shifted around slightly. Second, by "reverse" I mean all the leafs are the same rank, appearing at the same row at the bottom of the graph, and all of their ancestors to be ranked and aligned accordingly (without reversing the edge directions). The graphs I'm working with are bounded semilattices, so there's no cyclical portions and all nodes have a well defined rank.
I tried reversing the edge direction (and "dir=back" can make the edges look like the original direction), but the "strict" part is still a problem
Upvotes: 1
Views: 1398
Reputation: 6773
The TBbalance attribute TBbalance=max (https://graphviz.org/docs/attrs/TBbalance/), (in conjunction with rank=max) should do just what you want.
rank=max to bring the terminal nodes to the bottom, and TBbalance=max to bring all ancestors to the maximal possible rank.
FYI, TBbalance has only been available for a year or so.
Upvotes: 2
Reputation: 4283
I ended up changing the algorithm that generates the graphviz to place several { rank = same; ... }
items in the output
Upvotes: 1