[Tex/LaTex] How to tell the edges to arc above when I draw automata with tikzpicture


I am drawing finite automata with TikZ. Currently, transition arrows overlap between nodes because they both go across horizontally. How can I tell one arrow to arc above and the other arrow to arc under?

Here's what I have:

(q_0) edge node {H} (q_1)
(q_1) edge node {T} (q_0)

Best Answer

You can use bend left or bend right in the options for edge as per the need.

An example

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
  \tikzstyle{every state}=[fill=magenta!40,draw=none,text=white]

  \node[initial,state] (A)                    {$q_a$};
  \node[state]         (B) [above right of=A] {$q_b$};
  \node[state]         (C) [below right of=B] {$q_c$};

  \path (A) edge              node {0,1,L} (B)
            edge [bend left]  node {1,1,R} (C)
        (B) edge [loop above] node {1,1,L} (B)
            edge              node {0,1,L} (C)
        (C) edge [bend left] node {0,1,L}  (A);


enter image description here