Skip to main content

This is a preprint.

It has not yet been peer reviewed by a journal.

The National Library of Medicine is running a pilot to include preprints that result from research funded by NIH in PMC and PubMed.

ArXiv logoLink to ArXiv
[Preprint]. 2025 Dec 2:arXiv:2510.27030v3. [Version 3]

Generalizing matrix representations to fully heterochronous ranked tree shapes

Chris Jennings-Shaffer 1,6, Cherith Chen 2, Julia A Palacios 2,3,*, Frederick A Matsen IV 1,4,5,6,*
PMCID: PMC12636760  PMID: 41281197

Abstract

Phylogenetic tree shapes capture fundamental signatures of evolution. We consider “ranked” tree shapes, which are equipped with a total order on the internal nodes compatible with the tree graph. Recent work has established an elegant bijection of ranked tree shapes and a class of integer matrices, called F-matrices, defined by simple inequalities. This formulation is for isochronous ranked tree shapes, where all leaves share the same sampling time, such as in the study of ancient human demography from present-day individuals. Another important style of phylogenetics concerns trees where the “timing” of events is by branch length rather than calendar time. This style of tree, called a rooted phylogram, is output by popular maximum-likelihood methods. These trees are broadly relevant, such as to study the affinity maturation of B cells in the immune system. Discretizing time in a rooted phylogram gives a fully heterochronous ranked tree shape, where leaves are part of the total order. Here we extend the F-matrix framework to such fully heterochronous ranked tree shapes. We establish an explicit bijection between a class of F-matrices and the space of such tree shapes. The matrix representation has the key feature that values at any entry are highly constrained via four previous entries, enabling straightforward enumeration of all valid tree shapes. We also use this framework to develop probabilistic models on ranked tree shapes. Our work extends understanding of combinatorial objects that have a rich history in the literature.

Introduction

Evolution is the unifying theme of biology, and it operates in diverse modes. These modes can be seen in the structure of phylogenetic trees [1]. For example, the tree of influenza has a highly “imbalanced” shape, which comes from intense evolutionary selective pressure from host immunity, in contrast with the trees of other viruses [2]. Scientists characterize these modes of evolution by studying phylogenetic tree “shapes”: rooted bifurcating tree graphs without leaf labels.

An elegant means of characterizing tree shapes has recently been developed, which includes information about relative ordering of nodes in addition to graph structure [3, 4]. This relative ordering is expressed in terms of a ranking, i.e., a total ordering of the internal nodes of the tree. The combination of the tree shape and relative ordering defines a “ranked tree shape.” There is a bijection between such ranked tree shapes and a class of integer-valued matrices, called “F-matrices”, which are characterized by simply-expressed inequalities [3, 4]. By recording information about the order of events on the tree, this formulation enables richer comparison than tree structure alone. However, the existing formulation of F-matrices is limited to “isochronous” ranked tree shapes (Figure 1, left) in which all the leaves of the tree are assumed to have been sampled at the same time, or at least at known fixed sampling times. This makes perfect sense in the setting of “time trees” (a.k.a. chronograms): phylogenetic trees with nodes labeled by calendar time and leaf nodes representing molecular sequences with known sampling times. Such trees result from inference done using software such as BEAST [5, 6, 7] or TreeTime [8].

Figure 1:

Figure 1:

Left: an isochronous tree shape; an F-matrix bijection has been established for such objects [3, 4]. Right: a fully heterochronous tree shape; the present manuscript establishes an analogous bijection between these objects and a class of F-matrices. The two trees are isomorphic as graphs, but are not the same type of ranked tree shape. On the left isochronous tree, internal nodes have unique ranks and leaves share a common rank. We mark leaves in gray to indicate that they do not form part of the “data” encoded by the ranked tree. On the right fully heterochronous tree, all nodes have unique ranks and the rank of a leaf may be less than the rank of an internal node.

There is another type of tree analysis that simply represents the phylogenetic tree without timing constraints, letting the length of each edge represent the amount of evolution that has happened along that edge. This structure is called a “rooted phylogram”. Phylograms are the inferential output of software such as IQ-TREE [9] and RAxML [10].

One may wish to use rooted phylograms to study patterns of evolution in systems where dates are not available or relevant. For example, in B cell affinity maturation, the evolutionary structure of the phylogenetic tree is determined by a relatively short period in the germinal center, after which the resulting cells circulate for longer as memory B cells without further mutation [11]. Due to this two-part process the blood sampling time for B cells is not relevant to the actual “sampling time” of the B cells, which is the various times when they left the germinal center. Hence, one can use a rooted phylogram.

Crucially, the leaf positions of rooted phylogram inference form part of the inferential output, in contrast to time tree inference (for which they form part of the input data). Thus, we wish to capture the positions of the leaf nodes as part of our tree representation. As with the time tree case, we discretize the positions of the internal nodes into a ranking, obtaining what we call a fully heterochronous ranked tree shape (Figure 1, right).

In this paper, we extend the previous F-matrix characterization to fully heterochronous ranked tree shapes and prove theorems on matrix construction. Going further, we provide a method to iteratively build all F-matrices one entry at a time. This extends previous work in two ways. First, in [3], the authors proposed a bijective F-matrix encoding of ranked tree shapes (isochronous and heterochronous) to define a distance on the space via matrix norms. This defined F-matrices by the ranked tree shapes that they encode, while the set of matrices comprising F-matrices was explicitly identified for isochronous ranked tree shapes only [4]; we restate the latter result as Theorem 1. Second, an iterative construction was noted for the isochronous case, but it was not explicitly stated nor was its correctness proved. In both the isochronous and heterochronous case, F-matrices are classified by their entries satisfying a number of simple linear inequalities. The iterative construction is a method to solve the linear inequalities without the need for back-substitution. This construction also yields an explicit enumeration of all F-matrices, and as such all fully heterochronous ranked tree shapes.

The current literature lacks descriptive probability distributions on the space of fully heterochronous ranked tree shapes. To address this, we first introduce two parameter-free models: a backward-in-time coalescent model [12], and a forward-in-time model referred to here as diagonal top-down. These may be considered as null models. In the opposite direction, we exploit the iterative matrix construction to define highly flexible probability distributions with many free parameters on the space of fully heterochronous ranked tree shapes. This general construction can be specialized to a particular class of beta-splitting model [13, 14]. Future work will focus on fitting these flexible distributions via neural networks.

The remainder of this article is structured as follows. In Section 1 we provide definitions and review connections with the previous literature. In Section 2 we introduce and provide examples of the types of matrices used here. In Section 3 we state and prove theorems for various bijections, classify F-matrices by constraints on their entries, and constructively enumerate F-matrices. In Section 4 we describe two null distributions based on simple sampling schemes for fully heterochronous ranked tree shapes, define a highly flexible non-parametric family of probability distributions on F-matrices, and specialize this to a novel two-parameter family of distributions on ranked tree shapes. Lastly, in Section 5 we give a brief discussion of results and directions for the future.

1. Definitions and connection with previous literature

