# Decision Tree in LaTeX with TikZ

Grid line doesn't have to be included

\documentclass[10pt]{beamer}
\usetheme{default}
\usepackage{graphicx}
\usepackage{amssymb,amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{caption} \
usepackage{subcaption}
\setbeamercolor{title}{fg=black}
\setbeamercolor{subtitle}{fg=gray}
\setbeamercolor{footlinecolor}{fg=white,bg=green}
\setbeamertemplate{footline}[text line]{% \parbox{\linewidth}{\vspace*{-10pt} \textit{Where Wall Street Goes to School} \hfill \insertpagenumber} } \setbeamertemplate{navigation symbols}{} –

\begin{tikzpicture}[>=stealth,sloped][scale=0.8]
\matrix (tree) [matrix of nodes, minimum size=0.25cm, column sep=2cm, row sep=1cm, ]
{ & $C_{i+1,j+1}$ \\ $C_{i,j}$ &$C_{i+1,j}$ \\
& $C_{i+1,j-1}$ \\
};
\draw[->] (tree-3-1) -- (tree-1-3) node [midway,above] {};
\draw[->] (tree-3-1) -- (tree-3-3) node [midway,above] {};
\draw[->] (tree-3-1) -- (tree-5-3) node [midway,below] {};
\end{tikzpicture}

• welcome to tex.se! what is the problem? what you try so far? we are not service "do-it-for-me" ... – Zarko Nov 3 '17 at 5:58
• I know it is wrong but I can't get it to align properly \begin{tikzpicture}[>=stealth,sloped][scale=0.8] \matrix (tree) [% matrix of nodes, minimum size=0.25cm, column sep=2cm, row sep=1cm, ] { & $C_{i+1,j+1}$ \\ $C_{i,j}$ &$C_{i+1,j}$ \\ & $C_{i+1,j-1}$ \\ }; \draw[->] (tree-3-1) -- (tree-1-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-3-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-5-3) node [midway,below] {}; \end{tikzpicture} \end{adjustbox} – Karine Nov 3 '17 at 6:13
• Dear @Karine, can you add above code to your question? end extend it to complete small document beginning with \documentclass{...} end ending with {\end{document}? – Zarko Nov 3 '17 at 6:15
• \documentclass[10pt]{beamer} \usetheme{default} \usepackage{graphicx} \usepackage{amssymb,amsmath} \usepackage{tikz} \usetikzlibrary{matrix} \usepackage{adjustbox} \usepackage{caption} \usepackage{subcaption} \setbeamercolor{title}{fg=black} \setbeamercolor{subtitle}{fg=gray} \setbeamercolor{footlinecolor}{fg=white,bg=green} \setbeamertemplate{footline}[text line]{% \parbox{\linewidth}{\vspace*{-10pt} \textit{Where Wall Street Goes to School} \hfill \insertpagenumber} } \setbeamertemplate{navigation symbols}{} – Karine Nov 3 '17 at 6:18
• That code will give an error for sure. Please post compilable code unless the problem you want help with is a compilation error. – cfr Dec 5 '17 at 22:49

try

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, matrix}

\begin{document}
\begin{tikzpicture}[
every edge/.append style = {-Straight Barb, thick,
shorten >=1mm, shorten <=1mm},
]
\matrix (tree) [matrix of nodes,
nodes={circle, draw, minimum size=3mm, inner sep=0mm},
column sep=2cm, row sep=1cm
]
{
|[label=left:{$C_{i,j+1}$}]|  &   |[label=right:{$C_{i+1,j+1}$}]|   \\
|[label=left:{$C_{i,j}$}]|    &   |[label=right:{$C_{i+1,j}$}]|     \\
|[label=left:{$C_{i,j-1}$}]|  &   |[label=right:{$C_{i+1,j-1}$}]|   \\
};
\path   (tree-1-1) edge (tree-2-2)
(tree-2-1) edge (tree-2-2)
(tree-3-1) edge (tree-2-2)
(tree-1-2) edge (tree-2-2)
(tree-3-2) edge (tree-2-2);

\end{tikzpicture}
\end{document}
`

• any news? if answer help you, you can accept it by clicking on check mark at above left corner of answer and vote it when you will earn enough reputation. if it is not helping, please let me know, what is missing in answer or is not clear or even wrong. – Zarko Nov 3 '17 at 22:27