Reputation: 2801
First time DOT
/GraphViz user here. I have the following graph
digraph G {
rankdir=LR;
"START" -> "A" -> "B" -> "A" -> "C" -> "A" -> "END"
"START" -> "A" -> "C" -> "A" -> "B" -> "A" -> "END"
}
that gets rendered like this
whereas I'd like it to be rendered like this
How do I express that in DOT
?
Upvotes: 4
Views: 981
Reputation: 7659
This is exactly the same as @rakwaht suggested and you accepted already, just written more concisely - I don't think this is a nightmare:
digraph G{
START [label="START"];
A1, A2, A3 [label="A"];
B1, B2 [label="B"];
C1, C2 [label="C"];
END [label="END"];
START-> A1 -> { B1 C1 } -> A2 -> { B2 C2 } -> A3 -> END
}
Upvotes: 2
Reputation: 3967
In Graphviz you cannot have more then one state with the same ID. However you can create a graph where the IDs of the states are different but their label is the same.
In order to build the graph you want I would try with something like this:
digraph G{
START [label="START"];
A1 [label="A"];
A2 [label="A"];
A3 [label="A"];
B1 [label="B"];
B2 [label="B"];
C1 [label="C"];
C2 [label="C"];
END [label="END"]
START->A1
A1->B1
A1->C1
B1->A2
C1->A2
A2->B2
A2->C2
B2->A3
C2->A3
A3->END
}
That defines different states with the same name (label) displayed. Here you can see the result:
Upvotes: 2