2

I want to draw a tree that will continue with more children after the edge from the parent note denoted as H: (thank you for the contributors here)

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,decorations.pathreplacing, trees}
\usepackage{bm}

\begin{document}
% 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,fill=white}
}
\begin{tikzpicture}[scale=1.5,font=\footnotesize]
\tikzstyle{level 1}=[level distance=10mm,sibling distance=30mm]
\tikzstyle{level 2}=[level distance=15mm,sibling distance=10mm]
\tikzstyle{level 3}=[level distance=15mm,sibling distance=10mm]
% The Tree
\node(0)[solid node,label=above:{$Nature$}]{} 
child{node(1)[solid node, fill=white,text=black]{$L$}
child{[black] node(11)[solid node, fill=white, label=below:{$$}]{}}
child{[black] node(12)[solid node,fill=white, label=below:{$$}]{}}
edge from parent node[left]{$p$}
edge from parent node[black, xshift=-35,yshift=-85]{$\bm{x}^{L}_{1}$} 
}
child{node(2)[solid node, fill=white,text=black]{$H$}
child{[black] node(41)[hollow node, fill=white, label=below:{$$}]{}}
child{[black] node(42)[hollow node,fill=white, label=below:{$$}]{}}
edge from parent node[right]{$1-p$}
edge from parent node[black, xshift=35,yshift=-85]{$\bm{x}^{H}_{1}$} 
edge from parent node[black, xshift=-95,yshift=-110]{$H$} 
};
% information set
    \draw[dashed,bend right](11)to(12);
        \draw[dashed,bend right](41)to(42);
\end{tikzpicture}
\end{document}

I am having trouble to continue the tree after this edge from the parent tree. I've tried many different ways but all the child nodes I add there come from the child nodes above and not from this new edge. Ideally I want this:

enter image description here

Than you!

2 Answers 2

3

You can for example start a new tree. Note below I added the x_1^L node by using

\path (11) -- node (H) {$\bm{x}^{L}_{1}$} (12);

instead of the edge from parent node with some x- and y-shift I guess you found by trial and error. The next tree can then be initiated with

\node [below=3mm] at (H)

You also seem to be consistently use solid node,fill=white, instead of using hollow node directly, so I modified all of those as well.

output of code

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,decorations.pathreplacing, trees}
\usepackage{bm}

\begin{document}
% 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,fill=white}
}
\begin{tikzpicture}[
 scale=1.5,font=\footnotesize,
 level 1/.style={level distance=10mm,sibling distance=30mm},
 level 2/.style={level distance=15mm,sibling distance=10mm},
 level 3/.style={level distance=15mm,sibling distance=10mm}
]
% The Tree
\node(0)[solid node,label=above:{Nature}]{} 
child{node(1)[hollow node]{$L$}
child{[black] node(11)[hollow node]{}}
child{[black] node(12)[hollow node]{}}
edge from parent node[left]{$p$}
}
child{node(2)[hollow node]{$H$}
child{[black] node(41)[hollow node, ]{}}
child{[black] node(42)[hollow node,]{}}
edge from parent node[right]{$1-p$}
};
% information set
  \draw[dashed,bend right](11)to(12);
  \draw[dashed,bend right](41)to(42);

\path (11) -- node (H) {$\bm{x}^{L}_{1}$} (12);
\path (41) -- node {$\bm{x}^{H}_{1}$} (42);

% scope env to locally redefine level 1 style
\begin{scope}[
  level 1/.style={sibling distance=10mm}
]
\node [below=4mm,hollow node] at (H) {$H$}
   child{ node[hollow node] {}
          edge from parent node[left] {$A$}
        }
   child{ node[hollow node] {} 
          edge from parent node[right] {$R$}
         }
;
\end{scope}
\end{tikzpicture}
\end{document}
3
  • The code makes much more sense with your edits. The new tree idea is great and makes the code very intuitive too. Thank you @Torbjørn T.
    – Laura K
    Nov 10, 2017 at 14:24
  • I have a question: what does "at (H)" mean in the scope environment. I can see it positions the new initial node exactly where it should be but I can't play around with it.
    – Laura K
    Nov 10, 2017 at 15:08
  • @LauraK H is the name of the x^1_L node. Nov 10, 2017 at 15:13
2

Another solution to produce the hand drawn tree using the istgame package:

enter image description here

\documentclass{standalone}

\usepackage{istgame}

\begin{document}   

\begin{istgame}[font=\scriptsize]
\xtdistance{15mm}{30mm}
\istroot(0){Nature}
  \istb{p}[l] \istb{1-p}[r] \endist
\xtdistance{15mm}{6mm}
\istrooto(1)(0-1){L}
  \istb  \istb[draw=none]{}{x_1^L}[center]  \istb \endist
\xtInfoset[dashed,thin,bend right](1-1)(1-3)
\xtdistance{15mm}{20mm}
\istrooto(2)([yshift=-4mm]1-2){H}
  \istb{A}[l] \istb{R}[r] \endist
\end{istgame}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .