| 1 |
/* |
| 2 |
|
| 3 |
:Title: Automata |
| 4 |
:Tags: TikZ, topath, tikzedgelabels |
| 5 |
|
| 6 |
An example of how to use TikZ' automata libray and to paths to |
| 7 |
create a pretty state machine. |
| 8 |
|
| 9 |
Generated with:: |
| 10 |
|
| 11 |
$ neato -Txdot tikzautomata.dot | dot2tex -ftikz > tikzautomata.tex |
| 12 |
|
| 13 |
*/ |
| 14 |
digraph G { |
| 15 |
d2ttikzedgelabels = true; |
| 16 |
d2tstyleonly = true; |
| 17 |
d2tdocpreamble = "\usetikzlibrary{automata}"; |
| 18 |
d2tfigpreamble = "\tikzstyle{every state}= \ |
| 19 |
[draw=blue!50,very thick,fill=blue!20]"; |
| 20 |
node [style="state"]; |
| 21 |
edge [lblstyle="auto",topath="bend left"]; |
| 22 |
A [style="state, initial"]; |
| 23 |
A -> B [label=2]; |
| 24 |
A -> D [label=7]; |
| 25 |
B -> A [label=1]; |
| 26 |
B -> B [label=3,topath="loop above"]; |
| 27 |
B -> C [label=4]; |
| 28 |
C -> F [label=5]; |
| 29 |
F -> B [label=8]; |
| 30 |
F -> D [label=7]; |
| 31 |
D -> E [label=2]; |
| 32 |
E -> A [label="1,6"]; |
| 33 |
F [style="state,accepting"]; |
| 34 |
} |