I'm working on a paper with several operations on Binary Tree, and I make a lot of posts related to the tree in the last weeks. At the moment I'm stuck because I need to customize one of the tree template proposed in one of the previous answers, In particular this answer
I result that I want to achieve is the following tree effect.
This is the tree where I want to put the previous effect before
\documentclass[12pt, margin=3mm]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta,
backgrounds,
fit}
\begin{document}
\begin{forest}
for tree = {
% nodes
circle, draw, fill=gray!30,
minimum size=1.5em, inner sep=0pt, outer sep=0pt,
/tikz/every label/.style = {font=\tiny},
/tikz/FIT/.style = {draw, very thick, rounded corners, fill=gray!30,
inner sep=4pt, inner ysep=8pt, yshift=-4pt,
fit=#1},
% tree
/tikz/every edge/.style={draw=gray, -Straight Barb,
-Straight Barb, shorten >=3pt, shorten <=3pt,
bend angle = 15},% style for bended arrows
edge=semithick,
l sep=4mm,
s sep=12mm,
where level=3{l sep=11mm}{},% at level 3 increase l sep
where level=4{no edge, very thick, fill=white}{},
}% level 4 is the lowest
[11, label=below:{1:[0,7]}, name=t0
[13, label=below:{2:[0,3]}, name=t11
[17, label=below:{4:[0,1]}, name=t21
[18, thick, label=below:{8:[0,0]}
[18, label=below:0]
]
[17, draw=none, fill=gray,thick, label=below:{9:[1,1]}, name=t31
[17, label=below:1, name=n1]
]
]
[13, draw=none,fill=gray, label=below:{5:[2,3]}
[13, very thick, label=below:{10:[2,2]}
[13, draw=none, fill=gray, label=below:2]
]
[19, very thick, label=below:{11:[3,3]}
[19, label=below:3, name=n3]
]
]
]
[11, very thick,edge=thick, label=below:{3:[4,7]}
[11, thick,edge=thick,
[15, thick,edge=thick,
[15, label=below:4]
]
[11, very thick,edge=thick,
[13, label=below:5]
]
]
[20, very thick,edge=thick,
[20, very thick,edge=thick,
[13, label=below:6]
]
[99, very thick,edge=thick,,
[13, label=below:7]
]
]
]
]
\end{forest}
\end{document}
In other words, I need to make a separate tree (yellow) tree in the picture that gives me the possibility to attach some nodes to some nodes of the previous tree (blue).
I'm trying to simulate a persistent data structure, and this data structure reuse some node of the old tree to make a new tree (partially new tree)
My idea is to make one single tree and join the node as an arch but it looks very bad with my actual code and I have difficulties to customize to active my object.