tengo este codigo
\documentclass[10pt]{article}
\begin{document}
\tikzset{
solid node/.style={circle,draw,inner sep=1.5,fill=black},
hollow node/.style={circle,draw,inner sep=1.5}
}
\begin{tikzpicture}[grow = right, scale=1.5,font=\footnotesize]
\tikzstyle{level 1}=[level distance=15mm, sibling distance=15mm]
\tikzstyle{level 2}=[level distance=15mm, sibling distance=15mm]
\tikzstyle{level 3}=[level distance=15mm, sibling distance=15mm]
% The Tree
\node(0)[solid node,label=left:{$N$}]{}
child{node(1)[solid node, white]{}
}
child{[white] node(2)[solid node, xshift=20]{} %note that you need to adjust the yshift if you change the sibling distance
child{[black] node[hollow node,label=right:{$(a,b)$}]{} edge from parent node[below]{$C$}}
child{[black] node[hollow node,label=right:{$(c,d)$}]{} edge from parent node[above]{$D$}}
edge from parent node[black, xshift=40,yshift=0]{$\alpha$} %note that you need to adjust the yshift if you change the level distance
}
child{node(3)[solid node, white]{}
};
% information set
\draw[solid,bend right](1)to(3);
\draw[dashed,rounded corners=7]($(1)+(.25,-.25)$)rectangle($(3)+(-.25,.25)$);
\end{tikzpicture}
\end{document}
que produce este árbol
¿Cómo puedo doblar hacia la derecha el rectángulo? He probado este código:
\draw[dashed,rounded corners=7, bend right]($(1)+(.25,-.25)$)rectangle($(3)+(-.25,.25)$);
¡Pero no funciona! ¿Alguna idea? ¡Gracias!
Respuesta1
¿Como esto?
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{calc}
\tikzset{
solid node/.style={circle,draw,inner sep=1.5,fill=black},
hollow node/.style={circle,draw,inner sep=1.5}
}
\begin{document}
\begin{tikzpicture}[grow = right, scale=1.5,font=\footnotesize]
\tikzstyle{level 1}=[level distance=15mm, sibling distance=15mm]
\tikzstyle{level 2}=[level distance=15mm, sibling distance=15mm]
\tikzstyle{level 3}=[level distance=15mm, sibling distance=15mm]
% The Tree
\node(0)[solid node,label=left:{$N$}]{}
child{node(1)[solid node, white]{}
}
child{[white] node(2)[solid node, xshift=20]{} %note that you need to adjust the yshift if you change the sibling distance
child{[black] node[hollow node,label=right:{$(a,b)$}]{} edge from parent node[below]{$C$}}
child{[black] node[hollow node,label=right:{$(c,d)$}]{} edge from parent node[above]{$D$}}
edge from parent node[black, xshift=40,yshift=0]{$\alpha$} %note that you need to adjust the yshift if you change the level distance
}
child{node(3)[solid node, white]{}
};
% information set
\draw[solid,bend right](1)to(3);
%\draw[dashed,rounded corners=7]($(1)+(.25,-.25)$)rectangle($(3)+(-.25,.25)$);
\coordinate (a) at ($(1.center)+(-.25,0)$);
\coordinate (b) at ($(1.center)+(.25,0)$);
\coordinate (c) at ($(3.center)+(.25,0)$);
\coordinate (d) at ($(3.center)+(-.25,0)$);
\draw[dashed,rounded corners=7] (1)--(b)to[bend right](c)--(d)to[bend left](a)--(1);
\end{tikzpicture}
\end{document}