Question

Given the following code:

digraph q2a {
    rankdir=LR;
    s       [label="s"];
    0       [label="0"];
    00      [label="00"];
    001     [label="001"];
    0010    [label="0010"];
    00100   [label="00100"];
    001000  [label="001000"];
    0010001 [label="0010001",shape=doublecircle];
    s -> s              [label="1"];
    s -> 0              [label="0"]
    0 -> 00             [label="0"];
    0 -> s              [label="1"];
    { rank=same; 001 -> 00 [label="1",dir="back"] }
    00:s -> 00:s      [label="0"];
    { rank=same; 0010 -> 001 [label="0"] }
    001 -> s            [label="1"];
    0010 -> 00100       [label="0"];
    0010 -> s           [label="1"];
    { rank=same; 00100 -> 001000 [label="0"] }
    00100 -> 001        [label="1"];
    001000 -> 0010001   [label="1"];
    001000 -> 00        [label="0"];
    0010001 -> 0010001  [label="0,1"];
}

I get the following graph:

graph 1

Despite the fact that I set "001 -> 00 [label="1",dir="back"], the edge from 001 to 00 is still pointing forward.

If I remove the first line ("rankdir=LR"), I get the following graph:

graph 2

Now the edge from 001 -> 00 is correctly pointing back.

Is there any explanation for this behavior?

Was it helpful?

Solution

Same graph, different output here - this particular problem may be linked to your version of graphviz.

Using graphviz 2.31.20130312.0445, the direction of the links are correctly displayed, event with rankdir=LR.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top