---
title: Ordered Leaf Attachment (OLA)
url: https://www.emergentmind.com/topics/ordered-leaf-attachment-ola
type: topic
---

# Ordered Leaf Attachment (OLA)

Searching arXiv for recent papers on Ordered Leaf Attachment and related tree/phylogenetic formulations.
Searching arXiv for "Ordered Leaf Attachment" and closely related phrases.
Ordered Leaf Attachment (OLA) denotes a family of tree constructions in which leaves are added, reattached, or encoded relative to a prescribed order. In combinatorics, ordered full binary trees provide a canonical setting in which leaves inherit a left-to-right order and path statistics can be indexed by penetration and separation [1502.07893]. In algorithmic generation, OLA appears as the minimal operation “remove a leaf then append a leaf elsewhere” on rooted ordered trees [2207.01129]. In stochastic growth, it is a time-ordered rule in which new vertices attach probabilistically to current leaves [2010.05589]. In phylogenetics, OLA is a vector encoding of rooted binary trees with ordered leaves, with linear-time encoding and decoding, and it induces order-dependent dissimilarity measures that connect to hybridization and reticulation theory [2503.10169; 2507.11254; 2509.16405]. A distinct but related spectral formulation studies repeated leaf addition at a fixed vertex and its effect on the Ricci matrix and discrete Einstein curvature of a tree [2605.23379].

## 1. Scope and principal formulations

The literature uses “ordered leaf attachment” across several technically distinct but structurally related settings. In each case, the order of leaf operations is not incidental: it is the object that determines either geometry, enumeration, dynamics, encoding, or spectral evolution.

| Formulation | Underlying object | Principal quantity |
|---|---|---|
| Ordered Catalan model | Ordered full binary trees | Leaf depth and leaf-to-leaf distance |
| Gray-code operation | Rooted ordered trees | Delete-and-append adjacency |
| Bayesian growth | Time-ordered rooted trees | Posterior distribution over leaves |
| Phylogenetic encoding | Rooted binary phylogenetic trees | Integer vector representation |
| Reticulation-aware OLA | Sets of rooted phylogenetic trees | Corrected OLA distance and MAAF |
| Spectral leaf attachment | Trees with repeated pendant-edge addition | Largest eigenvalue of the Ricci matrix |

The common structural theme is that leaf placement is recorded relative to an existing tree and an ordering convention. What varies is the ambient category: plane trees, time-ordered rooted trees, rooted phylogenetic \(X\)-trees, or edge-indexed spectral operators. This suggests that OLA is best understood not as a single invariant but as a methodological paradigm for extracting information from the sequence in which leaves are introduced or repositioned.

## 2. Ordered leaves in Catalan trees

A natural combinatorial model for OLA is the space of ordered full binary trees with \(n\) internal vertices. These trees are rooted, every internal vertex has exactly two children, and if there are \(n\) internal vertices then there are \(L=n+1\) leaves. Because children have a left/right order, the leaves inherit a canonical left-to-right ordering along the bottom boundary. This is precisely the setting in which ordered leaf positions can be indexed and compared [1502.07893].

Two notions organize the geometry. A leaf has penetration \(p\) if it is the \((p+1)\)-st leaf from the left, so \(p=0\) is the leftmost leaf and \(p=n\) is the rightmost leaf. For a pair of leaves at positions \(i<j\), the separation is
\[
s=j-i-1,
\]
that is, the number of leaves in between. Adjacent leaves therefore have \(s=0\). The paper studies the unique simple path between two ordered leaves and derives an exact identity between averaged leaf-to-leaf and root-to-leaf geometry:
\[
\mathcal{A}^{(s)}_n=d^{(s)}_n.
\]
Thus the average leaf-to-leaf distance for separation \(s\) is exactly equal to the average depth of the leaf of penetration \(s\).

The calculation is built from Catalan enumeration. The trees are counted by
\[
C_n=\frac{1}{n+1}\binom{2n}{n}=\frac{(2n)!}{(n+1)!n!},
\]
with generating function
\[
C(x)=\sum_{n=0}^{\infty} C_n x^n,
\]
satisfying the quadratic functional equation
\[
C(x)=1+x^2C(x)^2.
\]
The paper’s central methodological device is a diagrammatic representation of generating functions in which annotated edge types encode constrained subtrees and marked paths. This permits exact recursions for rooted paths, leaf penetrations, and leaf-to-leaf paths.

