# How to draw an arc between edges connecting child nodes?

I have the following code to generate a couple of trees. How do I draw arcs between the edges (marked in red in the figure)?

\usetikzlibrary{intersections}
\begin{tikzpicture}

\node {Goto(P$_A$)} [grow'=up]
child {node { Say(A,P$_A$)}}
child {node {IsTrue(A)}
};
\begin{scope}[xshift=4.5cm]
\node {Goto(P$_B$)} [grow'=up]
child { node [left=0cm]{ Goto(P$_B$)}
child {node (sayb) { Say(B,P$_B$)}}
child {node (istrueb) {IsTrue(B)}}
}
child {node [right=0cm]{ Goto(P$_B$)}
child {node { Say(C,P$_B$)}}
child {node {IsTrue(C)}}
};
\end{scope}
\end{tikzpicture}


May be there are easier solutions but next one works. It draws a circle with center on parent anchor which is clipped inside a triangle with vertices in parent anchor and child centers.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{intersections}

\newcommand\myarc[4]{\begin{scope}[very thick,red]
\clip (#1)--(#2)--(#3)--cycle;
\draw (#1) circle (#4);\end{scope}}

\begin{document}
\begin{tikzpicture}

\node (rootA) {Goto(P$_A$)} [grow'=up,parent anchor=north]
child {node { Say(A,P$_A$)}}
child {node {IsTrue(A)}
};

\begin{scope}[xshift=4.5cm]
\node (rootB) {Goto(P$_B$)} [grow'=up, parent anchor=north]
child { node [left=0cm]{ Goto(P$_B$)}
child {node (sayb) { Say(B,P$_B$)}}
child {node (istrueb) {IsTrue(B)}}
}
child {node [right=0cm]{ Goto(P$_B$)}
child {node { Say(C,P$_B$)}}
child {node {IsTrue(C)}}
};

\end{scope}

\myarc{rootA.north}{rootA-1.center}{rootA-2.center}{5mm}
\myarc{rootB.north}{rootB-1.center}{rootB-2.center}{6mm}
\myarc{rootB-1.north}{sayb.center}{istrueb.center}{5mm}
\myarc{rootB-2.north}{rootB-2-1.center}{rootB-2-2.center}{5mm}

\end{tikzpicture}
\end{document}


Update

If you uses TikZ 3.0 you can use angles library which defines a pic angle

Pic type angle=<A>--<B>--<C>

This pic adds a drawing of an angle to the current path. This “drawing of an angle” consist of a “sector” or “wedge” or “slice” whose pointed end is at point and whose straight sides lie on the lines form to and from to . [...] The three points <A>, <B>, and <C> must be the names of nodes or coordinates; you cannot use direct coordinates like “(1,1)” here.

Last sentence creates a little problem because is not possible to use rootA.north as one of three point, it's necessary to convert it into a coordinate. It accepts rootA which means rootA.center.

Code with angles is:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{angles}

\begin{document}
\begin{tikzpicture}

\node (rootA) {Goto(P$_A$)} [grow'=up]
child {node { Say(A,P$_A$)}}
child {node {IsTrue(A)}
};

\draw pic[draw, red, thick, angle radius=8mm] {angle=rootA-2--rootA--rootA-1};

\begin{scope}[xshift=4.5cm]
\node (rootB) {Goto(P$_B$)} [grow'=up, parent anchor=north]
child { node [left=0cm]{ Goto(P$_B$)}
child {node (sayb) { Say(B,P$_B$)}}
child {node (istrueb) {IsTrue(B)}}
}
child {node [right=0cm]{ Goto(P$_B$)}
child {node { Say(C,P$_B$)}}
child {node {IsTrue(C)}}
};

\end{scope}

\draw (rootB.north) coordinate (A)
{angle=rootB-2--A--rootB-1};

\draw (rootB-1.north) coordinate (A)
{angle=istrueb--A--sayb};

\draw (rootB-2.north) coordinate (A)
pic[draw, blue, very thick, angle radius=3mm]
{angle=rootB-2-2--A--rootB-2-1};

\end{tikzpicture}
\end{document}


This is one possible solution. Since there were no sibling distance information, this solution assumes its own. Basically, internal names are given for each node and calc is used to determine the starting and ending points via ($(name1)!0.5!(name2)$), then draw the arc by, for example,

\draw ($(o)!0.5!(A)$) to[bend left=30]  ($(o)!0.5!(B)$);


Code

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{trees,calc}
\usetikzlibrary{intersections}
\begin{document}

\begin{tikzpicture}[level distance=2cm,
level 1/.style={sibling distance=3cm},
level 2/.style={sibling distance=2cm},
]
\node (o) {Goto(P$_A$)} [grow'=up]
child {node (A) {Say(A,P$_A$)}}
child {node (B){IsTrue(A)}
};
\draw[red,very thick] ($(o)!0.5!(A)$) to[bend left=30]  ($(o)!0.5!(B)$);

\begin{scope}[xshift=6.5cm]
\node {Goto(P$_B$)} [grow'=up]
child { node (B) [left=0cm]{ Goto(P$_B$)}
child {node (sayb) { Say(B,P$_B$)}}
child {node (istrueb) {IsTrue(B)}}
}
child {node (C)[right=0cm]{ Goto(P$_B$)}
child {node (sayc)  {Say(C,P$_B$)}}
child {node (istruec){IsTrue(C)}}
};
\draw[red,very thick] ($(B)!0.5!(sayb)$) to[bend left=30]  ($(B)!0.5!(istrueb)$);
\draw[red,very thick] ($(C)!0.5!(sayc)$) to[bend left=30]  ($(C)!0.5!(istruec)$);
\end{scope}
\end{tikzpicture}

\end{document}