# TikZ - game tree representation with continuum of moves

I have been using TikZ to draw game-trees for my game-theory lectures (mostly using the automata package) but I could not figure out how to draw an arc across the edges the leave a given node. When we want to denote that a player has a continuum of actions available at a node, we usually draw an arc across the edge leaving such node. For example see the arc crossing the edges that leave the first node in this picture: Any suggestions on how I could try to implement this in TikZ? Thanks!

Here you have a possible solution:

1.- place two coordinates over the edges (from TiKZ's manual section Edges From the parent node) and

2.- draw the arc between them. How? look at: Draw an arc between 2 nodes and label it in TikZ

\documentclass[border=3mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{trees}

\begin{document}
\begin{tikzpicture}[every node/.style={fill,circle,inner sep=2pt}]
\node (root) {}
child {node (a1) {} edge from parent coordinate[pos=.45] (a11)}
child {node (a2) {}}
child {node (a3) {} edge from parent coordinate[pos=.45] (a31)}
;
%\node at (a11) {};
%\node at (a31) {};
\draw[bend right] (a11) to (a31);
\end{tikzpicture}
\end{document}  Maybe this could help:

% 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]
% Specify spacing for each level of the tree
\tikzstyle{level 1}=[level distance=15mm,sibling distance=15mm]
\tikzstyle{level 2}=[level distance=15mm,sibling distance=15mm]
% The Tree
\node(0)[solid node,label=above:{$P1$}]{}
child{node(1)[solid node, white]{}
}
child{[white] node(2)[solid node, yshift=-20]{}  %note that you need to adjust the yshift if you change the sibling distance
child{[black] node[hollow node,label=below:{$(a,b)$}]{} edge from parent node[left]{$C$}}
child{[black] node[hollow node,label=below:{$(c,d)$}]{} edge from parent node[right]{$D$}}
edge from parent node[black, xshift=0,yshift=-42]{$\alpha$} %note that you need to adjust the yshift if you change the level distance
}
child{node(3)[solid node, white]{}
};
% information set
\draw[dashed,bend right](1)to(3);
\end{tikzpicture}


forest offers a powerful way to draw trees and the angles library provides a pic for drawing the angles.

A brief introduction to forest and an explanation of how to specify a tree using its bracket syntax is included in the second part of my answer to a related question.

The specific solution given here defines some styles for drawing the tree which need a little explanation.

The most important is a style cont for nodes from which the outcome is given by a continuum rather than a discrete set of possibilities.

  cont/.style={
before typesetting nodes={
append={[]},
prepend={[]},
afterthought={
\path (!1) coordinate (1) -- (!c) coordinate (c) -- (!l) coordinate (l)
let \p1 = ($(c) - (!2)$),
\n1 = {veclen(\x1,\y1)}
in pic [draw, angle radius=\n1] {angle=1--c--l};
},
},
}

• before typesetting nodes just delays execution until a later drawing cycle, while ensuring stuff is set before the nodes are typeset.
• append and prepend are used to add an empty node on each side of the main child (one before and one after).
• afterthought contains TikZ code to be executed later. (I tried the tikz key but this lost the label for some reason.)
• The initial \path just defines some coordinates relative to the current node: (!1) for the first child, (!l) for the last and (!c) for the current node.

To use this, you just add cont to the relevant node.

I've also added result label and calc label for adding labels along the edges of the tree. Each of these takes a single argument. The first typesets a text label above the edge. The second a maths label below the edge. Complete code:

\documentclass[tikz,border=20pt]{standalone}
\usepackage{forest}
\usetikzlibrary{angles}
\begin{document}
\forestset{
result label/.style={
edge label/.wrap value={##1 node [midway, sloped, above, anchor=south] {#1}}
},
calc label/.style={
edge label/.wrap value={##1 node [midway, below, sloped, anchor=north] {$#1$}}
},
cont/.style={
before typesetting nodes={
append={[]},
prepend={[]},
afterthought={
\path (!1) coordinate (1) -- (!c) coordinate (c) -- (!l) coordinate (l)
let \p1 = ($(c) - (!2)$),
\n1 = {veclen(\x1,\y1)}
in pic [draw, angle radius=\n1] {angle=1--c--l};
},
},
}
}
\begin{forest}
for tree={
parent anchor=south,
child anchor=north,
l sep+=50pt,
s sep+=30pt,
if n children=0{
align=center,
if n=1{result label=Fail}{result label=Succeed},
}{
draw,
circle,
minimum width=2.5pt,
delay={
label/.wrap pgfmath arg={right:#1}{content()},
content=,
},
inner sep=0pt,
outer sep=0pt,
},
},
/tikz/every label/.style={label distance=20pt}
[Targets choose deterrence, cont
[Terrorists decide whom to attack
[, result label=Attack business, calc label=\pi_B
[$D(\theta_B) + A$\\$D(\theta_T) + 0$\\$m_B$, calc label=\theta_B
]
[$D(\theta_B) + H$\\$D(\theta_T) + 0$\\$n_B$, calc label=1-\theta_B
]
]
[, result label=Attack tourists, calc label={1-\pi_B=\pi_T}
[$D(\theta_B) + \alpha$\\$D(\theta_T) + A$\\$m_T$, calc label=\theta_T
]
[$D(\theta_B) + h$\\$D(\theta_T) + H$\\$n_T$, calc label=1-\theta_T
]
]
]
]
\end{forest}
\end{document}


Another example to use the istgame package (version 2.0): \documentclass{standalone}
\usepackage{amsmath}
\usepackage{istgame}

\begin{document}

\begin{istgame}[font=\scriptsize]
\cntmApreset{.8}
\istrootcntmA(0)<45>{Targets choose deterrence}+15mm..30mm+
\istbA \endist
\xtCommentTo[draw=none](0)(.5,.-.1){$D(\theta_B),D(\theta_T)$}[r]
\xtdistance{20mm}{40mm}
\setistmathTF001[textur]
\istroot(1)(0-1)+20mm..70mm+
\istB{Attack Business}[above,sloped]{$\pi_B$}[br]
\istB{Attack Tourist}[above,sloped]{$1-\pi_B=\pi_T$}[bl]
\endist
\xtCommentTo[draw=none](1)(.5,.-.1){Terrorists decide whom to attack}[r]
\istroot(2)(1-1)[chance node]
\istB{Fail}[above,sloped]{$\theta_B$}[br]
{\begin{matrix}D(\theta_B)+A\\D(\theta_T)+0\\m_B\end{matrix}}
\istB{Succeed}[above,sloped]{$1-\theta_B$}[bl]
{\begin{matrix}D(\theta_B)+H\\D(\theta_T)+0\\n_B\end{matrix}}
\endist
\istroot(3)(1-2)[chance node]
\istB{Fail}[above,sloped]{$\theta_T$}[br]
{\begin{matrix}D(\theta_B)+a\\D(\theta_T)+A\\m_T\end{matrix}}
\istB{Succeed}[above,sloped]{$1-\theta_T$}[bl]
{\begin{matrix}D(\theta_B)+h\\D(\theta_T)+H\\n_T\end{matrix}}
\endist
\end{istgame}

\end{document}