We begin by more formally defining terms and providing connections with previous mathematical literature. A fully heterochronous ranked tree shape is a rooted full binary tree with a total ordering on the nodes such that nodes appear in increasing order along any path from root to leaf (see Example 1). Nodes represent events in time and the total ordering is based on time, so no two events (including the sampling of leaves) occur at the same time, hence the term “fully heterochronous”. In contrast, an isochronous ranked tree shape is a rooted full binary tree with a total ordering on only the internal nodes, but again internal nodes appear in increasing order along any path from root to leaf (see Example 2). With nodes representing events in time, isochronous ranked tree shapes correspond to different times for all internal nodes and the same time for all leaves. While one can consider heterochronous ranked tree shapes, where some intermediate number of leaves share ranks, we do not do so in this article. Table 1 shows a summary describing the two types of ranked trees.

Table 1:

Comparing the two types of ranked tree shapes.

Isochronous Fully heterochronous

- Discretized inferential output of e.g. BEAST or TreeTime. - Discretized inferential output of e.g. IQ-TREE or RAxML.
- Branch lengths are in units of calendar time. - Branch lengths are in units of evolutionary change.
- Internal nodes are totally ordered. - All nodes are totally ordered.
- Leaf positions are part of the input data for inference. - The leaf positions are part of the inferential output.

Ranked tree shapes are related to another type of tree structure, which are known by many names including binary increasing trees, ordered binary trees, or André trees [15, 16, 17]. Ordered (increasing, André) binary trees are fully heterochronous ranked tree shapes without the assumption that the binary tree is full; such trees have nodes with out-degree at most two instead of outdegree exactly zero or two. Fully heterochronous ranked tree shapes are also called strictly ordered binary trees. While isochronous ranked tree shapes are not ordered binary trees, the isochronous ranked tree shapes with n leaves are equinumerous with the ordered binary trees with n-1 nodes. Ordered binary trees are inherently related to alternating permutations that were extensively studied in [18], which is why some authors call such trees André trees.

Let 𝒯n denote the set of isochronous ranked tree shapes with n leaves and 𝒯n* denote the set of fully heterochronous ranked tree shapes with n leaves. The cardinalities of these sets correspond to the so called Euler up/down (or zigzag) numbers and reduced tangent numbers [19, 20]. In particular, in terms of exponential generating functions, we have

∑n=0∞𝒯n+1n!xn=secx+tanx,∑n=1∞𝒯n*x2n2n!=2logsecx2.

Furthermore,

𝒯n=2n-1En-112-En-1(0),𝒯n*=2n22n-1B2nn, (1)

where En(x) are the Euler polynomials (note En12=0 for odd n and En(0)=0 for even n) and Bn are the Bernoulli numbers.

2. Preliminaries

For a ranked tree shape we define three types of matrices, which we call F, D, and E-matrices. The differences between these matrices and their isochronous analogs are minor, and we highlight where differences occur. One additional difference with previous work is that we will use the convention that indices start at 0, not 1, in order to make theorem statements cleaner. In formulating the matrices, we give a purely graph theoretic definition and then an interpretation where the total ordering is based on events occurring in time, which is relevant for applications and is useful when visualizing such trees.

Throughout this section, we suppose T is a ranked tree shape with n leaves. Note T has n-1 internal nodes. We label the nodes of T by their ordering and call this label the rank of a node. As a convention for the isochronous case, we label the leaves with the common rank n-1 (distinct ranks are provided for leaves in the fully heterochronous case). The root has rank 0.

The F-matrix associated to T is a lower triangular matrix F, where the size of the matrix is (n-1)×(n-1) in the isochronous case and (2n-2)×(2n-2) in the fully heterochronous case. The entry Fi,j, for 0≤j≤i, is defined as the number of edges from nodes v to nodes w, where the rank of v is at most j and the rank of w is larger than i. The associated D and E-matrices are also lower triangular matrices and of the same size as the F-matrix. The entry Di,j is defined as the number of edges descending from the node with rank j to nodes with rank larger than i. The entry Ei,j is defined as the number of edges from the node with rank j to the node(s) with rank i+1.

Example 1.

Consider the following fully heterochronous ranked tree shape on three leaves:

2.

The associated matrices are:

F=2000130012200111,D=2000120011000100,E=1000010010000100.

Example 2.

Consider the following isochronous ranked tree shape on five leaves:

2.

While not labeled in the figure, the leaves are viewed as having rank 4. The associated matrices are:

F=2000130012400135,D=2000120011200122,E=1000010010000122.

For a description of these matrices in line with their introduction in [3, 4], we view T as describing a branching and sampling process of lineages over time. As in previous literature, we take the approach that time moves in the direction of leaf to root (for instance, one might think of the time units being in millions of years ago). In the isochronous case, we take real numbers u0>u1>⋯>un-1=0 and say the event for the node(s) with rank i occurs exactly at time ui. In the fully heterochronous case we instead take real numbers u0>u1>⋯>u2n-2, as there are more ranked nodes in this case. No event occurs in any time interval ui,ui+1. Exactly one event occurs at each time ui, except for time un-1 in the isochronous case.

In this setting, entry (i,j) of the F-matrix is the number of lineages present for the entire time interval ui+1,uj. A lineage is present for a time interval if the lineage appeared at or before the event time uj and neither bifurcates nor is sampled before the event time ui+1. Similarly, the (i,j) entry of the D-matrix is the number of direct descendants of the lineage appearing at time uj that are extant at least until time ui+1. Lastly, the (i,j) entry of the E-matrix is the number of direct descendants of the lineage appearing at time uj that are sampled at time ui+1.

The entries of such matrices are non-negative integers. Given that the trees are binary, the entries of a D-matrix are restricted to {0, 1, 2}. In the fully heterochronous case, the entries of a E-matrix are restricted to {0, 1}. In the isochronous case, the entries of all but the last row of a E-matrix are restricted to {0, 1}, while entries of the last row are restricted to {0, 1, 2} (as the leaves share a common rank).

The E-matrix is related to the adjacency matrix for T as a directed graph. This is immediate in the fully heterochronous case, where all nodes are uniquely given by their rank, so that Ei,j, for 0≤j≤i, is entry (j,i+1) of the adjacency matrix. In the isochronous case, this is true for all rows of E except the last, where the last row of E is a condensed description of the edges given by the last n columns of the adjacency matrix. In particular, there is not a unique adjacency matrix for T, as the leaves are unlabeled. By taking any assignment of n-1,n,…,2n-2 as labels for the n leaves we have a different adjacency matrix, but regardless of this choice, En-2,j is the sum of entries of the adjacency matrix at (j,n-1),(j,n),…,(j,2n-2). Due to T being a full binary tree, the information lost going from an adjacency matrix to E is exactly the labeling of leaves.

These types of matrices are related through the equations, for 0≤j≤i,

Di,j=Fi,j-Fi,j-1,Ei,j=Di,j-Di+1,j, (2)
Fi,j=∑ℓ=0jDi,ℓ,Di,j=∑ℓ=i2n-3Eℓ,j, (3)

with the convention that matrix entries at out of bound indices are 0. These equations imply a bijection between D-matrices, E-matrices, and F-matrices.

Given the relation between an E-matrix and an adjacency matrix, along with the bijections (2) and (3), it is clear that F-matrices are in bijection with the ranked tree shapes they represent. However, it is not apparent how the entries of an F-matrix are constrained or how to tell if a given matrix is an F-matrix. In the isochronous case, the conditions on entries are known by previous work, which we restate in the following theorem with our notational conventions.

Theorem 1.

