# Graph-like structures with Qtree

The Qtree package is "a LaTeX package for drawing tree diagrams." Is it possible to draw simple graph-like diagrams with it, similar to the one depicted below? If not, should I resort to TikZ-qtree?

-
I don't think this is possible to do with qtree. (It is, after all qtree and not qgraph :-)) But it should be fairly easy to do in tikz-qtree I think. Since the basic syntax is the same, but tikz-qtree is much more powerful, I would start there. –  Alan Munn Aug 12 '11 at 22:50
@Alan: Thanks. Could you please help me with the tikz-qtree code? –  Sadeq Dousti Aug 12 '11 at 22:55

Here's one solution.

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

\begin{tikzpicture}[sibling distance=1cm, every node/.style={font=\sffamily}]

\Tree [.PSPACE
[.PP
[.BQP
[.BPP  \edge[white]; {} \edge; \node[xshift=2cm] (P) {P}; ] ]
[.\node (NP) {NP}; ]]]
\draw (P.north) -- (NP.south);

\end{tikzpicture}
\end{document}


Update

I've changed the method of moving the P node so that it is centred correctly. (Output image has been put in an \fbox to show the image edges.)

-
+1, thanks. There's one minor problem, though: although the \edge[white]; command hides the edge, it prevents the diagram from correctly being centered on the page. –  Sadeq Dousti Aug 13 '11 at 0:27
Removing \phantom{\hspace{4cm}} (leaving just empty braces) makes the positioning a whole lot better, though it's still very slightly off centre. –  Jake Aug 13 '11 at 0:43
@Sadeq Jake's comment is right. I added the \phantom to centre the P relative to the PSPACE. You can remove it and add [xshift=2cm] to the P node. –  Alan Munn Aug 13 '11 at 1:37