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

\usepackage{tikz} % Game theory packages

% Node styles
% 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}


        % 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$}


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


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.

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

enter image description here


My plain TikZ code is a bit long but easy to read.

enter image description here

h/.style={circle,draw=magenta,thick,inner sep=1.5},
(0,0)     node[h] (1)  {} node[above] {1}  
+(1,-1)   node[s] (2b) {} node[below] {3,3}
++(-1,-1) node[s] (2a) {} node[left]  {2}  
+(1,-1)   node[s] (3b) {} node[below] {1,1}
++(-1,-1) node[s] (3a) {} node[left]  {1}  
+(1,-1)   node[s] (4b) {} node[below] {0,2}
+(-1,-1)  node[s] (4a) {} node[below] {2,0};

\draw (1)
--(2a) node[pos=.4,left]{A}
--(3a) node[pos=.4,left]{C}
--(4a) node[pos=.4,left]{E}
(1)--(2b)  node[pos=.4,right]{B}
(2a)--(3b) node[pos=.4,right]{D}
(3a)--(4b) node[pos=.4,right]{F};

\path #1 node{#2} 
++(-90:1)  node{#3} ++(-90:1) node{#4}
++(-90:1)  node{#5} ++(-90:1) node{#6};
\draw (0,0) grid (2,-4);
  • it works well with article, but some errors appear with beamer. Did I miss something? – Black Mild Aug 22 at 1:12
  • 3
    It works with beamer if you add [fragile], i.e. use \begin{frame}[fragile]. (+1) – Schrödinger's cat Aug 22 at 2:26

I propose this short code with pstricks – more specifically pst-tree:



\psset{tnsep=1pt, labelsep=3pt}
\pstree[nodesep=0pt, levelsep=1.5cm, treesep=3cm]{\Tc{2pt}~[ tnpos=a, tnsep=-1pt]{1}} {
        \pstree{\Tdot\nbput{$ A $} \uput[ul](\pssucc){$ 2 $}} {%
                \pstree{\Tdot \nbput{$ C $} \uput[ul](\pssucc){{1}}}{%
                        \pstree{\Tdot \nbput{$ E $} \uput[ul](\pssucc){{2}}}{}%
        \Tdot_{$D$} \uput[d](\pssucc){$1,1$}}%
\Tdot_{$B$} \uput[d](\pssucc){$3,3$}}


enter image description here


How to use the istgame package:

(You only need to briefly read three pages (pp.6-8) of the manual to do this.)

enter image description here




\istroot(0)[initial node]{1}
  \istb{A}[al]       \istb{B}[ar]{3,3}  \endist
  \istb{C}[al]       \istb{D}[ar]{1,1}  \endist
  \istb{E}[al]{2,0}  \istb{F}[ar]{0,2}  \endist


My attempt with tikz-qtree, but I did not find out how to fix the angles:



        \begin{tikzpicture}[level distance=30pt,
                            sibling distance=10pt,
                            every tree node/.style={draw,circle,inner sep=0pt,minimum size=3pt},
                            edge from parent path={(\tikzparentnode) -- (\tikzchildnode)},
            \Tree   [. \node[label=above:1] {}; 
                        \edge node[auto=left,pos=.6] {$B$};
                            [. \node[fill=black,label=below:{3,3}] {}; ]
                        \edge node[auto=right,pos=.6] {$A$};
                            [.\node[fill=black,label=above left:2] {}; 
                                \edge node[auto=left,pos=.6] {$D$};
                                    [.\node[fill=black,label=below:{1,1}] {}; ]
                                \edge node[auto=right,pos=.6] {$C$};
                                [.\node[fill=black,label=above left:1] {}; 
                                \edge node[auto=left,pos=.6] {$F$};
                                    [.\node[fill=black,label=below:{2,2}] {}; ]
                                \edge node[auto=right,pos=.6] {$E$};
                                    [.\node[fill=black,label=above left:2] {}; ] 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.