Simple Latex Code for Game Tree

Coding often kill your time. I tried to make a game tree at the last hour of submission of my assignment and it was so painful. I decided to share my effort to make a game tree from exercise Mas colell Microeconomic theory .


\begin{figure}
  \begin{center}
    \small
    \begin{tikzpicture}[thin,
      level 1/.style={sibling distance=40mm},
      level 2/.style={sibling distance=20mm},
      level 3/.style={sibling distance=15mm},
      every circle node/.style={minimum size=1.5mm,inner sep=0mm}]
      %start
      \node[circle,draw,label=above:$player 1$] (root) {}
        child {node{T0}
          edge from parent
            node[left] {$L$}}
        child { node [circle,fill,](node-S) {}
          child {node[circle,fill] (node-P) {}
              child {node {T1}
                edge from parent
                  node[left] {$x$}}
              child {node {$T2$}
                 edge from parent
                   node[right] {$y$}}
              edge from parent
                node[left] {$l$}}
          child {node[circle,fill] (node-R) {}
              child {node {T3}
                edge from parent
                  node[left] {$x$}}
              child {node {$T4$}
                 edge from parent
                   node[right] {$y$}}
              edge from parent
                node[right] {$r$}}
           edge from parent}
        child { node [circle,fill,] (node-T) {}
          child {node[circle,fill] (node-A) {}
              child {node {T5}
                edge from parent
                  node[left] {$x$}}
              child {node {T6}
                 edge from parent
                   node[right] {$y$}}
              edge from parent
                node[left] {$l$}}
          child {node[circle,fill] (node-B) {}
              child {node {$T7$}
                edge from parent
                  node[left] {$x$}}
              child {node {$T8$}
                 edge from parent
                   node[right] {$y$}}
              edge from parent
                node[right] {$r$}}
           edge from parent
             node[right] {$W$}};
      \draw [dashed] (node-A) -- (node-B)
         node[midway,above] {$1$};
      \draw [dashed] (node-S) -- (node-T)
         node[midway,above] {$2$};
       \draw [dashed] (node-P) -- (node-R)
         node[midway,above] {$1$};
    \end{tikzpicture}
    \end{center}
    \caption{From MWF Figure 7.Ex.1}
  \end{figure}

Comments

Popular posts from this blog

p value

About Me