I want to have the following tikzpicture
\begin{tikzpicture} [ node distance = 5cm, on grid, auto, every loop/.style={stealth-}] % State q0 \node (q0) [state, initial, initial text = {}] {$q_0$}; % State q1 \node (q1) [state, accepting, right = of q0] {$q_1$}; % Arrows \path [-stealth, thick] (q0) edge node {$a$} (q1) (q1) edge [loop above] node {$\top$}(); \end{tikzpicture} Where instead of label $a$ on the path from q0 to q1 I want to have the following picture as a diagram:
\tikzset{% zeroarrow/.style = {-stealth,dashed}, onearrow/.style = {-stealth,solid}, c/.style = {circle,draw,solid,minimum width=2em, minimum height=2em}, r/.style = {rectangle,draw,solid,minimum width=2em, minimum height=2em} } \begin{tikzpicture}[node distance=1cm and 1cm]\footnotesize \node[c] (a) {a}; \node[c] (b) [below right=of a] {b}; \node[c] (c) [below left=of b] {c}; \node[c] (d) [below=of c] {d}; \node[r] (final-one) [below right=of d,xshift=-2pt] {1}; \node[r] (final-zero) [below left=of d] {0}; \draw[onearrow] (a) -- (b); \draw[onearrow] (b) -- (final-one); \draw[onearrow] (c) -- (d); \draw[onearrow] (d) -- (final-one); \draw[zeroarrow] (a) -- (c); \draw[zeroarrow] (c) -- (final-zero); \draw[zeroarrow] (b) -- (c); \draw[zeroarrow] (d) -- (final-zero); \end{tikzpicture} However, replacing one with the other does not necessarily work.
The end result I wanted is similar to this one
Here is a MWE:
\documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{tikz} \usetikzlibrary{positioning,automata} \tikzset{% zeroarrow/.style = {-stealth,dashed}, onearrow/.style = {-stealth,solid}, c/.style = {circle,draw,solid,minimum width=2em, minimum height=2em}, r/.style = {rectangle,draw,solid,minimum width=2em, minimum height=2em} } \begin{document} \begin{tikzpicture} [ node distance = 5cm, on grid, auto, every loop/.style={stealth-}] % State q0 \node (q0) [state, initial, initial text = {}] {$q_0$}; % State q1 \node (q1) [state, accepting, right = of q0] {$q_1$}; % Arrows \path [-stealth, thick] (q0) edge node {$a$} (q1) (q1) edge [loop above] node {$\top$}(); \end{tikzpicture} \begin{tikzpicture}[node distance=1cm and 1cm]\footnotesize \node[c] (a) {a}; \node[c] (b) [below right=of a] {b}; \node[c] (c) [below left=of b] {c}; \node[c] (d) [below=of c] {d}; \node[r] (final-one) [below right=of d,xshift=-2pt] {1}; \node[r] (final-zero) [below left=of d] {0}; \draw[onearrow] (a) -- (b); \draw[onearrow] (b) -- (final-one); \draw[onearrow] (c) -- (d); \draw[onearrow] (d) -- (final-one); \draw[zeroarrow] (a) -- (c); \draw[zeroarrow] (c) -- (final-zero); \draw[zeroarrow] (b) -- (c); \draw[zeroarrow] (d) -- (final-zero); \end{tikzpicture} \end{document} 