[3, 4] The space of isochronous ranked tree shapes with n leaves is in bijection with the space of (n-1)×n-1 F-matrices, which are lower triangular square matrices of nonnegative integers that obey the following constraints.

  1. Entries of rows are monotone increasing:
    Fi,j-1≤Fi,jfor1≤j≤i≤n-2.
  2. Entries of columns are monotone decreasing with difference at most 1:
    Fi-1,j-1≤Fi,j≤Fi-1,jfor0≤j<i≤n-2.
  3. Entries satisfy an additional constraint based on their position in the matrix:
    1. The diagonal elements are Fi,i=i+2.
    2. The subdiagonal elements are Fi,i-1=i for 1≤i≤n-2.
    3. Of the remaining elements, Fi,j for 2≤i≤n-2 and 1≤j≤i-2, satisfy the inequality
      Fi,j-1+Fi-1,j-Fi-1,j-1-1≤Fi,j≤Fi,j-1+Fi-1,j-Fi-1,j-1.

A consequence of Theorem 1 is that it allows us to enumerate the whole space of isochronous ranked tree shapes, with a fixed number of leaves, via F-matrices. The values of the diagonal and subdiagonal entries are common to all F-matrices. The F-matrices are enumerated by then selecting values for the remaining lower diagonal entries in lexicographical order, which is the order of rows then columns (see Example 3). As it turns out, selecting values in this order not only produces all F-matrices, but also never produces an invalid matrix. That is to say, setting Fi,j to either minFi-1,j,Fi,j-1+Fi-1,j-Fi-1,j-1 or maxFi,j-1,Fi-1,j-1,Fi,j-1+Fi-1,j-Fi-1,j-1-1 does not yield an unsatisfiable system of inequalities for entries filled after Fi,j.

The simplicity of this result motivates the use of F-matrices over D- or E-matrices. We state the corresponding theorem for fully heterochronous ranked tree shapes in the next section, however in this case, the enumeration method is not immediate.

3. Theorems

We note that the F-matrix of a fully heterochronous ranked tree with n leaves is a matrix of dimension 2n-2 with a different constraint on the diagonal from the isochronous case. Recall the i-th diagonal entry indicates the number of lineages (or edges) extant at the i-th time epoch and so the diagonal entries either increase by one or decrease by one depending on whether the i-th node is of out-degree 2 or of out-degree 0. In the isochronous case, diagonal entries always increase by one. In the following theorem, we classify F-matrices of fully heterochronous ranked tree shapes in terms of a system of inequalities.

Theorem 2.

The space of fully heterochronous ranked tree shapes with n leaves is in bijection with the space of (2n-2)×(2n-2) F-matrices, which are the lower triangular square matrices F of non-negative integers that obey the following constraints.

  1. Entries of rows are monotone increasing:
    Fi,j-1≤Fi,jfor1≤j≤i≤2n-3.
  2. Entries of columns are monotone decreasing with difference at most 1:
    Fi-1,j-1≤Fi,j≤Fi-1,jfor0≤j<i≤2n-3.
  3. Entries satisfy an additional constraint based on their position in the matrix:
    1. The diagonal elements are positive and satisfy,
      F0,0=2,Fi,i=Fi-1,i-1±1F2n-3,2n-3=1.for0<i<2n-3,
      In particular, Fi,i=Fi-1,i-1-1 if the i-th event is a sampling event, and Fi,i=Fi-1,i-1+1 if it is a coalescent event.
    2. The subdiagonal elements are Fi,i-1=Fi-1,i-1-1 for 1≤i≤2n-3.
    3. Of the remaining elements, Fi,j for 2≤i≤2n-3 and 1≤j≤i-2, satisfy the inequality
      Fi,j-1+Fi-1,j-Fi-1,j-1-1≤Fi,j≤Fi,j-1+Fi-1,j-Fi-1,j-1.

Proof.

We first verify that the conditions are necessary. Suppose F is the F-matrix associated to a fully heterochronous ranked tree shape with n leaves. Let D and E be the associated D-matrix and E-matrix.

Condition 1 is equivalent to Di,j≥0, which is true. Condition 2 states that the number of edges from nodes v to nodes w, where rank(v)≤j and rank(w)=i, is exactly 1 or 0 (either the parent node of w has rank at most j or not).

We handle each part of condition 3 in order of appearance. Since the root node has exactly two children, F0,0=2. The same edges are counted by Fi-1,i-1 and Fi,i except for three: the edge to the node with rank i (counted by Fi-1,i-1) and the two edges from the node with rank i (counted by Fi,i, if they exist), so Fi,i-Fi-1,i-1=±1. There is a single node with rank larger than 2n-3, so F2n-3,2n-3=1. The same edges are counted by Fi-1,i-1 and Fi,i-1 except the edge to the node of rank i (counted by Fi-1,i-1), so Fi-1,i-1-Fi,i-1=1. Condition 3(c) is equivalent to Ei-1,j∈{0,1}, which is true.

Next we prove that the conditions are sufficient. It is easier to work with the D and E matrices, rather than work directly with the F-matrix. Suppose F is a matrix satisfying the conditions in the statement of the theorem. Let D and E be the matrices defined by (2). We show that E is the offset adjacency matrix of some totally ranked tree shape. This requires verifying the following conditions for E:

  1. Each Ei,j∈{0,1}, as these are the only valid entries of an adjacency matrix.

  2. Each row sums to 1, ∑j=0iEi,j=1, as no node has multiple parents and there is exactly one event (coalescent or sampling) at each event time.

  3. Each column sums to 0 or 2, ∑i=j2n-3Ei,j∈{0,2}, as the tree is binary.

This will complete the proof, as we can read the ranked tree shape from the matrix E.

By the definitions of the matrices E and D, along with condition 3(c), we have

Ei,j=Di,j-Di+1,j=Fi,j-Fi,j-1-Fi+1,j+Fi+1,j-1=-Fi+1,j-Fi+1,j-1-Fi,j+Fi,j-1=0or1,

which is (i). With 3(b), or 3(a) when i=2n-3, we have

∑j=0iEi,j=∑j=0iDi,j-Di+1,j=∑j=0iFi,j-Fi,j-1-Fi+1,j+Fi+1,j-1=Fi,i-Fi+1,i=1,

which is (ii). By 3(b) and 3(a), we have

∑i=j2n-3Ei,j=∑i=j2n-3Di,j-Di+1,j=Dj,j=Fj,j-Fj,j-1=F0,0ifj=0,Fj,j-Fj-1,j-1+1otherwise,=2ifj=0,0or2otherwise,

which is (iii).

□

With Theorems 1 and 2, we can tell if a given matrix represents a ranked tree shape or not. While the difference between the two cases is the diagonal, this is more important than it appears.

We next emphasize the difference between the two cases by showing how a matrix-filling strategy that works for the isochronous case will produce invalid F-matrices in the heterochronous case. We will then develop a strategy (Proposition 1) that can fill the matrix in a single pass.

Example 3.

The F-matrices for isochronous ranked tree shapes with five leaves must fit the pattern:

F=20001300*240**35.

We can determine all F-matrices by filling the remaining entries in order of F2,0, F3,0, and F3,1. For F2,0 we have two options, 0 or 1. Suppose we select F2,0=0. Moving to F3,0, we are forced to select F3,0=0 by constraint 2. Lastly, for F3,1 our options are 1 or 2, both of which yield valid F-matrices. One can verify that if we instead begin with F2,0=1, the remaining entries work out in a similar fashion.

To see what can go wrong in the fully heterochronous case, consider the partially filled F-matrix,

