[Tex/LaTex] Nth Problem with TikZ and Extensive Form Games

game-treetikz-trees

I'd like to typset the tree on the left of the image. Unfortunately, TikZ seems way to complicated to me… I tried with this code, without success enter image description here

\documentclass{beamer}
\usepackage{tikz} % Game theory packages
\usetikzlibrary{calc}

% Node styles
\tikzset{
% Two node styles for game trees: solid and hollow
solid node/.style={circle,draw,inner sep=1.5,fill=black},
hollow node/.style={circle,draw,inner sep=1.5}
}

\begin{document}

\begin{frame}
    \begin{tikzpicture}[scale=0.7,font=\footnotesize]
        % Specify spacing for each level of the tree
            \tikzstyle{level 1}=[level distance=18mm,sibling distance=27mm]
            \tikzstyle{level 2}=[level distance=18mm,sibling distance=27mm]
        % The Tree
        \node(0)[hollow node,label=above:{$1$}]{}
            child{node(1)[solid node, label=above:{$2$}]{}
                child{node(0-1-1)[solid node, label=above:{$1$}]{} edge from parent node[left]{$E$}}
                child{node(0-1-2)[label=below:{$(3,1)$}]{} edge from parent node[right]{$F$}}                                   
                    child{node(0-1-1-1)[label=below:{$(1,2)$}]{} edge from parent node[right]{$G$}} % The error is here
                edge from parent node[left,xshift=-3]{$C$}          
        }
            child{node(2)[label=below:{$(0,3)$}]{} edge from parent node[right, xshift=3]{$D$}
            };

        \end{tikzpicture}
\end{frame}
\end{document}

I'd like also to ask you if something easier for game theory than Tikz exists for trees.

Best Answer

Note that there is a package, istgame, which specializes on game trees. For general trees, forest is a very powerful tool. It allows you to draw your tree very easily.

\documentclass{article}
\usepackage{forest}
\forestset{el/.style={edge label={node [pos=0.7,above,outer sep=3pt] {$#1$} }}}
\begin{document}
\begin{forest}
for tree={circle,fill,inner sep=1pt,calign=fixed edge angles}
[,label=above:1
 [,label=above left:2,el=A
  [,label=above left:1,el=C
   [,label=below:{0,2},el=E ]
   [,label=below:{2,0},el=F ]
  ]
  [,label=below:{1,1},el=D]
 ]
 [,label=below:{3,3},el=B]
]
\end{forest}
\end{document}

enter image description here

Related Question