Skip to content

Instantly share code, notes, and snippets.

@dumbs
Created October 31, 2011 10:54
Show Gist options
  • Save dumbs/1327276 to your computer and use it in GitHub Desktop.
Save dumbs/1327276 to your computer and use it in GitHub Desktop.
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,snakes,calc,chains,arrows}
\begin{document}
\begin{figure}[h!]
\begin{tikzpicture}[
state/.style={draw,circle,scale=1.5,fill=green!40},
action/.style={draw,circle,fill=red!50},
transition/.style={-latex}
]
\node[state] (S2) {$S_{2}$};
\node[state,above left=5cm of S2] (S0) {$S_{0}$};
\node[state,above right=4.5cm of S2] (S1) {$S_{1}$};
\node[right=1.5cm of S2] (A21) {};
\node[action,above=0.1cm of A21.center] (a21) {$a_{1}$};
\node[left=0.7cm of S2] (A20) {};
\node[action,above=0.8cm of A20.center] (a20) {$a_{0}$};
\node[below=1cm of S0] (A00) {};
\node[action,left=0.01cm of A00.east] (a00) {$a_{0}$};
\node[right=2cm of S0] (A01) {};
\node[action,below=0.2cm of A01] (a01) {$a_{1}$};
\node[left=2cm of S1] (A10) {};
\node[action,below=0.2cm of A10.east] (a10) {$a_{0}$};
\node[below=1.2cm of S1] (A11) {};
\node[action,left=0.5cm of A11] (a11) {$a_{1}$};
\draw[transition] (S2) to[bend right=5] (a20);
\draw[transition] (a20) to[out=190,in=180] (S2);
\draw[transition] (S0.south) to[bend left=30] (a00.60);
\draw[transition] (a00) to[out=160,in=200] (S0);
\draw[transition] (a20.135) to[bend right=10] (S0.315);
\draw[transition] (S0.east) to[bend left=10] (a01.150);
\draw[transition] (S2) to[out=355,in=250] (a21);
\draw[transition] (a21) to[out=95,in=30] (S2);
\draw[transition] (a21) to[out=10,in=300] (S1);
\draw[transition] (a00) to[out=270,in=200] (S2);
\draw[transition] (a01) to[out=280,in=100] (S2);
\draw[transition] (a10) to[out=200,in=70] (S2);
\draw[transition] (a11) to[out=200,in=50] (S2);
\draw[transition] (a11) to[out=180,in=225] (S1);
\draw[transition] (a10) to[out=120,in=90] (S1);
\draw[transition] (S1) to[out=160,in=30] (a10);
\draw[transition] (S1) to[out=280,in=30] (a11);
\draw[transition] (a10) to[out=165,in=30] (S0);
\draw[transition,looseness=2] (a21) to[out=270,in=180] (S0);
\end{tikzpicture}
\end{figure}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment