I searched online and in stack overflow for how to add a label to a straight dashed information set but was not successful. I see suggestions to add a label to a curved dashed information set but when I add them to my code for a straight information set, they do not work.
Does anyone have any suggestions? I attached an image of what I am trying to do. Thank you in advance.
I tried this but it did not work:
\draw[dashed, label=above right:{my label}](0-1)to(0-2);
This did not work too:
\node at($(0-1)!.5!(0-2)$){my label};
Here is my code.
\begin{tikzpicture} [scale=1.5] %[scale=1.5,font=\footnotesize]
\tikzstyle{solid node} =[circle,draw,inner sep=1.5,fill=black]
\tikzstyle{hollow node}=[circle,draw,inner sep=1.5]
\tikzstyle{level 1}=[level distance=15mm,sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=15mm,sibling distance=2.5cm]
\tikzstyle{level 3}=[level distance=15mm,sibling distance=1cm]
\node(0)[hollow node,label=above:{ }]{}
child{node[solid node]{}
child{node[hollow node,label=below:{$(1,2)$}]{} edge from parent node[left]{a}}
child{node[hollow node,label=below:{$(1,-1)$}]{} edge from parent node[left]{b}}
%child{node[hollow node,label=below:{$(0,2)$}]{} edge from parent node[right]{$E$}}
edge from parent node[left,xshift=-5]{action1}
}
child{node[solid node]{}
child{node[hollow node,label=below:{$(2,2)$}]{} edge from parent node[left]{a}}
child{node[hollow node,label=below:{$(1,3)$}]{} edge from parent node[right]{b}}
edge from parent node[right,xshift=5]{action2}
};
\draw[dashed, label=above right:{my label}](0-1)to(0-2);
\end{tikzpicture}





labela path but you can place a node along it:\draw[dashed] (0-1) to node[above]{label} (0-2);– Qrrbrbirlbel Nov 19 '22 at 22:01forestpackage and TikZ owngraphslibrary? Thechildoperation is quite cumbersome and I'd argue outdated. – Qrrbrbirlbel Nov 19 '22 at 22:03{:label={[align=center]below:{$(1,2)$\\$(3,4)$}}– Qrrbrbirlbel Nov 20 '22 at 03:04