[Tex/LaTex] how to draw a diagram that forks out, then joins in the middle then forks out again

tikz-pgftikz-qtreetrees

Update:

ref comments: I've slightly corrected the terminology and the title. I am using the term diagram now, instead of tree, and I am just asking on how to draw this diagram in Tikz. Any tool or library would be OK. I used qtree since that is what I know now, any other method is welcome.

end of update

I'd like help/hint on how to draw this diagram

enter image description here

The part I am having problem with is how to make it go from B C children to one node D then fork out again.

This is latest attempt. I tried also to use grow'=up in the middle, but could not figure the syntax without splitting it into two pictures. I wanted it all to be one picture.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}
\tikzset{font=\small,
         edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}}

\begin{tikzpicture}
    \Tree [.A
             [.B ]
             [.C ]
          ]
\begin{scope}[xshift=0in,yshift=-1.5cm]
    \Tree [.D
             [.E ]
             [.F ]
          ]
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

update 7/21/13 1 AM

Here is a general diagram as requested. But I am not really asking someone to draw all of this for me in Tikz, I was just asking for the technique on how to join then fork in a middle of building a general diagram since all the examples I've seen seem to show forks at each node.

enter image description here

Best Answer

In addition to the solution suggested by @Qrrbrbirlbel in the comments, playing around a little bit with \usetikzlibrary{positioning}, defining some \node's in the trees that you had already provided, and using \coordinate allows you to get the output that you want.

It might not be the most elegant way to do so, but as has already been pointed out in the comments, this is not really one tree.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning}

\begin{document}

\tikzset{font=\small,
         edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}}

\begin{tikzpicture}
    \Tree [.A
             [.\node(B){B}; ]
             [.\node(C){C}; ]
          ]
\begin{scope}[xshift=0in,yshift=-2cm]
    \Tree [.\node(D){D};
             [.E ]
             [.F ]
          ]
\end{scope}

\coordinate [above=.2cm of D] (D') {};
\draw[-] (B) |- (D');
\draw[-] (C) |- (D');
\draw[-] (D') -- (D);
\end{tikzpicture}

\end{document}

enter image description here