问题
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
回答1:
How to put all the leaves on the bottom (max) rank ?
You may include a subgraph containing all the leave nodes and add the attribute rank=max:
{
rank=max;
leaf1; leaf2; leaf3;
}
This should place all your leaf-nodes on the bottom.
回答2:
I ended up changing the algorithm that generates the graphviz to place several { rank = same; ... }
items in the output
来源:https://stackoverflow.com/questions/47396374/how-can-i-achieve-strict-reverse-ranking-of-graphviz-dot