Align Ranks in Graphviz

Viewed 1197

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?

enter image description here

1 Answers

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
}
Related