\documentclass{standalone} \usepackage[dvipsnames,svgnames,table]{xcolor} \usepackage{tikz} \usetikzlibrary{automata, positioning, arrows, shapes, shapes.gates.logic, shapes.gates.logic.US} \begin{document} \begin{tikzpicture}[node distance=1.8cm] \tikzstyle{SEQ}=[diamond] \tikzstyle{NULL}=[trapezium, trapezium left angle=120, trapezium right angle=120, minimum size=8mm] \tikzstyle{AND}=[and gate US, rotate=90 ] \tikzstyle{OR}=[or gate US, rotate=90 ] \tikzset{every node/.style={ultra thick, draw=red, minimum size=6mm}} \node[draw=red, SEQ, xshift=0.000000cm ] (a_1) {\ensuremath{\mathtt{a_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=7mm] at (a_1.east) {\small{\ensuremath{\mathtt{level}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=7mm] at (a_1.west) {\small{\ensuremath{\mathtt{depth}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (a_1.east) {\small{\ensuremath{\mathtt{0}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (a_1.west) {\small{\ensuremath{\mathtt{5}}}}; \node[draw=red, AND, logic gate inputs=nn, xshift=-0.000000cm , yshift=4mm, below = 1.4cm of a_1.south] (a') {\rotatebox {-90}{\ensuremath{\mathtt{a'}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (a'.south) {\small{\ensuremath{\mathtt{1}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (a'.north) {\small{\ensuremath{\mathtt{4}}}}; \draw[solid] (a_1) edge (a'.east); \node[draw=red, SEQ, xshift=-1.250000cm , below of=a'] (b_1) {\ensuremath{\mathtt{b_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (b_1.east) {\small{\ensuremath{\mathtt{1}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (b_1.west) {\small{\ensuremath{\mathtt{4}}}}; \draw[solid] (a'.input 1) edge (b_1); \node[draw=red, SEQ, xshift=1.250000cm , below of=a'] (c_1) {\ensuremath{\mathtt{c_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (c_1.east) {\small{\ensuremath{\mathtt{1}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (c_1.west) {\small{\ensuremath{\mathtt{2}}}}; \draw[solid] (a'.input 2) edge (c_1); \node[draw=red, AND, logic gate inputs=nn, xshift=-0.000000cm , yshift=4mm, below = 1.4cm of c_1.south] (c') {\rotatebox {-90}{\ensuremath{\mathtt{c'}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (c'.south) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (c'.north) {\small{\ensuremath{\mathtt{1}}}}; \draw[solid] (c_1) edge (c'.east); \node[draw=red, SEQ, xshift=-1.250000cm , below of=c'] (f_1) {\ensuremath{\mathtt{f_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (f_1.east) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (f_1.west) {\small{\ensuremath{\mathtt{1}}}}; \draw[solid] (c'.input 1) edge (f_1); \node[draw=red, SEQ, xshift=1.250000cm , below of=c'] (g_1) {\ensuremath{\mathtt{g_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (g_1.east) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (g_1.west) {\small{\ensuremath{\mathtt{1}}}}; \draw[solid] (c'.input 2) edge (g_1); \node[draw=red, state, xshift=-0.000000cm , below of=g_1] (g') {\ensuremath{\mathtt{g'}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (g'.east) {\small{\ensuremath{\mathtt{3}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (g'.west) {\small{\ensuremath{\mathtt{0}}}}; \draw[solid] (g_1) edge (g'); \node[draw=red, state, xshift=-0.000000cm , below of=f_1] (f') {\ensuremath{\mathtt{f'}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (f'.east) {\small{\ensuremath{\mathtt{3}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (f'.west) {\small{\ensuremath{\mathtt{0}}}}; \draw[solid] (f_1) edge (f'); \node[draw=red, AND, logic gate inputs=nn, xshift=-0.000000cm , yshift=4mm, below = 1.4cm of b_1.south] (b') {\rotatebox {-90}{\ensuremath{\mathtt{b'}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (b'.south) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (b'.north) {\small{\ensuremath{\mathtt{3}}}}; \draw[solid] (b_1) edge (b'.east); \node[draw=red, SEQ, xshift=-1.250000cm , below of=b'] (d_1) {\ensuremath{\mathtt{d_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (d_1.east) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (d_1.west) {\small{\ensuremath{\mathtt{1}}}}; \draw[solid] (b'.input 1) edge (d_1); \node[draw=red, SEQ, xshift=1.250000cm , below of=b'] (e_3) {\ensuremath{\mathtt{e_{3}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (e_3.east) {\small{\ensuremath{\mathtt{2}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (e_3.west) {\small{\ensuremath{\mathtt{3}}}}; \draw[solid] (b'.input 2) edge (e_3); \node[draw=red, SEQ, xshift=-0.000000cm , below of=e_3] (e_2) {\ensuremath{\mathtt{e_{2}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (e_2.east) {\small{\ensuremath{\mathtt{3}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (e_2.west) {\small{\ensuremath{\mathtt{2}}}}; \draw[solid] (e_3) edge (e_2); \node[draw=red, SEQ, xshift=-0.000000cm , below of=e_2] (e_1) {\ensuremath{\mathtt{e_{1}}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (e_1.east) {\small{\ensuremath{\mathtt{4}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (e_1.west) {\small{\ensuremath{\mathtt{1}}}}; \draw[solid] (e_2) edge (e_1); \node[draw=red, state, xshift=-0.000000cm , below of=e_1] (e') {\ensuremath{\mathtt{e'}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (e'.east) {\small{\ensuremath{\mathtt{5}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (e'.west) {\small{\ensuremath{\mathtt{0}}}}; \draw[solid] (e_1) edge (e'); \node[draw=red, state, xshift=-0.000000cm , below of=d_1] (d') {\ensuremath{\mathtt{d'}}}; \node[draw=none, blue, xshift=2mm, yshift=0mm] at (d'.east) {\small{\ensuremath{\mathtt{3}}}}; \node[draw=none, green!60!black, xshift=-2mm, yshift=0mm] at (d'.west) {\small{\ensuremath{\mathtt{0}}}}; \draw[solid] (d_1) edge (d'); \end{tikzpicture} \end{document}