I would like to use graph TikZ-library from CVS version (sourceforge or tlcontrib) to draw flowcharts. Something like the one shown in chapter 5 from TikZ manual. In this tutorial, some styles are declared to easily draw loops and corners between nodes. I would like to add some label to this lines but edge label option doesn't work with these kind of edges. It seems to work with straight paths but not with complex ones.
Next example shows the problem:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,graphs,matrix}
\begin{document}
\begin{tikzpicture}[>=stealth',
font=\sffamily\small,
every node/.style={align=center},
skip loop left/.style={to path={-- ++(-#1,0)|- (\tikztotarget)}},
skip loop right/.style={to path={-- ++(#1,0)|- (\tikztotarget)}},
hv path/.style ={to path={-| (\tikztotarget)}},
vh path/.style ={to path={|- (\tikztotarget)}},
]
\matrix[column sep=1cm,row sep=1cm] (mymatrix) {
\coordinate (A11) {}; & \node[draw] (A12) {A12};\\
\node[draw] (A21) {A21}; & \coordinate (A22) {};\\
};
\graph[use existing nodes] {
A21->[edge label=A]A12;
A21->[hv path, edge label=B] A12; %<- this label is not shown
A21--[edge label=C]A11->A12;
};
\end{tikzpicture}
\end{document}
The result shows labels A and C, but not B. Label C is shown because the edge is divided into two straight edges. I can always use something like that, but do you know a better solution?


graphlibrary isn't yet in the version of PGF that is on CTAN. (Or am I just blind/mistaken?) – Torbjørn T. Dec 9 '11 at 17:43