Quick Guide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| digraph finite_state_machine {
rankdir=LR;
size="8,5"
node [shape = circle ]; q0, q1, q2
node [shape = doublecircle]; q3
node [shape = point ]; qi
qi -> q0;
q0 -> q0 [ label = "0, 1" ];
q0 -> q1 [ label = "1" ];
q1:n -> q2 [ label = "0" ];
q1:s -> q2 [ label = "ε" ];
q2 -> q3 [ label = "1" ];
q3 -> q3 [ label = "0, 1" ];
}
|
Command:
1
| dot -Tpng in.gv -o out.png
|
Reference links:
Force Positions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| digraph finite_state_machine {
rankdir=LR;
size="10,6"
node [shape = circle pos="0,3!" label="{phi}"]; q0
node [shape = circle pos="2,3!" label="{1}"]; q1
node [shape = circle pos="4,3!" label="{2}"]; q2
node [shape = circle pos="6,3!" label="{1,2}"]; q3
node [shape = circle pos="0,0.9!" label="{3}"]; q4
node [shape = circle pos="2,1!" label="{1,3}"]; q5
node [shape = circle pos="4,0.9!" label="{2,3}"]; q6
node [shape = circle pos="6,1!" label="{1,2,3}"]; q7
node [shape = point pos="1.5,1.5!"]; qi
qi -> q5;
q0:nw -> q0 [ label="a, b" ];
q1 -> q0 [ label="a" ];
q1 -> q2 [ label="b" ];
q2 -> q4 [ label="b" ];
q2 -> q6 [ label="a" ];
q3 -> q6 [ label="a, b" ];
q4 -> q0 [ label="b" ];
q4 -> q5 [ label="a" ];
q5 -> q2 [ label="b" ];
q5:e -> q5:e [ label="a" ];
q6:s -> q4:s [ label="b" ];
q6 -> q7 [ label="a" ];
q7:sw -> q6 [ label="b" ];
q7:n -> q7 [ label="a" ];
}
|
Command:
1
| dot -Kfdp -Tpng in.gv -o out.png
|
Reference Links:
https://stackoverflow.com/questions/5343899/how-to-force-node-position-x-and-y-in-graphviz
https://graphviz.org/docs/nodes/