F=20001300***0****.

For F2,0 we have two options, 0 or 1, suppose we take F2,0=0. We are forced to have F2,1=2 by constraint 3(b). Next we must take F2,2=2, as F2,2=4 yields the contradiction 3=F3,2≤F3,3=1 by constraints 3(a,b). Additionally, we are forced to take F3,0=0 by constraint 2. In

F=2000130002200***,

we have the two options of 1 or 2 for F3,1, but are forced to have F3,2=F3,3=1 by 3(a,b). While

F=2000130002200111

is a valid F-matrix,

F=2000130002200211

is not as the last row violates the monotone increasing property.

This example shows how the strategy of filling rows in order of top to bottom and left to right produces all F-matrices, in both the isochronous and heterochronous case, but additional constraints are necessary to prevent invalid F-matrices in the heterochronous case. Specifically, some combinations of values for Fi,j and Fi,i-1 from items 3(c) and 3(b) in Theorem 2 may conflict with item 1. In the example, the invalid combination is Fi,j=F3,1=2 and Fi,i-1=F3,2=1.

For the remainder of this section, we describe a matrix-filling strategy that does not lead to contradictions in the heterochronous case. As the subdiagonal entries are determined by the diagonal entries, we first verify that any choice of diagonal entries by item 3(a) and an additional constraint yields at least one valid F-matrix. That is to say, when solving the system of inequalities in Theorem 2, we may select values for the diagonal without backtracking.

Corollary 1.

Let n and N be non-negative integers with N≤2n-3. Suppose fi, for 0≤i≤N, is a sequence of positive integers where,

  1. f0=2,

  2. fi=fi-1±1 for 1≤i≤N, and

  3. fi≤2n-i-2 for 0≤i≤N.

Then there exists F, an F-matrix for a fully heterochronous ranked tree shape with n leaves, with Fi,i=fi for 0≤i≤N.

Proof.

The inequality in item 3 of the Corollary guarantees that it is possible to extend the sequence to length 2n-3 while satisfying item 2, item 3, and f2n-3=1. The fi are the first N+1 diagonal entries of any (2n-2)×(2n-2)F-matrix associated to a fully heterochronous ranked tree shape whose first N+1 nodes (ordered by rank) bifurcate when fi=fi-1+1 and are leaves when fi=fi-1-1. □

We introduce notation for bounds that often appear with F-matrices. For a matrix or doubly indexed sequence, F, we set

LF(i,j):=maxFi,j-1,Fi-1,j-1,Fi,j-1+Fi-1,j-Fi-1,j-1-1,
UF(i,j):=minFi-1,j,Fi,j-1+Fi-1,j-Fi-1,j-1,

with the convention that Fk,ℓ=0 when k or ℓ is negative. The key feature of these bounds is that the entries of an F-matrix, off the diagonal and subdiagonal, are classified by LF(i,j)≤Fi,j≤UF(i,j). When filling the entries of an F-matrix, by row then column, we are free to choose LF(i,j) or UF(i,j) for Fi,j in the isochronous case, but this is not always true in the heterochronous case.

We require notation for the concept of a partially filled F-matrix of a fully heterochronous ranked tree shape. This will correspond to filling the first N rows and the first M+1 columns of the N+1 st row of an F-matrix. We must do so in a way that guarantees the values chosen so far will not conflict with values chosen later on.

Definition 1.

Let n, N, and M be non-negative integers with M≤N≤2n-3 and set B=max(N-1,M). An (n,N,M) F-sequence is a doubly indexed sequence fi,j, defined for (i,j) in {(i,j)∣0≤j≤i≤N-1}∪{(N,j)∣0≤j≤M}, of non-negative integers where,

  1. the sequence fi,i, for 0≤i≤B, satisfies the conditions of Corollary 1 with (n,N)↦(n,B),

  2. Lf(i,j)≤fi,j≤Uf(i,j) for 0≤j≤i-2, where (i,j) are valid indices, and

  3. if fi-1,j=fi-1,i-1, then fi,j=fi-1,i-1-1, for valid indices with 0≤j≤i-1.

We will show below that an (n,N,M) F-sequence fills the first N rows and the first M+1 columns of the N+1 st row of a (2n-2)×(2n-2)F-matrix. Under the lexicographical order, the F-matrix is filled up to and including entry (N,M).

Example 4.

As seen in example 1, there is one (5, 1, 1) F-sequence: 213. The two possible (5, 2, 0) F-sequences extend the (5, 1, 1) F-sequence by filling the first entry of the next row, and are given by 2130 and 2131.

We show how to extend an (n,N,M)F-sequence to an F-matrix and that every F-matrix appears in such a way.

Proposition 1.

If fi,j is an (n,N,M)F-sequence with M<N or N<2n-3, then the following methods extend f to a longer F-sequence.

  1. If M<N-2, setting fN,M+1 to
    1. fN-1,N-1-1 if fN-1,M+1=fN-1,N-1, and otherwise
    2. either of Lf(N,M+1) or Uf(N,M+1),
      yield (n,N,M+1) F-sequences.
  2. If M=N-2, setting fN,N-1=fN-1,N-1-1 yields an (n,N,N-1) F-sequence.

  3. If M=N-1, setting fN,N to
    • fN-1,N-1-1 if fN-1,N-1>1, or
    • fN-1,N-1+1 if fN-1,N-1<2n-N-1,
      both yield (n,N,N)F-sequences.
  4. If M=N, setting FN+1,0 to
    1. fN,N-1 if fN,0=fN,N, and otherwise
    2. either of max 0,fN,0-1 or fN,0,
      yield (n,N+1,0)F-sequences.

Proof.

Items 2 and 3 are immediate by definitions. While item 1 may also appear obvious, we do not know a priori that Lf(N,M+1)≤Uf(N,M+1). In fact, this is the major claim in justifying that such sequences extend. However, when doing so we may freely use bounds for Lf(i,j) and Uf(i,j) at previous indices with 0≤j≤i-2.

Suppose M<N-2. Our first goal is to verify that

fN,M≤fN-1,M≤fN-1,M+1. (4)

By definition 1.2, fN,M≤Uf(N,M)≤fN-1,M. We handle the remaining bound in three cases. First note that by definitions 1.3 and 1.1,

fN-2,N-3=fN-3,N-3-1=fN-2,N-2±1-1.

When M=N-3 and fN-2,N-3=fN-2,N-2, by definition 1.3,

fN-1,M=fN-1,N-3=fN-2,N-2-1=fN-1,N-2=fN-1,M+1.

When M=N-3 and fN-2,N-3=fN-2,N-2-2, definitions 1.2 and 1.3 give

fN-1,M≤Uf(N-1,N-3)≤fN-2,N-3=fN-2,N-2-2=fN-1,N-2-1<fN-1,M+1.

Lastly, when M<N-3, by definition 1.2,

fN-1,M+1≥LfN-1,M+1≥fN-1,M.

Therefore (4) is true.

We consider the two possible values for Uf(N,M+1). If Uf(N,M+1)=fN-1,M+1, then fN,M≥fN-1,M and so in fact fN,M=fN-1,M. Therefore,

LfN,M+1=maxfN,M,fN-1,M+1-1≤fN-1,M+1=UfN,M+1.

