How to draw a many edges loop above - tikz

im try to draw many edges loop above in the same node, i have writing :

\documentclass{report}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[shorten >=1pt, auto,thick,initial text=,minimum size=0pt]
\node[state, accepting]            (0)                          {0};

\path[->]      (0)  edge  [loop above]    node      {$a:\varepsilon | 1$}   ();

\end{tikzpicture}
\end{document}


i want some thing like this (the picture is not pretty ):

You can adjust the width of the loop drawn by loop above using the every loop style. With a bit of creativity you can use \foreach to draw a bunch of loops. You should wrap those paths in \begin{pgfinterruptboundingbox} to avoid the loops increasing your bounding box size too much due to their support points:

\documentclass{report}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[shorten >=1pt, auto,thick,initial text=,minimum size=0pt]
\node[state, accepting]            (0)                          {0};

\path[->]      (0)  edge  [loop above]    node      {$a:\varepsilon | 1$}   ();
\begin{pgfinterruptboundingbox}
\foreach \looseness/\label [count=\n] in {10/a,15/b,20/c,27/d,35/e}
\path [->] (0) edge [
loop above,
every loop/.append style={
looseness=\looseness,
in=60-0.8*\looseness,
out=120+0.8*\looseness
}] node {\label} ();
\end{pgfinterruptboundingbox}
\end{tikzpicture}
\end{document}

• How to label all edges with this method? Jun 21, 2012 at 16:48
• @WassimSboui: I've edited my answer to show how to use a loop with two variables.
– Jake
Jun 21, 2012 at 16:51

For this purpose you should play with the min distance option from topaths library and specify manually the starting and ending angle of the arrows with in=...,out=....

In the following example, for demonstration, there are two other paths starting and ending always in the same point, but you could reproduce your image simply changing in=...,out=....

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{automata,topaths}

\begin{document}

\begin{tikzpicture}[shorten >=1pt, auto,thick,initial text=,minimum size=0pt]
\node[state, accepting] (0) {0};

\path[->](0)edge[loop above] node {$a$} ();
\path[->,min distance=3cm] (0)edge[in=78,out=102,above] node {$b$}(0);
\path[->,min distance=6cm](0)edge[in=78,out=102,above] node {$c$} (0);
\end{tikzpicture}

\end{document}


Graphical result:

• To fix with the label size, one should play with the looseness and the in/out, but @Jake answer's does it perfectly and better than I could :). Jun 21, 2012 at 17:00