# Creating labes on diagram edges

I want to add labels 3, 4, 5 on tree edges like you can see on picture, but I don't know how :(

My minimal example:

    \documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tikz-qtree}

\usetikzlibrary{positioning}
\usetikzlibrary{trees}

\begin{document}

\begin{center}
\begin{tikzpicture}[sibling distance=40pt]
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}}}
\Tree [.\textrm{} [.$x_2=1$  ]
[.$x_2\neq1$ [.$x_2=2$ ]
[.$x_2\neq2$ [.$x_2=3$ ]
[.$x_2=4$ ] ] ] ]
\end{tikzpicture}
\end{center}

\end{document}

-

I wouldn't know how to do it using tikz-qtree, but using TikZ, it's easy:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{trees}

\begin{document}

\begin{center}
\begin{tikzpicture}[sibling distance=150pt]
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.south)
-- +(0,-17pt)
-| (\tikzchildnode)}}}
\coordinate
child {node {$x_2=1$} edge from parent node[auto,swap,pos=0.08] {3}}
child {node {$x_2\neq1$}
child {node {$x_2=2$} edge from parent node[auto,swap,pos=0.08] {4}}
child {node {$x_2\neq2$}
child {node {$x_2=3$} edge from parent node[auto,swap,pos=0.08] {5}}
child {node {$x_2=4$}}
}
};
\end{tikzpicture}
\end{center}

\end{document}


-
THANK YOU BRO!!! –  user27318 Mar 16 '13 at 16:12