问题
This is a follow-up question to How can I achieve strict reverse ranking of graphviz dot?, but a little easier. This graph is contrived, but demonstrates the problem:
digraph nfa {
A -> B
B -> C
C -> D
D -> E
A -> F
F -> E
}
Nodes B and F are the same rank, but they are not displayed at the same rank. How can achieve this?
回答1:
I used subgraphs with rank = same
, and manually computed the ranks and grouped them in said subgraphs.
digraph {
{ rank = same; A }
{ rank = same; B; F }
{ rank = same; C }
{ rank = same; D }
{ rank = same; E }
A -> B
B -> C
C -> D
D -> E
A -> F
F -> E
}
来源:https://stackoverflow.com/questions/47416827/align-ranks-in-graphviz