MA0301/exam_template/graphics/example2.tex

23 lines
855 B
TeX
Raw Normal View History

2021-05-10 17:41:58 +02:00
\begin{tikzpicture}
\tikzset{
->, % makes the edges directed
>=Stealth, % makes the arrow heads bold
node distance=5cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=white}, % sets the properties for each state node
initial text=$ $, % sets the text that appears on the start arrow
}
\node[state, initial] (s0) {$s_0$};
\node[state, right of=s0] (s1) {$s_1$};
\node[state, accepting, right of=s1] (s2) {$s_2$};
\node[state, right of=s2] (s3) {$s_3$};
\draw (s0) edge[above] node{$a$} (s1);
\draw (s0) edge[bend left, above] node{$b$} (s3);
\draw (s1) edge[loop,below] node{a} (s1);
\draw (s1) edge[above] node{$b$} (s2);
\draw (s2) edge[loop,below] node{b} (s2);
\draw (s2) edge[above] node{$a$} (s3);
\draw (s3) edge[loop,above] node{a,b} (s3);
\end{tikzpicture}