Skip to main content
Fig. 2 | Algorithms for Molecular Biology

Fig. 2

From: Linear-time algorithms for phylogenetic tree completion under Robinson–Foulds distance

Fig. 2

Algorithm for ROT-RF(+). Given S and T as shown in the left column of the figure, Algorithm OneTreeCompletion first colors each node of S either green (circles), red (stars), or blue (squares) as shown in the middle column of the figure. A node is colored green if all leaves in the subtree rooted at that node are present in both S and T, red if all leaves in that subtree are present only in S, and blue if that subtree has both green and red descendants. If a blue node v has exactly one red child, then it is “marked”. In this example, \(s_1\) and \(s_4\) are marked nodes, highlighted in the figure by the double perimeter around the blue (square) nodes. The algorithm then computes the LCA mapping, defined to be \(\textit{lca}_{T}({{\,\mathrm{\textit{Le}}\,}}(S(v)) \cap {{\,\mathrm{\textit{Le}}\,}}(T))\), for each green or blue node v of S. These LCA mappings appear in the square boxes on S in the middle column. The algorithm then performs a pre-order traversal of S, grafting copies of the red subtrees at each marked node onto the appropriate edges of T. The grafted subtrees are shown using dashed red lines on \(T'\) in the right column. Tree \(T'\) is an optimal completion of T on \({{\,\mathrm{\textit{Le}}\,}}(S)\)

Back to article page