MA0301/exercise12/diagrams/ex3.tex

21 lines
823 B
TeX
Raw Normal View History

2021-05-03 01:06:04 +02:00
% https://www3.nd.edu/~kogge/courses/cse30151-fa17/Public/other/tikz_tutorial.pdf
\begin{tikzpicture}
\tikzset{
->, % makes the edges directed
>=Stealth, % makes the arrow heads bold
node distance=3cm, % 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, below of=s0] (s1) {$s_1$};
\node[state, accepting, right of=s0] (s2) {$s_2$};
\draw (s0) edge[right] node{b} (s1)
(s0) edge[above] node{a} (s2)
(s1) edge[loop below] node{a, b} (s1)
(s2) edge[bend left, right] node{a} (s1)
(s2) edge[loop above] node{b} (s2);
\end{tikzpicture}