Search code examples
graphviz

Earlier graphviz rank


In the following graph, is there an attribute I can set that would render A and H on the same rank; and D and G on the same rank? For my use case, each node is a process that will begin as soon as the incoming node processes have completed and I would like the position of the node to indicate the start time.

digraph {
    A -> B
    B -> C
    H -> C
    C -> D
    D -> E
    E -> F
    C -> G
    G -> F
}

digraph

I would like the result to look like the following, but as these graphs are dynamically generated, I do not want to have to calculate which nodes I should be marking as the same rank.

digraph {
    { rank="same"; A; H }
    { rank="same"; D; G }
    A -> B
    B -> C
    H -> C
    C -> D
    D -> E
    E -> F
    C -> G
    G -> F
}

digraph-ideal


Solution

  • What you are looking for exists as a setting in Flying Logic software and is called bias there.

    Unfortunately, at the time of my answer (March 2021) this doesn't exist. Please see the answer from one of the long-time maintainers to my question on twitter. https://twitter.com/Graphviz/status/1128339044826517508?s=20