![尝试创建二项式树](https://linux22.com/image/416167/%E5%B0%9D%E8%AF%95%E5%88%9B%E5%BB%BA%E4%BA%8C%E9%A1%B9%E5%BC%8F%E6%A0%91.png)
我的台词不太好,有人能帮助我吗
到目前为止我已完成以下事项:
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{pgf,tikz}
\usetikzlibrary{positioning}
\begin{document}
% Set the overall layout of the tree
\tikzstyle{level 1}=[level distance=2cm, sibling distance=2cm]
\tikzstyle{level 2}=[level distance=2cm, sibling distance=2cm]
\tikzstyle{level 3}=[level distance=2cm, sibling distance=2cm]
% Define styles for bags and leafs
\tikzstyle{bag} = [text width=2em, text centered]
\tikzstyle{edge from parent}=[draw]
\tikzstyle{end} = [text width=3em, text centered]
%\tikzstyle{every node}=[fill=red!30,rounded corners]
% The sloped option gives rotated edge labels. Personally
% I find sloped labels a bit difficult to read. Remove the sloped options
% to get horizontal labels.
\begin{tikzpicture}[grow=right, sloped, edge from parent]
\node[bag] {$S_{0}$} % First bag
child{node[bag] {$S_{0}d$} % Step 1 down
child{node[bag]{$S_{0}d^{2}$} % step 2 down
child{node[end]{$S_{0}d^{3}$}} % step 3 down
child{node[end] {}} % step 3 up
}
child{node[bag] {} % step 2 up
child{node[end]{}} %step 3 down
child{node[end] {}} %step 3 up
}
}
child {node[bag] {$S_{0}u$} % step 1 up
child{node[bag]{$S_{0}ud$}
child{node[end]{$S_{0}ud^{2}$}} % step 3 down
child{node[end]{}} % step 3 up
} % step 2 down
child{node[bag ]{$S_{0}u^{2}$} % step 2 up
child{node[end]{$S_{0}u^{2}d$}} % step 3 down
child{node[end]{$S_{0}u^{3}$}} % step 3 up
}
};
\end{tikzpicture}
\end{document}