all subtrees in ${\textbf{g}}{}$. The algorithm proceeds iteratively, adding and removing rows from $A$, iterating over an index $i$ going from $n-2$ to $1$. The first step is to define $A(i)$, the set of node allocations in the $i$-th column of $\mathbf{A}$. Then for all $V \in A(i)$, the algorithm iterates through the following steps: define $T_{V}$ as the set of child nodes of $V$ that have $|{\textbf{g}}_{i}|$ descendants. If the number of child nodes of $V$ is at least $3$, $V$ is also included in $T_{V}$. If $T_V=\emptyset$, for example if $V$ is a leaf node, the algorithm does nothing. If $|T_{V}|=1$, the algorithm replaces $V$ by the element of $T_{V}$ in the columns $I$ of $\textbf{A}$ corresponding to all subtrees of ${\textbf{g}}_{i}$. If $|T_{V}|>1$, the matrix $\mathbf{A}$ is augmented by stacking $|T_{V}|-1$ copies of $\mathbf{A}_{V}(,I)$, the submatrix of $\mathbf{A}$ obtained by extracting all the row vectors whose $I$-th elements are $V$. The original submatrix $\mathbf{A}_{V}(,I)$ is referred to as $\mathbf{A}^{(1)}_{V}(,I)$, and $\mathbf{A}^{(2)}_{V}(,I),\ldots,\mathbf{A}^{(|T_{V}|)}_{V}(,I)$ denote its copies. Lastly, the algorithm replaces $V$ by the first element of $T_{V}$ in $\mathbf{A}^{(1)}_{V}(,I)$, by the second element of $T_{V}$ in $\mathbf{A}^{(2)}_{V}(,I)$ and so on, until the last element of $T_{V}$ is substituted in 