[Tex/LaTex] Tikz: Simple decision tree (node connections)

node-connectionsnodestikz-pgf

I am trying to reproduce the following

enter image description here

So far I got this:

\begin{tikzpicture}[]
\small
\node[] (AB) {$A \succeq B$};
\node[]{}
    child{node[chance]{C}
      edge from parent
        node[above]{1-p}    
                }
    child{node[chance]{A} 
      edge from parent
          node[below]{p}
        };
\end{tikzpicture}

My basic problem is to label and connect simples nodes. So what is the command for "place this node A \succeq B left to the decision tree with decent distance"? Thank you very much.

Best Answer

Here are two options showing how to produce the trees using two of the most popular packages for tree generation; the first one using the forest package and the second one using tikz-qtree:

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

\begin{document}

\[
A \succeq B
\Rightarrow
\begin{forest}
baseline,
for tree={grow=0,parent anchor=east,l sep=35pt} 
[
  [C,edge label={node[sloped,pos=0.5,below,font=\scriptsize]{$1-p$}}]
  [A,edge label={node[sloped,pos=0.5,above,font=\scriptsize]{$p$}}]
] 
\end{forest}
\succeq
\begin{forest}
baseline,
for tree={grow=0,parent anchor=east,l sep=35pt} 
[
  [C,edge label={node[sloped,pos=0.5,below,font=\scriptsize]{$1-p$}}]
  [B,edge label={node[sloped,pos=0.5,above,font=\scriptsize]{$p$}}]
] 
\end{forest}
\]

\[
A \succeq B
\Rightarrow
\begin{tikzpicture}[baseline,grow=right,level distance=35pt]
\Tree[
  \edge node[sloped,pos=0.5,below,font=\scriptsize]{$1-p$}; C
  \edge node[sloped,pos=0.5,above,font=\scriptsize]{$p$}; A
] 
\end{tikzpicture}
\succeq
\begin{tikzpicture}[baseline,grow=right,level distance=35pt]
\Tree[
  \edge node[sloped,pos=0.5,below,font=\scriptsize]{$1-p$}; C
  \edge node[sloped,pos=0.5,above,font=\scriptsize]{$p$}; B
] 
\end{tikzpicture}
\]

\end{document}

The result:

enter image description here