Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you force rank on a node in dot?
    primarykey
    data
    text
    <p>I have a number of relatively simple (auto-generated) graphs in graphviz dot format. These show the path through a state machine, but dot has a slightly confusing habit of deciding that two nodes must be on the same rank when I would like the graph to be in state order. I've tried a lot of settings (including the <code>:n</code> and <code>:s</code> and the <code>weight</code> listed below), but I cannot persuade dot to place the Third State <b>above</b> the Fourth State.</p> <p>I have this problem with a lot of graphs: there seems to be something internal to dot that decides that it would be better if two nodes were on the same rank and there's nothing that can be done to override it. I've even had code that specifies that one node should be a <code>rank=sink</code>, but dot has decided to put another node below it anyway.</p> <p>Is there any way to suggest to dot that it's more important that the nodes are in order than any other constraint?</p> <p>The code that was used to generate the graph looks like this:</p> <pre><code>digraph { ERROR [label="Error"]; FirstSTATE [label="Initial State" URL="\ref FirstSTATE"]; FirstSTATE -&gt; SecondSTATE; SecondSTATE [label="Second State" URL="\ref SecondSTATE"]; SecondSTATE -&gt; ThirdSTATE; ThirdSTATE [label="Third State" URL="\ref ThirdSTATE"]; FourthSTATE [label="Fouth State?" shape="diamond"]; ThirdSTATE:s -&gt; FourthSTATE:n [weight=50]; FourthSTATE -&gt; FifthSTATE [label="Yes" ]; FourthSTATE -&gt; ThirdSTATE [label="No"]; FifthSTATE [label="Fifth State" URL="\ref FifthSTATE"]; SixthSTATE [label="Sixth State?" shape="diamond"]; SixthSTATE -&gt; ERROR [label="Yes" ]; SixthSTATE -&gt; SeventhSTATE [label="No"]; FifthSTATE -&gt; SixthSTATE; SeventhSTATE [label="Seventh State" URL="\ref SeventhSTATE"]; SeventhSTATE -&gt; EighthSTATE; EighthSTATE [label="Eighth State" URL="\ref EighthSTATE"]; NinthSTATE [label="Ninth State?" shape="diamond"]; NinthSTATE -&gt; TenthSTATE [label="Yes" ]; NinthSTATE -&gt; EighthSTATE [label="No"]; EighthSTATE -&gt; NinthSTATE; TenthSTATE [label="Tenth State" URL="\ref TenthSTATE"]; EleventhSTATE [label="Eleventh State?" shape="diamond"]; EleventhSTATE -&gt; ERROR [label="Yes" ]; EleventhSTATE -&gt; TwelfthSTATE [label="No" ]; TenthSTATE -&gt; EleventhSTATE; TwelfthSTATE [label="Twelfth State" URL="\ref TwelfthSTATE"]; } </code></pre> <p>The graph currently looks like this: <img src="https://i.stack.imgur.com/YfbIC.png" alt="Dot Graph"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload