\documentclass[tikz]{standalone} \usepackage{tikz} \begin{document} \usetikzlibrary{automata,positioning} \iffalse $S = $ TCATCATT The suffix language of $S$ is $\{TCATCATT, CATCATT, ATCATT, TCATT, CATT, ATT, AT, T\}$. \fi \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid, auto] \node[state, initial] (q_0) {$q_{0}$}; \node[state,right=of q_0,accepting] (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,right=of q_6] (q_7) {$q_{7}$}; \node[state,right=of q_7,accepting] (q_8) {$q_{8}$}; \path[->] (q_0) edge node {T} (q_1) (q_1) edge node {C} (q_2) (q_2) edge node {A} (q_3) (q_3) edge node {T} (q_4) (q_4) edge node {C} (q_5) (q_5) edge node {A} (q_6) (q_6) edge node {T} (q_7) (q_7) edge node {T} (q_8); % CATCATT \path[->] (q_0) edge[bend right=40] node {C} (q_2); % ATCATT \path[->] (q_0) edge[bend right=50] node {A} (q_3); % TCATT \path[->] (q_4) edge[bend right=30] node {T} (q_8); % CATT % ATT %\path[->] (q_0) edge[bend right=50] node {A} (q_6); % TT \path[->] (q_1) edge[bend left=30] node {T} (q_8); \end{tikzpicture} \end{document}