Furthermore, if we additionally have fN-1,M+1=fN-1,N-1, then fN,M<fN-1,M+1, as fN,M=fN-1,M+1 implies fN-1,M=fN-1,N-1, which yields the contradiction fN,M=fN-1,N-1-1. Specifically, with the additional assumption that fN-1,M+1=fN-1,N-1, we have Lf(N,M+1)=fN-1,N-1-1.

When instead Uf(N,M+1)=fN,M+fN-1,M+1-fN-1,M<fN-1,M+1, we have fN,M<fN-1,M≤fN-1,M+1, so that

Lf(N,M+1)=maxfN,M,fN-1,M+1-1=fN-1,M+1-1≤fN-1,M+1+fN,M-fN-1,M=Uf(N,M+1)

Furthermore, if we additionally have fN-1,M+1=fN-1,N-1, then Lf(N,M+1)=fN-1,N-1-1. This establishes item 1.

Lastly, we verify item 4. We have

LfN+1,0=max0,fN,0-1≤fN,0=UfN+1,0.

IF fN,0=fN,N then fN,0≥1 and so Lf(N+1,0)=fN-1,N-1-1. □

Corollary 2.

A(2n-2)×(2n-2) lower triangular matrix F is an F-F-matrix for a fully heterochronous ranked tree shape if and only if the entries Fi,j are an (n,2n-3,2n-3)F-sequence.

Proof.

Suppose F is an F-matrix. The sequence Fi,j immediately satisfies all conditions of an (n,2n-3,2n-3)F-sequence, except possibly the condition when Fi-1,j=Fi-1,i-1. If Fi-1,j=Fi-1,i-1 and 0≤j≤i-1, then by conditions 2, 1, and 3(b) of Theorem 2,

Fi-1,j-1≤Fi,j≤Fi,i-1=Fi-1,i-1-1.

So

Fi-1,i-1-1≤Fi,j≤Fi-1,i-1-1,

meaning Fi,j=Fi-1,i-1-1.

For the converse, suppose Fi,j is an (n,2n-3,2n-3) F-sequence. Given the definition of such a sequence and Theorem 2, we need only show that Fi,i-2≤Fi,i-1 for i≥2. If Fi-1,i-2=Fi-1,i-1, then

Fi,i-2=Fi-1,i-1-1=Fi,i-1.

Otherwise, Fi-1,i-2=Fi-1,i-1-2 and so

Fi,i-2≤Fi-1,i-2<Fi-1,i-1-1=Fi,i-1.

□

Let us emphasize that Proposition 1 provides the rules used to construct the entries, one at a time, of an F-matrix. When following these rules, there is no chance of entering an invalid state that requires backtracking to previously selected entries. Furthermore, when constructing an entry, we need only consider values at four previous entries (the entries directly to the left, directly above, and directly to the above-left, as well as the previous diagonal entry). As such we have an efficient process to determine all F-matrices of a given size and so all ranked tree shapes on a given number of leaves. Note it is a straightforward process to turn an F-matrix into an E-matrix, and to turn an E-matrix into a ranked tree shape.

4. Sampling Schemes

A fully heterochronous ranked tree shape with n leaves can be converted into an isochronous ranked tree shape with 2n leaves by attaching isochronous cherries to each of the leaves. In this case, we will call such a tree a full-cherry tree. A cherry is a pair of sister leaves, i.e. a subgraph with 3 nodes in which the root node has out-degree 2 and the other 2 nodes have out-degree 0. Figure 2 shows an example with n=3 leaves. It is then evident that the space of heterochronous ranked tree shapes with n leaves is bijective with the subspace of isochronous ranked tree shapes with 2n leaves consisting of full-cherry trees.

Figure 2:

Figure 2:

A fully heterochronous ranked tree shape with 3 leaves (left) and the corresponding full-cherry isochronous tree with 6 leaves and 3 cherries (right).

Another consequence of the bijection between ranked tree shapes and full-cherry trees is that we can recursively count the number of fully heterochronous ranked tree shapes via a standard recursion involving root-splitting [21] to obtain the following proposition.

Proposition 2.

Let Kn denote the number of fully heterochronous ranked tree shapes with n leaves. Then Kn satisfies the following initial conditions and recursion,

K1=K2=1,Kn=12∑ℓ=1n-12n-22ℓ-1KℓKn-ℓ, (5)

Proof.

As the initial conditions are trivial, we assume n≥3. To prove the recursion, we use that Kn is also the number of full-cherry trees with 2n leaves. The full-cherry trees with 2n leaves may be constructed as follows. Select two full-cherry trees T1 and T2, where T1 has 2ℓ leaves and T2 has 2(n-ℓ) leaves with 0<ℓ<n; extend the total orderings of the internal nodes of T1 and T2 to a common total ordering; join T1 and T2 with a new root node whose children are the roots of T1 and T2. Since T1 has 2ℓ-1 internal nodes and T2 has 2(n-ℓ)-1 internal nodes, there are exactly 2n-22ℓ-1 ways to extend to a common ordering. The sum in (5) corresponds to this construction, where the factor 12 accounts for double counting due to constructing full-cherry trees from ordered pairs (T1,T2) rather than sets T1,T2. □

We note that this recursion agrees with the recursion for strictly ordered binary trees by Poupard [17]. Indeed, Poupard's strictly ordered binary tree is a different name for the fully heterochronous ranked tree shape. Using this recursion and an argument by generating functions, Poupard showed that the number of strictly ordered binary trees with n leaves is equal to the nth reduced tangent number (see (1)).

In this section we introduce three methods for sampling fully heterochronous ranked tree shapes. The first method is a coalescent model inspired by the bijection with full-cherry trees [22, Proposition 2]. This model is "bottom-up" in the sense that the generating process starts with one cherry node and adds cherries and merges cherries one by one until the root. The second method, in contrast, is "top-down": it starts with the root and sequentially selects edges to bifurcate or to sample (terminate) as time moves forward. This method utilizes the Catalan diagonal structure of the F-matrix. The last model generates one entry at a time sequentially along the F-matrix via Bernoulli probabilities. This last model can be specialized to a class of Beta-splitting models.

4.1. Coalescent model

The proposed coalescent model is a Markov chain whose full realization encodes a full-cherry tree, and therefore is an appropriate model for fully heterochronous ranked tree shapes (by removing the cherries at the end of the process). The initial state is 2n leaves at the bottom of the tree. We will describe the operation of connecting two nodes with a new node via two new edges as "merging" those two nodes. The jump chain begins by forming a cherry, merging two leaves at a new node assigned rank 2n-2. To proceed, the chain introduces a new node and uniformly at random either merges two leaves or two non-leaf nodes at this new node. The newly formed node is assigned a rank according to the time step when it was created, with older nodes assigned larger rank. The j-th state of the chain is denoted by A2n-j=L2n-j,V2n-j, where L2n-j denotes the number of nodes with total degree 0 (leaves not merged into cherries) and V2n-j denotes the set of ranks of non-leaf nodes with in-degree 0 (ranked nodes not merged) at step j. The indices for states A2n-j run in reverse order compared to the steps j, which is standard for coalescent models. By state A2n-j, the Markov chain realizes a partially constructed full-cherry tree with nodes of ranks 2n-2 to 2n-j. The chain starts at A2n-1=(2n,∅) and completes after 2n-1 steps at state A0=(0,{0}) since the root is rank 0. Figure 3 shows an example.

Figure 3:

Figure 3:

An example of the coalescent jump chain with states Ai and corresponding transition probabilities.

