Friends, consider the following code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto,/tikz/initial text=]
\node[state,initial] (q_0) {$q_0$};
\node[state] (q_2) [above of=q_0] {$q_2$};
\node[state] (q_1) [left of=q_2] {$q_1$};
\node[state] (q_3) [right of=q_2] {$q_3$};
\node[state] (q_5) [right of=q_0] {$q_5$};
\node[state] (q_4) [left of=q_0] {$q_4$};
\node[state] (q_7) [below of=q_0] {$q_7$};
\node[state] (q_6) [left of=q_7] {$q_6$};
\node[state] (q_8) [right of=q_7] {$q_8$};
\path[->,every node/.style={font=\scriptsize}]
(q_0) edge [bend left=15] node {$a$} (q_2)
(q_2) edge [bend left=15] node {$b$} (q_0)
(q_0) edge [bend left=15] node {$c$} (q_5)
(q_5) edge [bend left=15] node {$d$} (q_0)
(q_0) edge [bend left=15] node {$e$} (q_7)
(q_7) edge [bend left=15] node {$f$} (q_0)
(q_0) edge [bend left=15] node {$g$} (q_4)
(q_4) edge [bend left=15] node {$h$} (q_0)
(q_0) edge [bend left=15] node {$i$} (q_1)
(q_1) edge [bend left=15] node {$j$} (q_0)
(q_0) edge [bend left=15] node {$k$} (q_3)
(q_3) edge [bend left=15] node {$l$} (q_0)
(q_0) edge [bend left=15] node {$m$} (q_8)
(q_8) edge [bend left=15] node {$n$} (q_0)
(q_0) edge [bend left=15] node {$o$} (q_6)
(q_6) edge [bend left=15] node {$p$} (q_0);
\end{tikzpicture}
\end{document}
which gives us the following output:
So far, so good (believe me, there are worse drawings).
I was wondering if it's possible to move the labels to an arbitrary position along the path, that is:
The workaround I found was to draw a path without a label and then \draw
the texts in the proper absolute positions. I was trying to achieve something like this:
I'm a TikZ newbie, so bear with me. I'm sure there are better approaches than the one I used. Any ideas? :-)
near end
and similars (page 193 of the manual), for example:(q_0) edge [bend left=15,near end] node {$c$} (q_5)