# Latex connecting lines between nodes on Tree

How can I connect 2 horizontal nodes on a tree? That is I want to connect z1 to z2. but the line should continue to the right of z2 and left of z1 to show continuity. Like wise for theta 1 and theta 2.

My current latex commands:

\begin{tikzpicture}[level distance=1.2cm,
level 1/.style={sibling distance=4cm},
level 2/.style={sibling distance=1cm}
]
\centering
\tikzstyle{every node}=[circle,draw]

\node (Root) [black] {$z_{1}$}
child {
node {$\theta_{1}$}
child { node {$\varphi_{1}$} edge from parent node[left,draw=none]{} }
child { node {$\varphi_{2}$} }
child { node {$\varphi_{3}$} }
};
\hspace*{4cm}\node (Root) [black] {$z_{2}$}
child {
node {$\theta_{2}$}
child { node {$\varphi_{1}$} }
child { node {$\varphi_{2}$} }
child { node {$\varphi_{3}$} }
child { node {$\varphi_{4}$} }
};

\end{tikzpicture}
-
Welcome to the site. You have some spacing and centering commands that won't work inside the tikz environment. Instead you can use \node (Root) at (xcoord,ycoord) {... –  percusse Jan 26 '14 at 14:12

1. Using the positioning library for the right=4cm of Root1 syntax.
2. Using \tikzset instead of \tikzstyle.
3. Renaming the (Root) nodes to (Root1) and (Root2) to connect them using \draw.

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\tikzset{every node/.style = {circle,draw}}
\begin{document}
\begin{tikzpicture}[level distance=1.2cm,
level 1/.style={sibling distance=4cm},
level 2/.style={sibling distance=1cm}
]
\node (Root1) [black] {$z_{1}$}
child {
node {$\theta_{1}$}
child { node {$\varphi_{1}$} edge from parent node[left,draw=none]{} }
child { node {$\varphi_{2}$} }
child { node {$\varphi_{3}$} }
};
\node[right=4cm of Root1] (Root2) [black] {$z_{2}$}
child {
node {$\theta_{2}$}
child { node {$\varphi_{1}$} }
child { node {$\varphi_{2}$} }
child { node {$\varphi_{3}$} }
child { node {$\varphi_{4}$} }
};
\draw (Root1) -- (Root2);
\end{tikzpicture}
\end{document}

-
Thank you! I tried to draw the line on other nodes but I get error can u please help –  user1965914 Feb 2 '14 at 12:20
@user1965914 Of course, I can help. You could either post your specific problem as another question or we discuss it in the chat. –  Henri Menke Feb 2 '14 at 12:22
I need to draw a line from the left hand size of Z1 to the right hand side of Z2 as a arrow line showing the time flow. And same with theta 1. The line must start from the left most. I tried for a day now but i just couldn't make it work –  user1965914 Feb 2 '14 at 12:31
@user1965914 Hm, I'm also stuck a little here, because \draw (Root1) to[out=180,in=0,bend left] (Root2); doesn't work as expected. –  Henri Menke Feb 2 '14 at 12:48