63 lines
1.6 KiB
TeX
63 lines
1.6 KiB
TeX
|
\documentclass[tikz]{standalone}
|
||
|
|
||
|
\usepackage{tikz}
|
||
|
|
||
|
\begin{document}
|
||
|
\usetikzlibrary{automata,positioning}
|
||
|
|
||
|
\iffalse
|
||
|
$S = $ AACTACT
|
||
|
The suffix language of $S$ is $\{S, ACTACT, CTACT, TACT, ACT, CT, T\}$.
|
||
|
|
||
|
\fi
|
||
|
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid, auto]
|
||
|
% TODO
|
||
|
\node[state, initial] (q_0) {$q_{0}$};
|
||
|
\node[state,right=of q_0] (q_1) {$q_{1}$};
|
||
|
\node[state,right=of q_1] (q_2) {$q_{2}$};
|
||
|
\node[state,right=of q_2] (q_3) {$q_{3}$};
|
||
|
\node[state,right=of q_3] (q_4) {$q_{4}$};
|
||
|
\node[state,right=of q_4] (q_5) {$q_{5}$};
|
||
|
\node[state,right=of q_5] (q_6) {$q_{6}$};
|
||
|
\node[state,accepting,right=of q_6] (q_7) {$q_{7}$};
|
||
|
|
||
|
% Fix for CT
|
||
|
\node[state,below=of q_2] (q_8) {$q_{8}$};
|
||
|
\node[state,right=of q_8,accepting,yshift=-2cm] (q_9) {$q_{9}$};
|
||
|
|
||
|
% Fix for T
|
||
|
% \node[state,above=of q_2,yshift=2cm,accepting] (q_10) {$q_{10}$};
|
||
|
% S itself
|
||
|
\path[->] (q_0) edge node {A} (q_1)
|
||
|
(q_1) edge node {A} (q_2)
|
||
|
(q_2) edge node {C} (q_3)
|
||
|
(q_3) edge node {T} (q_4)
|
||
|
(q_4) edge node {A} (q_5)
|
||
|
(q_5) edge node {C} (q_6)
|
||
|
(q_6) edge node {T} (q_7);
|
||
|
|
||
|
% First suffix: ACTACT
|
||
|
\path[->] (q_1) edge[bend left=30] node {C} (q_8)
|
||
|
(q_9) edge[bend right=30] node {A} (q_5);
|
||
|
|
||
|
% Second suffix: CTACT
|
||
|
\path[->] (q_0) edge[bend right=30] node {C} (q_8)
|
||
|
(q_8) edge node {T} (q_9);
|
||
|
|
||
|
% Third suffix: TACT
|
||
|
% \path[->] (q_0) edge[bend left=30] node {T} (q_10)
|
||
|
%(q_10) edge[bend left=30] node {A} (q_5);
|
||
|
|
||
|
|
||
|
% Fourth suffix: ACT
|
||
|
% \path[->] (q_)
|
||
|
|
||
|
% Fifth suffix: CT
|
||
|
|
||
|
% Fix for T
|
||
|
\path[->] (q_0) edge[bend right=40] node {T} (q_9);
|
||
|
|
||
|
\end{tikzpicture}
|
||
|
|
||
|
\end{document}
|