# Tikz edge label position

Is there a way to set the location of the position of edge label when using the tikz graph package?

I attempted to look for samples of this being done in the manual, but was unable to find any (closest I got was in 19.6 where it shows how to set some options for individual edges).

Is this possible?

Edit: more specifically, I am looking for a way to put the label above or below the edge.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphdrawing,positioning,graphs}
\usegdlibrary{layered, trees}
\begin{document}
\begin{tikzpicture}
\begin{graph}
{1->[edge label=hello]2};
\end{graph}
\end{tikzpicture}

\end{document}

-
–  cmhughes Feb 9 '14 at 15:40
@cmhughes This is using the graph library which has a different syntax. –  soandos Feb 9 '14 at 20:37
I suppose he thought that was what you meant by 'graph package'. Do you mean tkz-graph? (Which is not TikZ, but a package built on TikZ.) Edit: Could you create a minimal example perhaps? –  Torbjørn T. Feb 9 '14 at 21:29
A minimal example would have made this clearer. I haven't installed PGF 3.0 yet, so I can't really help I'm afraid, but there's probably someone else who can. –  Torbjørn T. Feb 9 '14 at 21:55
Just came across this one again. I think the labels are placed with the auto option enabled, placing the label above the line for your example. To place it below, add swap, i.e. {1->[edge label=hello,swap]2}; Does that answer your question? –  Torbjørn T. Mar 14 '14 at 23:31

The labels seem to be placed with the auto option enabled, which places the node/label on the side of the line, in your MWE above it. As such you can add the swap option to move the label to the other side.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphdrawing,positioning,graphs}
\usegdlibrary{layered, trees}
\begin{document}
\begin{tikzpicture}
\begin{graph}
{1 -> [edge label=hello]
2 -> [edge label=hello,swap]
3};
\end{graph}
\end{tikzpicture}
\end{document}

-