Zeichnen eines Automaten in LaTeX

Zeichnen eines Automaten in LaTeX

Ich habe diesen Automaten, den ich in LaTeX reproduzieren muss:

Bildbeschreibung hier eingeben

Bisher habe ich das geschafft, aber ich weiß nicht so recht, wie ich die Kanten positionieren soll.

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[->,>=stealth',shorten >=5pt,auto,node distance=2.8cm,semithick]
\node[state] (q0)                    {$q_a$};
\node[state]         (q1) [above,right of=q0] {$q_b$};
\node[state]         (q2) [right of=q1] {$q_c$};

\path (q0) edge [loop left]   node {a} (q0);

     (q1) edge [loop right] node {b} (q1);

     (q2) edge [loop right] node {c} (q2);

\end{tikzpicture}
\caption{Beispiel für einen NSA/DSA}
\end{figure}

Wie lassen sich beispielsweise die Knoten verschieben?

Antwort1

So was?

Bildbeschreibung hier eingeben

\documentclass[tikz,
               border=3mm
               ]{standalone}
\usetikzlibrary{arrows, automata,
                quotes,
                positioning
                }

\begin{document}
    \begin{tikzpicture}[
    node distance = 12mm and 22mm,
every edge/.style = {draw, -stealth', shorten >=1pt},
every edge quotes/.style = {inner sep=1pt, auto},
    semithick
                    ]
\node (q0) [state]                   {$q_a$};
\node (q1) [state,above right=of q0] {$q_b$};
\node (q2) [state,below right=of q0] {$q_c$};
%
\path (q0) edge [loop  left,"$a$"] (q0)
      (q1) edge [loop right,"$b$"] (q1)
      (q2) edge [loop right,"$c$"] (q2)
%
      (q0.45)  edge [bend left,"$b$"] (q1.180)
      (q1.210) edge [bend left,"$a$"] (q0.30)
%
      (q0.330) edge [bend left,"$c$"] (q2.150)
      (q2.180) edge [bend left,"$a$"] (q0.300)
%
      (q1.285) edge [bend left,"$c$"] (q2.75)
      (q2.105) edge [bend left,"$b$"] (q1.265)
      ;
    \end{tikzpicture}
\end{document}

Knotenpositionen werden durch Verwendung der TikZ-Bibliothek bestimmt positioning, für Kantenbeschriftungen wird die TikZ-Bibliothek verwendet quotes.

verwandte Informationen