With k=2n-j, the transition probability for state j to j+1 is,

PAk∣Ak+1=(Lk+12)Lk+12+Vk+12ifLk=Lk+1-2,Vk+1⊂Vk,andVk\Vk+1=1,1Lk+12+Vk+12ifLk=Lk+1,Vk+1\Vk=2,andVk\Vk+1=1,0otherwise.

In order to compute the probability of a fully heterochronous ranked tree shape in terms of its F-matrix F, we need to determine the number of unmerged leaves and unmerged ranked nodes of the fully-cherry tree from F. For the number of unmerged ranked nodes, we have

V2n-1=0,Vk=Fk-1,k-1for0<k<2n-1,V0=1.

On the other hand, the total number of unmerged leaves and unmerged ranked nodes is k+1 at state k, and therefore the number of unmerged leaves is

L2n-1=2n,Lk=k+1-Fk-1,k-1for0<k<2n-1,L0=0.

Therefore, the probability of a fully heterochronous ranked tree shape T with F-matrix F, under the coalescent model is:

P(T)=∏k=12n-3PAk∣Ak+1=∏1≤k≤2n-3,Fk,k=Fk-1,k-1-1k+2-Fk,k2/∏0≤k≤2n-3k+2-Fk,k2+Fk,k2.

4.2. Diagonal "top-down" model

A second model of fully heterochronous ranked tree shapes starts by uniformly generating the diagonal of the F-matrix (the sequence of coalescence and sampling events), and proceeds by uniformly at random selecting the edges for coalescence or sampling, conditioned on the matrix diagonal. To uniformly sample the diagonal, we rely on a bijection between the space of possible diagonal vectors and the space of Dyck paths from (0, 0) to point (n-1,n-1).

Definition 2.

A Dyck path is a path on the two-dimensional grid from point (0, 0) to point (n-1,n-1) that can only move right or up by one unit, under the constraint that it never goes above the line x=y.

Proposition 3.

The number of possible diagonals in the F-matrix of a fully heterochronous ranked tree shape with n leaves corresponds to the Catalan number Cn-1.

Proof.

We first note that the diagonal of an F-matrix is equivalent to a Dyck path that starts at (1, 0) (corresponding to the initial 2 in the diagonal). Starting from the point (1, 0) in the Dyck path, if we record each rightward step as a +1 and each upward step as a −1, then we obtain a sequence of successive differences for a valid F-matrix diagonal that starts at 2, ends at 1, and takes only positive values. Hence the two spaces are bijective.

It is well-known that the number of Dyck sequences of length 2n-2 is the Catalan number Cn-1=1n2(n-1)n-1 [23]. Therefore, the number of possible diagonals in the F-matrices of fully heterochronous trees with n leaves is the Catalan number Cn-1. □

An algorithm to sample Dyck paths from (1, 0) to (n-1,n-1) that has O(n) complexity was proposed by [24]. The algorithm proceeds sequentially starting from (1,0); at any point (i,j) in the partially formed Dyck path, we move to the right with probability N(i+1,j)/N(i,j), where

N(i,j):=i-j+12n-1-i-j2n-1-i-jn-j,

is the number of ways to complete the Dyck path from (i,j) to (n-1,n-1). It is not hard to see that multiplying the transition probabilities results in a telescoping product equal to 1/N(0,1)=1/Cn-1.

Once the diagonal is sampled and fixed according to the previous algorithm, we have the order of bifurcation and sampling events of a tree. For instance, if the diagonal is [2, 3, 4, 3, 2, 1], then the sequence of successive differences is [+1, +1, −1, −1, −1]. The tree has two bifurcations at times u1 and u2 and then three sampling events at u3, u4, and u5. Necessarily, u0 is a bifurcation event and u6 is a sampling event, so they are not included.

Next we need to sample the edges on which these events happen. Generally at time uk, with 1≤k≤2n-2, we have a partially constructed tree, and its corresponding partial F-matrix has k complete rows. We then choose an edge from the set of Fk-1,k-1 edges extant throughout (uk,uk-1) to be sampled or bifurcated at time uk. We label these extant edges with the rank of their parent node. The number of such edges that descend from the node of rank j, with j≤k-1, is Dk-1,j=Fk-1,j-Fk-1,j-1. Thus the probability of choosing an edge with rank label L, with L≤k-1, is

Fk-1,L-Fk-1,L-1Fk-1,k-1, (6)

If the chosen edge has label L, then the next row of the F-matrix (excluding diagonal) is given by

Fk,j=Fk-1,jj<L,Fk-1,j-1j≥L.

Continuing with the previous example of an F-matrix with fixed diagonal [2, 3, 4, 3, 2, 1], we can enumerate all 18 compatible fully heterochronous ranked tree shapes (according to Proposition 1). Given that we randomly choose extant edges to sample or bifurcate, we would expect all F-matrices to be equally likely. We show that this is indeed the case.

Proposition 4.

The F-matrices conditioned on a fixed diagonal are uniformly distributed under the diagonal top-down model.

Proof.

By (6), the conditional probability is expressed in terms of D and E-matrices as follows:

PF∣Fk,kk=02n-3=∏k=02n-3Fk,jk-Fk,jk-1Fk,k=∏k=02n-3Dk,jk∏k=02n-3Fk,k,

where jk=argmax0≤j≤kEk,j. Note jk is exactly the rank label of the edge selected for bifurcation or sampling at the event time uk+1. The numerator ∏k=02n-3Dk,jk is the product of D-matrix entries that take values in {1, 2}. In particular, Dk,jk is 2 when the sibling of the node of rank k+1 has rank larger than k+1, and is 1 when the sibling has rank smaller than k+1. Of all 2n-2 non-root nodes, exactly half have rank larger than their sibling, so we have,

PF∣Fk,kk=02n-3=2n-1∏k=02n-3Fk,k.

Notice that P(F) depends solely on the fixed diagonal Fk,kk=02n-3, so all fully heterochronous ranked tree shapes with the same diagonal have the same probability. This concludes the proof. □

To summarize, the following proposition gives the probability of any fully heterochronous ranked tree shape under the diagonal top-down model.

Proposition 5.

Under the diagonal top-down model, the probability of a fully heterochronous ranked tree shape with F-matrix F is given by:

P(F)=PFk,kk=02n-3PF∣Fk,kk=02n-3=1Cn-1×2n-1∏j=12n-2Fj-1,j-1. (7)

4.3. A Bernoulli splitting model

We now define a family of probability distributions on F-matrices that sequentially generates one entry at a time conditioned on all previous values. Since each entry, conditioned on previous entries, can take up to two different values (see Theorem 2, constraint 2), these values can be sampled according to Bernoulli probabilities, except in trivial cases where the entry Fi,j can take only a single value.

We further note that in determining valid values, we need at most four previous values rather than all previous values. Let ℱi,j∣F<(i,j) denote the set of possible values that Fi,j can take conditionally of previous values, then given real numbers pi,j∈(0,1), with (i,j) ranging over the non-trivial entries, entry Fi,j is LF(i,j)=minℱi,j∣F<(i,j) with probability pi,j and UF(i,j)=maxℱi,j∣F<(i,j) with probability 1-pi,j. We set

PFi,j∣F<(i,j),pi,j=δLF(i,j)=UF(i,j)+1-δLF(i,j)=LF(i,j)pi,jδFi,j=LF(i,j)1-pi,jδFi,j=UF(i,j)