For ordered leaves, the resulting asymptotics are especially significant. In the large-\(n\) limit at fixed separation,
\[
\mathcal{A}_\infty^{(s)}=\frac{(s+1)(2s+1)}{4^{\,s-1} C_s}-1,
\]
and in the regime \(0\ll s\ll n\),
\[
\mathcal{A}_\infty^{(s)}\sim \sqrt{\frac{64 s}{\pi}}.
\]
Hence the average leaf-to-leaf distance grows as \(\sqrt{s}\) for large ordered separation. In this Catalan ensemble, OLA is therefore associated with a sublinear but unbounded distance law, unlike the geometry of complete binary trees.

## 3. Local leaf operations and stochastic growth

A second line of work treats OLA as an explicit local move on ordered trees. In Nakano’s Gray code for rooted ordered trees with \(n\) vertices, each successive tree is obtained from the preceding one by “removing a leaf then appending a leaf elsewhere,” and the paper emphasizes that this change is minimal: “other vertices remain as they were including their levels” [2207.01129]. The construction uses the rightmost path \(P_r(T)\), the rightmost leaf, and the parent map \(p(T)\) obtained by removing the rightmost leaf. Child trees are generated by appending a new leaf as the rightmost child of a vertex on \(P_r(T)\) at a specified level. The resulting family tree \(F_n\) organizes all ordered trees by repeated rightmost-leaf deletion, and a suitable left-to-right ordering of its children yields a Gray code in which adjacent trees differ by exactly one delete-and-append operation.

This formulation makes OLA a notion of adjacency on tree space. Two ordered trees are adjacent when one can be derived from the other by changing the parent of a single leaf while respecting sibling order. The paper proves the existence of such a Gray code and states that, by constructing the necessary part of \(F^O_n\) on the fly, one can generate each ordered tree in a Gray code for \(S_n\) in \(O(n^2)\) time for each ordered tree.

A probabilistic formulation appears in time-ordered rooted trees grown by attachment of new vertices to current leaves [2010.05589]. The model is directed and explicitly time-ordered: vertices are created at discrete times, edges point backward in time, and only new vertices may issue attachments. The governing rules are that each new vertex issues exactly one attachment, a new vertex may only attach to a leaf, and a leaf can receive multiple attachments from different new vertices created in the same time interval. At time \(t\), the current leaf set \(\mathscr{L}_t\) is updated dynamically as new vertices attach.

The attachment probabilities are Bayesian. For each current leaf \(\ell\), the history \(H\) is summarized by the directed ordered path \(\ell \twoheadrightarrow r\) from the leaf to the root. The paper defines likelihoods either globally,
\[
\Pr(H\mid \ell)=|\ell \twoheadrightarrow r|,
\]
or locally as a product of attachment multiplicities along the path. Combined with a prior \(\Pr(\ell)\), typically uniform, this yields the posterior
\[
\Pr(\ell\mid H)=\frac{\Pr(H\mid \ell)\Pr(\ell)}{\Pr(H)}.
\]
New vertices then sample attachment points from this posterior leaf distribution. In this sense, OLA becomes a time-ordered stochastic growth rule in which attachment favors leaves whose paths to the root have stronger merging structure.

## 4. OLA as a phylogenetic vector encoding

In phylogenetics, OLA is a concrete encoding of rooted, binary trees with ordered leaves as integer vectors [2503.10169]. The basic setting is a rooted, binary tree with \(n\) leaves labeled \(0,1,\dots,n-1\), where the labels encode a fixed linear order of the leaves. Internal nodes are canonically labeled by negative integers. Two auxiliary quantities are used: the clade-founder label \(CF(v)\) and the clade-splitter label \(CS(v)\), with canonical internal label
\[
\labelfn(v)=-CS(v).
\]
Algorithm 1 of the paper assigns internal labels \(-1,\dots,-(n-1)\) and defines a bijection between internal nodes and these labels.

The OLA encoding then records, for each leaf \(i\), the label of the sister node next to which the leaf was attached during a reverse construction. This yields a map
\[
\Phi:\mathcal{T}_n\to C_{n-1},
\]
where
\[
C_{n-1}=\{(a_1,\dots,a_{n-1})\in\mathbb{Z}^{n-1}:-i<a_i<i \text{ for each } i\}.
\]
The paper proves that encoding and decoding define inverse bijections
\[
\Phi : \mathcal{T}_n \to C_{n-1}, \quad \Psi : C_{n-1} \to \mathcal{T}_n,
\]
and that both encoding and decoding have time complexity \(O(n)\). The image of tree space is therefore a simply-described subset of integer sequences with coordinate-wise constraints.

