- To add another "Bag 2" branch, add another
node[bag]
structure.
- To add another end branch, add another
child { node[end] {}}
to a node[bag]
structure.
You can merely copy and paste the right parts to achieve it.
Here is a simplified example of http://www.texample.net/tikz/examples/probability-tree/ where another of each sorts of branches has been added:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
% Set the overall layout of the tree
\tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]
% Define styles for bags and leafs
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt]
\begin{tikzpicture}[grow=right, sloped]
\node[bag] {Bag 1}
child {
node[bag] {Bag 2}% This is the first of three "Bag 2"
child {
node[end] {}
}
child {
node[end] {}
}
}
child {
node[bag] {Bag 2}
child {
node[end] {}
}
child {
node[end] {}
}
}
child {
node[bag] {Bag 2}
child {% Here are three children, hence three end branches
node[end] {}
}
child {
node[end] {}
}
child {
node[end] {}
}
};
\end{tikzpicture}
\end{document}
Best Answer
There is a nice example of a probability tree on TeXample.net. That might help you get started.