The joint probability of an F-matrix conveniently telescopes, as

PFp=∏i,jnon-trivialPFi,j∣F<i,j,pi,j.

Example 5.

There are four F-matrices for fully heterochronous ranked tree shapes with three leaves:

F0=2000110000200011,F1=2000130002200111,F2=2000130012200111,F3=2000130012201111.

The probability of a matrix is:

PFp=PF1,1∣pPF2,0∣F1,1,pPF3,0∣F2,0,pPF3,1∣F2,0,F3,0,p.

By taking probabilities p1,1, p2,0, p3,0, p3,1, we find that

PF0∣p=p1,1,PF1∣p=1-p1,1p2,0PF2∣p=1-p1,11-p2,0p3,0,PF3∣p=1-p1,11-p2,01-p3,0,

and PF0∣p+PF1∣p+PF2∣p+PF3∣p=1.

In the example above, the number of parameters pi,j and number of F-matrices are equal. Additionally, the parameter p3,1 is unnecessary. These strange details are specific to the small number of leaves. In general the number of parameters is much smaller, as the number of parameters is quadratic in n, whereas the number of matrices is comparable to nn.

We highlight that the Bernoulli splitting model applies to the space of isochronous ranked tree shapes as well. For the isochronous ranked tree shapes, the diagonal and subdiagonal are fixed, and the remaining entries are chosen by a Bernoulli coin flip. Hence, the number of non-trivial entries is (n-3)(n-2)/2 in the isochronous case, compared to 2n2-5n+1 in the heterochronous case, where, as usual, n is the number of leaves in the ranked tree shape.

Inspired by the Beta-splitting model [13, 14], we can sample the Bernoulli probabilities from a Beta density fpi,j;α,β, with parameters α and β∈(0,∞). The entry-wise probability is

PFi,j∣F<(i,j)=δLF(i,j)=UF(i,j)+1-δLF(i,j)=UF(i,j)∫01pi,jδFi,j=LF(i,j)1-pi,jδFi,j=UF(i,j)fpi,j;α,βdpi,j=δLF(i,j)=UF(i,j)+1-δLF(i,j)=UF(i,j)B(α+δFi,j=LF(i,j),β+δFi,j=LF(i,j))B(α,β)=1ifLFi,j=UFi,j,αα+βifLFi,j=Fi,j<UFi,j,βα+βifLFi,j<Fi,j=UFi,j.

Notice that the above equation implies that the marginal distribution of fully heterochronous ranked tree shapes has one parameter, which is the ratio αβ. This, however, should not be confused with the generative process, which is nonparametric. In the generative model, we sample trees from the condition distribution of P(F∣p), where the number of parameters in p grows with tree size.

This Beta-Bernoulli model generates balanced trees when α≫β and unbalanced otherwise. The mean of Beta(α,β) is αα+β, so when α≫β, the Bernoulli probabilities of choosing the smaller admissible value LF tends to be higher. This results in lineages surviving less, which gives more balanced trees. This can be appreciated in Figure 6 obtained from simulations.

Figure 6:

Figure 6:

Comparing sampling distributions of internal tree length, total tree length, and number of cherries for 1000 fully heterochronous ranked tree shapes with 20 leaves under the coalescent model, the diagonal top-down model, and the Bernoulli splitting model (with parameters α=10, β=1; α=10, β=10; α=1, β=10).

4.4. Simulations

We simulated 1000 fully heterochronous ranked tree shapes with 5, 20, and 50 leaves, according to the three models defined in the previous sections. For the Bernoulli splitting model, we simulated trees from three different Beta distributions: (1) α=10, β=1, (2) α=10, β=10, and (3) α=1, β=10.

For each simulated tree, we computed 3 statistics: the number of cherries, the total tree length (the sum of the number of (ui,ui+1) intervals that each branch survives), and the internal tree length (the sum of the number of ui,ui+1 intervals that each internal edge survives). Since our models are models on tree topology only, we assumed a unit length interval between consecutive events (branching or sampling). The means of those statistics are presented in Tables 2 and 3. Empirical distributions based on 1000 simulations of trees with 20 leaves are depicted in Figure 6.

Table 2:

Comparing the average number of cherries NC, the average internal tree length LI, and the average total length LT of size-1000 samples of fully heterochronous ranked tree shapes (number of leaves n=5,20,50) from the coalescent model and the diagonal top-down model.

coalescent diagonal top-down

n 5 20 50 5 20 50

NC 1.50 6.10 15.29 1.43 5.14 12.57
LI 5.13 82.92 504.92 5.63 66.99 284.41
LT 19.14 289.50 1787.50 17.28 155.04 617.56

Table 3:

Comparing the average number of cherries NC, the average internal tree length LI, and the average total length LT of size-1000 samples of fully heterochronous ranked tree shapes (number of leaves n=5,20,50) from the Bernoulli splitting model with different parameters for the Beta distribution (α=10, β=1; α=10, β=10; α=1, β=10).

α = 10, β = 1 α = 10, β = 10 α = 1, β = 10

n 5 20 50 5 20 50 5 20 50

NC 1.01 1.08 1.44 1.39 5.12 12.20 1.37 6.27 19.12
LI 5.97 36.01 96.48 5.37 61.16 264.61 3.64 62.43 521.16
LT 12.45 59.97 157.09 17.18 157.92 607.47 23.30 379.57 2322.72

Results from Tables 2 and 3 show that among the two parameter-free models, the coalescent model generates samples with larger average internal length, total length, and number of cherries compared to the diagonal top-down model. On the other hand, by adjusting the hyperparameters of the beta distribution in the Bernoulli splitting model, the resulting sample can be quite different in terms of the three average statistics.

The histograms in Figure 6 allow us to see the differences between samples more clearly. The sampling distributions of summary statistics from the coalescent model and diagonal top-down model are roughly symmetric. In contrast, the Bernoulli splitting model, regardless of hyperparameter values, produces more skewed distributions for total tree length. The sampling distributions of the number of cherries are approximately symmetrical across all models. As the ratio αβ decreases, the mode of the sampling distribution of total tree length increases, and the distributions change from being right-skewed to being leftskewed. These simulations show that, even after we simplify the Bernoulli splitting model (so that the Bernoulli probabilities come from a Beta distribution), the model is very expressive in the sense that it can generate very different samples of trees. We can thus reasonably conclude that, by adjusting the Bernoulli probabilities, the Bernoulli model can fit to various distributions.

4.5. Implementation

Software implementing these methods is available in R and Python at https://github.com/matsengrp/fully-heterochronous-f-matrix. It generates all F-matrices for trees of a given size, converts between F-matrix, D-matrix, and E-matrix formats, and validates ranked tree structures. The enumeration algorithms use the characterizations from Section 3. The sampling implementations (Section 4) use the autoregressive structure of F-matrix construction.

5. Discussion

In this article, we extended theorems describing F-matrices to fully heterochronous ranked tree shapes. Using the F-matrix characterization, we were able to enumerate all fully heterochronous ranked tree shapes, and we highlighted our ability to construct F-matrices in an autoregressive order. This construction allowed us to define a flexible family of probability distributions, with a large number of parameters, on the space of fully heterochronous ranked tree shapes. In addition, we introduced two parameter-free distributions that can serve as null distributions, which involve some uniform sampling at stages of tree formation. We then compared the flexible family of distributions against the two null distributions. Through simulations we showcased the ability of our flexible family to fit various and expressive distributions.

