Is there a library for drawing object inheritance trees in TikZ?

This seems like a very common thing, but searching for the words 'tree', 'language', 'object', 'inheritance' and/or 'parent' returns Questions that have nothing to do with mine.

In a nutshell, I want this:

But if instead of class B-D I have B-V, I would rather not go in and manually move everything around. Currently, I am using nodes and my classes are flying off the page.

What is one/any way to tackle this problem.

MWE:

\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
neuronModel/.style={%
opacity=0.75,
fill=black!50,
},
rounded corners,
thick,
draw=blue!90,
fill=blue!35,
thick,
inner ysep=2pt,
inner xsep=2pt
}]

% \foreach \neuronIndex/\neuronLabel in {1/Bidirectional Neuron Model , 10/Unidirectional Neuron Model}
% \node at (\neuronIndex,10)[draw=black,fill=blue]{\neuronLabel};

\node[neuronModel,align=center] (neuronModel1) {Bidirectional\\
Neuron Model};
\node[neuronModel,right=0.5cm of neuronModel1,align=center] (neuronModel2) {Unidirectional\\
Neuron Model};
\node[neuronModel,right=0.5cm of neuronModel2,align=center] (neuronModel3) {Postprocessing\\
Neuron Model};
\node[neuronModel,right=0.5cm of neuronModel3,align=center] (neuronModel4) {Preprocessing\\
Neuron Model};
\node[neuronModel,right=0.5cm of neuronModel4,align=center] (neuronModel5) {Stats\\
Neuron Model};
\node[neuronModel,right=0.5cm of neuronModel5,align=center] (neuronModel6) {Visual\\
Neuron Model};
\end{tikzpicture}
\end{document}


Here is the resulting picture. I need to add about 5 more classes, so this approach will not suffice.

-
Yes –  Seamus Feb 9 '12 at 13:30

The tikz-qtree package can probably do what you want. Here is a crude example:

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

\begin{document}

\begin{tikzpicture}
\tikzset{level distance=50pt}
\Tree [.\node[draw]{class A};
[.\node[draw]{class B}; ]
[.\node[draw]{class C}; ]
[.\node[draw]{class D};
\node[draw]{class E};
]
]
\end{tikzpicture}

\end{document}


As pointed out by Alan Munn, the code can be further simplified by specifying the node style in advance:

\begin{tikzpicture}[every tree node/.style=draw]
\tikzset{level distance=50pt}
\Tree [.{class A}
[.{class B} ]
[.{class C} ]
[.{class D}
{class E}
]
]
\end{tikzpicture}

-
Where did you download it from? This link is the best I could find, but even the README file doesn't provide and installation directions ctan.org/tex-archive/graphics/pgf/contrib/tikz-qtree –  puk Feb 9 '12 at 11:48
@puk: What distribution are you using? I'm on TeXLive 2011 and tikz-qtree is part of it. i.e. I didn't have to download anything special for this. –  qubyte Feb 9 '12 at 12:02
This can be further simplified with [every tree node/.style=draw] added to the tikzpicture environment. Then you don't need to make every label a node. (I.e. you can just do [.{Class A} [.{Class B} ] [.{Class C} ] [.{Class D} [.{Class E} ]]] –  Alan Munn Feb 9 '12 at 17:23
According to Ubuntu 11.10 (apt-get install texlive-full) it is installed and up to date. According to pdflatex the file tikz-qtree.sty can not be found. –  puk Feb 9 '12 at 18:45
tikz-qtree was first released at the very end of 2009 (effectively 2010); if the Ubuntu image isn't that recent then you are up-to-date with respect to the Ubuntu package, but not with TeXLive. Most people solve this by installing their own version of TeXLive and not using the Ubuntu package manager. See How to install “vanilla” TeXLive on Debian or Ubuntu?. Alternatively, just install it locally: How can I manually install a LaTeX package (Debian/Ubuntu Linux)? –  Alan Munn Feb 9 '12 at 20:15