Because OLA maps trees to vectors, it induces a distance by Hamming comparison of coordinates. If
\[
\Phi(T)=(a_1,\dots,a_{n-1}), \quad \Phi(T')=(b_1,\dots,b_{n-1}),
\]
then the OLA distance is the Hamming distance between these vectors. This gives a metric on \(\mathcal{T}_n\), but it is sensitive to leaf order and can respond strongly to local rearrangements. The same paper shows a worst-case phenomenon: a single NNI move can induce OLA distance \(n-2\), and a single SPR move can also induce OLA distance \(n-2\). At the same time, it proves an average-case bound for random NNI neighbors:
\[
\mathbb{E}[d_{\mathrm{OLA}}(T,T')] \le 4.
\]

The encoding is motivated partly by machine learning. The paper positions OLA as a bridge between phylogenetic tree space and vector spaces, enabling clustering, dimensionality reduction, generative models, and random walks on \(C_{n-1}\). It also describes an extension to trees with branch lengths by augmenting the OLA code with two real-valued rows, \(\text{up}_i\) and \(\text{down}_i\).

## 5. Order dependence, hybridization, and corrected OLA distances

A later comparison paper studies OLA together with Phylo2Vec and HOP as order-dependent vector representations for rooted phylogenetic \(X\)-trees [2507.11254]. Under a fixed ordering \(\sigma\), OLA defines a vector \(\mathbf{v}^\sigma_T\) and the distance
\[
d^\sigma_{\mathrm{OLA}}(T,T')
=
\big|\{i \in \{1,\ldots,n\} : \mathbf{v}^\sigma_T[i] \neq \mathbf{v}^\sigma_{T'}[i]\}\big|.
\]
For fixed \(\sigma\), this is a metric. After minimization over all orderings,
\[
d^*_{\mathrm{OLA}}(T,T')
=
\min\{d^\sigma_{\mathrm{OLA}}(T,T') : \sigma \text{ is an ordering on } X\},
\]
the result is only a dissimilarity measure: it is symmetric and non-negative, but it does not satisfy the triangle inequality in general.

The same paper shows that OLA has no direct relationship with rooted subtree prune and regraft distance, even though it admits a linear upper bound:
\[
d^*_{\mathrm{OLA}}(T,T') \le 28 \cdot d_{\mathrm{rSPR}}(T,T').
\]
It also proves that for each \(\Theta \in \{\mathrm{HOP},\mathrm{OLA},\mathrm{P2V}\}\),
\[
d^*_\Theta(T,T') \le h(T,T'),
\]
where \(h(T,T')\) is the hybrid number. Yet this upper bound can be strict for OLA and P2V, whereas HOP is exactly equivalent to the hybrid number. A different exact correspondence appears when orderings are restricted to those induced by common cherry-picking sequences. If \(S\) is a common CPS of weight \(wt(S)\) and \(\sigma\) is the induced ordering, then
\[
d^\sigma_{\mathrm{OLA}}(T,T') = d^\sigma_{\mathrm{P2V}}(T,T') = d^\sigma_{\mathrm{HOP}}(T,T') = wt(S),
\]
and consequently
\[
d_\Theta^{\mathrm{CPS}}(T,T') = h_t(T,T')
\]
for each \(\Theta \in \{\mathrm{OLA},\mathrm{P2V},\mathrm{HOP}\}\), where \(h_t\) is the temporal tree-child hybrid number.

A further development corrects the raw Hamming OLA distance so that it reflects reticulation structure faithfully [2509.16405]. For two trees \(T,T'\) and a fixed ordering \(\sigma\), the uncorrected distance is
\[
d_\sigma(T_1,T_2):=\|OLA(T_1,\sigma)-OLA(T_2,\sigma)\|_0.
\]
The paper shows that this quantity can be strictly smaller than the reticulation or hybridization number, because a later leaf may appear to match even when it is attached above an internal node already involved in a mismatch. The corrected OLA distance \(\hat d_\sigma\) propagates mismatches upward: if two equal entries are both \(-j\) and \(j\) is already in the mismatch set, the new index is also counted as mismatched.

For a set \(\mathcal{T}\) of \(k>1\) trees, the main theorem states that if \(\sigma^*\) minimizes the corrected OLA distance, then
\[
\hat{d}_{\sigma^*}(\mathcal{T}) = m(\mathcal{T}) = |\maaf(\mathcal{T})| - 1.
\]
Thus the minimal corrected OLA distance is exactly the reticulation number, equivalently the size of a maximum acyclic agreement forest minus \(1\). The paper also gives a constructive route from optimal OLA vectors to a MAAF and extends the framework to multifurcated trees. In that setting it introduces an \(O(kn \cdot m\log m)\) algorithm, where \(m\) is the size of the largest multifurcation, and proves that trees resolved via this algorithm also minimize the size of a MAAF.

These results clarify two common misconceptions. First, order dependence is not a superficial nuisance: changing the ordering can change OLA distances dramatically, and optimization over orderings is a substantive combinatorial problem. Second, raw OLA Hamming distance is not automatically reticulation-aware; the corrected OLA distance is needed for exact correspondence with MAAF size.

## 6. Spectral monotonicity under repeated leaf attachment

A distinct but conceptually adjacent formulation of OLA concerns the repeated addition of pendant edges at a fixed vertex and the resulting spectral evolution of the tree [2605.23379]. Let \(T\) be a finite tree, let \(v\in V\) have degree \(d=d_T(v)\), and let \(T_k\) be obtained from \(T\) by attaching \(k\) new pendant edges at \(v\). This produces a sequence \((T_k)_{k\ge 0}\) indexed by the number of leaf attachments.

The spectral object is the Ricci matrix \(R_T\in \mathbb{R}^{E\times E}\), whose entries are
\[
(R_T)_{e,e'}=
\begin{cases}
-\left(\dfrac1{d_x}+\dfrac1{d_y}\right), & e=e'=\{x,y\},\\[4pt]
\dfrac1{d_z}, & e\neq e',\ e\cap e'=\{z\},\\[4pt]
0, & e\cap e'=\varnothing.
\end{cases}
\]
Its largest eigenvalue determines the sign of a discrete Einstein metric curvature on the tree. Writing
\[
\lambda_k:=\lambda_{\max}(R_{T_k}),
\]
the paper proves that repeated leaf attachment at \(v\) has a limit controlled only by the local branch data around \(v\). If removing \(v\) yields branches \(C_1,\dots,C_d\) and associated Dirichlet branch matrices \(A_1,\dots,A_d\), then
\[
\lambda_k \longrightarrow \lambda_\infty := \max\bigl(0,\lambda_{\max}(A_1),\dots,\lambda_{\max}(A_d)\bigr).
\]

More precisely, the orbit-reduced matrices satisfy
\[
Q_k=Q_\infty+\frac{1}{d+k}B,
\]
and, when \(\lambda_\infty\) is simple,
\[
\lambda_k=\lambda_\infty+\frac{\alpha}{d+k}+O\!\left(\frac{1}{(d+k)^2}\right),
\qquad
\alpha:=\ell^{\mathsf T}Br.
\]
The paper then proves eventual strict monotonicity when \(\alpha\neq 0\): if \(\alpha>0\), the sequence is eventually strictly decreasing to \(\lambda_\infty\); if \(\alpha<0\), it is eventually strictly increasing to \(\lambda_\infty\).

In this spectral setting, OLA is not a vector encoding or a Gray-code move but a perturbative process. The ordered parameter is \(k\), the number of successive attachments at a single vertex, and the main conclusion is local-to-global: the asymptotic spectral and curvature behavior depends only on the local branch structure at the attachment point.

## 7. Conceptual synthesis

Across these formulations, OLA serves three recurrent functions. First, it imposes an order on leaves or leaf operations, thereby turning otherwise unordered tree topologies into objects with coordinate systems, penetrations, separations, or attachment histories. Second, it provides algorithmic locality: delete-and-append operations change one leaf, Bayesian growth samples from current leaves, and phylogenetic encoding records one attachment context per leaf. Third, it creates bridges between local construction rules and global invariants: Catalan averages yield \(\mathcal{A}^{(s)}_n=d^{(s)}_n\), vector encodings induce distances on tree space, corrected OLA distances recover reticulation numbers, and repeated pendant-edge addition yields asymptotically predictable Ricci spectra.

The main limitations are equally consistent across the literature. OLA constructions are typically rooted and order-dependent; optimizing over orderings can be difficult; raw coordinate-wise comparison may fail to capture deeper equivalence unless corrected or constrained; and extensions beyond binary rooted trees require additional machinery. Even so, the framework has become a technically precise language for studying ordered geometry in Catalan trees, minimal-change generation of plane trees, Bayesian leaf-growth processes, vector representations of phylogenetic topology, and spectral responses to repeated local attachment.

Source: https://www.emergentmind.com/topics/ordered-leaf-attachment-ola