Note that we can attach the flexible family of probability distributions to isochronous ranked tree shapes. Additionally, the methods used here to characterize F-matrices for fully heterochronous ranked tree shapes can be applied to (non-fully) heterochronous ranked tree shapes with a fixed number of unique leaf sampling times. Likely one would need only to adjust the size of the matrix and conditions on the diagonal to account for the number of unique ranks. Then, we are equipped with representations and probability distributions on the entire space of ranked tree shapes.

In a future article, we will describe how to implement flexible probability distributions via neural networks. Our goal is to model the distribution of tree shapes for B cell receptor sequences. The present work has built a solid foundation: the probability associated with an entry of an F-matrix is written in terms of the probabilities of at most four previous entries. This lends itself to an efficient autoregressive model.

Figure 4:

Figure 4:

An example of the F-matrix diagonal [2, 1, 2, 3, 2, 3, 2, 1, 2, 1] and its corresponding Dyck path. Each unit decrease in the F-matrix diagonal is an upward step in the Dyck path and each unit increase is a rightward step.

Figure 5:

Figure 5:

An example of "top-down" sampled tree with fixed diagonal [2, 3, 4, 3, 2, 1]. Gray: probability of each bifurcation or sampling event that happens at respective times u1,⋯,u5 according to (6). The probability of the ranked tree shape is 22×13×24×13×22=118.

Acknowledgments

F.A.M. would like to thank Thierry Mora for discussions about the need for flexible models of tree shape that motivated the work in this paper.

This material is based upon work supported by the National Science Foundation under Grant No. DMS-1929284 while the senior authors met at the Institute for Computational and Experimental Research in Mathematics in Providence, RI, during the “Algorithmic Advances and Implementation Challenges: Developing Practical Tools for Phylogenetic Inference” program.

Funding

J.A.P. acknowledges support from the NSF Career Award #2143242 and NIH Award R35GM148338. F.A.M. acknowledges support from NIAID award R01-AI146028. Scientific Computing Infrastructure at Fred Hutch funded by ORIP grant S10OD028685. Frederick Matsen is an investigator of the Howard Hughes Medical Institute.

References

  • [1].Arne Mooers and Heard Stephen B.. Inferring evolutionary process from phylogenetic tree shape. The Quarterly Review of Biology, 72(1):31–54, 1997. [Google Scholar]
  • [2].Grenfell Bryan T, Pybus Oliver G, Gog Julia R, Wood James L N, Daly Janet M, Mumford Jenny A, and Holmes Edward C. Unifying the epidemiological and evolutionary dynamics of pathogens. Science, 303(5656):327–332, January 2004. [DOI] [PubMed] [Google Scholar]
  • [3].Kim Jaehee, Rosenberg Noah A, and Palacios Julia A. Distance metrics for ranked evolutionary trees. Proc. Natl. Acad. Sci. U. S. A., 117(46):28876–28886, November 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [4].Samyak Rajanala and Palacios Julia A. Statistical summaries of unlabelled evolutionary trees. Biometrika, 111(1):171–193, March 2024. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [5].Drummond Alexei J and Andrew Rambaut. BEAST: Bayesian evolutionary analysis by sampling trees. BMC Evol. Biol., 7:214, November 2007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [6].Bouckaert Remco, Timothy G Vaughan Jolle Barido-Sottani, Duchne Sebastin, Fourment Mathieu, Gavryushkina Alexandra, Heled Joseph, Jones Graham, Khnert Denise, Nicola De Maio Michael Matschiner, Mendes Fbio K, Mller Nicola F, Ogilvie Huw A, Plessis Louis du, Alex Popinga, Andrew Rambaut, David Rasmussen, Igor Siveroni, Suchard Marc A, Wu Chieh-Hsi, Xie Dong, Zhang Chi, Stadler Tanja, and Drummond Alexei J. BEAST 2.5: An advanced software platform for bayesian evolutionary analysis. PLoS Comput. Biol., 15(4):e1006650, April 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [7].Baele Guy, Ji Xiang, Hassler Gabriel W, McCrone John T, Shao Yucai, Zhang Zhenyu, Holbrook Andrew J, Lemey Philippe, Drummond Alexei J, Rambaut Andrew, and Suchard Marc A. BEAST X for bayesian phylogenetic, phylogeographic and phylodynamic inference. Nat. Methods, pages 1–4, July 2025. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [8].Sagulenko Pavel, Puller Vadim, and Neher Richard A. TreeTime: Maximum-likelihood phylodynamic analysis. Virus Evol, 4(1):vex042, January 2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [9].Minh Bui Quang, Schmidt Heiko A, Chernomor Olga, Schrempf Dominik, Woodhams Michael D, Haeseler Arndt von, and Lanfear Robert. IQ-TREE 2: New models and efficient methods for phylogenetic inference in the genomic era. Mol. Biol. Evol., 37(5):1530–1534, May 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [10].Stamatakis Alexandros. RAxML version 8: a tool for phylogenetic analysis and post-analysis of large phylogenies. Bioinformatics, 30(9):1312–1313, May 2014. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [11].Victora Gabriel D and Nussenzweig Michel C. Germinal centers. Annu. Rev. Immunol., 3 February 2022. [DOI] [PubMed] [Google Scholar]
  • [12].John Frank Charles Kingman. The coalescent. Stochastic processes and their applications, 13(3):235–248, 1982. [Google Scholar]
  • [13].Aldous David. Probability distributions on cladograms. In Random discrete structures, pages 1–18. Springer, 1996. [Google Scholar]
  • [14].Sainudiin Raazesh and Amandine Véber. A beta-splitting model for evolutionary trees. Royal Society Open Science, 3(5):160016, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [15].Marcel-Paul Schtzenberger Dominique Foata. Nombres d’euler et permutations alternates. Technical report, University of Florida, 1971. [Google Scholar]
  • [16].Donaghey Robert. Alternating permutations and binary increasing trees. Journal of Combinatorial Theory, Series A, 18(2):141–148, 1975. [Google Scholar]
  • [17].Poupard Christiane. Deux proprits des arbres binaires ordonns stricts. European Journal of Combinatorics, 10(4):369–374, 1989. [Google Scholar]
  • [18].Andr Dsir. Sur les permutations alternes. Journal de Mathmatiques Pures et Appliques, 7:167–184, 1881. [Google Scholar]
  • [19].Entry A000111 in The On-Line Encyclopedia of Integer Sequences.
  • [20].Entry A002105 in The On-Line Encyclopedia of Integer Sequences.
  • [21].Steel Michael A. Phylogeny. Society for Industrial and Applied Mathematics, 2016. [Google Scholar]
  • [22].Palacios Julia A., Wakeley John, and Ramachandran Sohini. Bayesian nonparametric inference of population size changes from sequential genealogies. Genetics, 201(1):281–304, 2015. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [23].Stanley Richard P. Enumerative combinatorics, vol 1, 2nd edn. Cambridge University Press, 2012. [Google Scholar]
  • [24].Devroye Luc, Flajolet Philippe, Hurtado Ferran, Noy Marc, and Steiger William. Properties of random triangulations and trees. Discrete & Computational Geometry, 22(1):105–117, 1999. [Google Scholar]

Articles from ArXiv are provided here courtesy of arXiv

RESOURCES