\documentclass[12pt]{beamer}

% color theme
\usetheme{psu}
\usecolortheme[RGB={0,38,93}]{structure}

% For fancy fonts
\usepackage{fontspec}
\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text}
\setmainfont[Ligatures={Common}, Numbers={OldStyle}]{Cambria}
\setsansfont[Scale=0.95]{Candara}
\setromanfont{Cambria}
\setmonofont{Monaco}

\usepackage{tikz}
\usetikzlibrary{arrows,automata}

\begin{document}

\begin{frame}
  \frametitle{Deterministic Finite Automaton}
  \begin{figure}[h]
    \begin{tikzpicture}[
        % type of arrow head
        >=stealth',
        % keep arrow head from touching the surface
        shorten >= 1pt,
        % automatic node positioning
        auto,
        %                                   
        node distance=2cm,
        % line thickness
        semithick,
        bend angle=15,
        % text for the initial state arrow. I left it as blank
        initial text=]
      \tikzstyle{every state}=[draw=blue!50, thick, fill=blue!20]
      
      \node[state,initial](qe){$q_\epsilon$};
      \node[state,accepting](q0)[above right of=qe]{$q_0$};
      \node[state](q1)[below right of=qe]{$q_1$};
      \node[state](q2)[right of=q0]{$q_2$};
      \node[state,accepting](q3)[right of=q1]{$q_3$};
      \node[state](q4)[below right of=q2]{$q_4$};
      
      \path[->]
      (qe) edge [above left] node {0} (q0)
      (qe) edge [below left] node {1} (q1)
      
      (q0) edge [loop above] node {0} ()
      (q0) edge [left] node {1} (q1)
      
      (q1) edge [above left] node {0} (q2)
      (q1) edge [bend left] node {1} (q3)
      
      (q2) edge [above right] node {0} (q4)
      (q2) edge [above] node {1} (q0)
      
      (q3) edge [bend left] node {0} (q1)
      (q3) edge [right] node {1} (q2)
      
      (q4) edge [below right] node {0} (q3)
      (q4) edge [loop right] node {1} ();
    \end{tikzpicture}    
  \end{figure}
\end{frame}
\end{document}
Comments Off on Deterministic Finite Automaton