---
title: 'TriNet: Metric for Level-1 Phylogenetics'
url: https://www.emergentmind.com/topics/trinet
type: topic
---

# TriNet: Metric for Level-1 Phylogenetics

TriNet denotes a trinet-based metric and computational framework for comparing binary level-1 phylogenetic networks on a common leaf set. Its central principle is to replace direct comparison of large reticulate networks by comparison of all displayed labeled trinets, that is, the tidied three-leaf subnetworks induced by each taxon triple. In this setting, disagreement is measured by a symmetric set difference on trinet sets, and the key theoretical justification is that the full set of displayed trinets encodes a level-1 network, so the resulting distance is a proper discriminator of reticulate structure rather than a coarse tree-derived surrogate [1703.05097].

## 1. Formal setting and basic objects

Let $X$ be a finite leaf set of size $n$. A rooted phylogenetic network $N$ on $X$ is a simple acyclic digraph with a unique root, no degenerate vertices, and leaves bijectively labeled by $X$. The binary restriction used by TriNet requires that each non-leaf vertex has indegree and outdegree at most two, and that each vertex with indegree two has outdegree one. A level-$k$ network is one in which every biconnected component contains at most $k$ reticulations; in particular, a level-1 network is binary and has the property that all cycles in its underlying graph are pairwise disjoint. This class is slightly more general than trees and includes networks often termed galled trees [1703.05097].

Two ancestor notions govern trinet extraction. For a subset $Y \subseteq X$, the lowest common ancestor $\mathrm{lca}(Y)$ is the common ancestor not above any other common ancestor of $Y$. A stable ancestor of $Y$ is a vertex contained in every dipath from the root to some taxon in $Y$, and the lowest stable ancestor $\mathrm{lsa}(Y)$ is the unique vertex below all stable ancestors of $Y$. In level-1 networks, $\mathrm{lca}(Y)$ exists and is unique, and either $\mathrm{lsa}(Y)=\mathrm{lca}(Y)$, or there is a unique dipath from $\mathrm{lsa}(Y)$ down to $\mathrm{lca}(Y)$ that contains no cut arc. For pairs $\{x,y\}$, the $\mathrm{lsa}$ table stores $\mathrm{lsa}(x,y)$ and is the main auxiliary structure used by TriNet [1703.05097].

Given a triple $Y=\{a,b,c\}\subseteq X$, the displayed trinet $N[Y]$ is obtained by restricting $N$ to the part reachable from $\mathrm{lsa}(Y)$ on dipaths to leaves in $Y$, then repeatedly suppressing degree-2 vertices and replacing parallel arcs by single arcs until no further tidying applies. Up to relabeling there are eight trinet types, but TriNet compares labeled trinets on the fixed leaf set by canonical encoding after suppression of degree-2 vertices and parallel edges. Equality is label-preserving isomorphism on the tidied three-taxon subnetworks [1703.05097].

## 2. Trinets as an encoding device

TriNet is rooted in the observation that triplets and trinets play fundamentally different roles in reticulate phylogenetics. Triplets are rooted three-leaf trees and suffice to encode rooted phylogenetic trees, but they generally do not encode rooted phylogenetic networks. Distinct level-1 networks can share all triplets, so triplet distance can be zero even when the underlying networks are different. Trinets generalize triplets by retaining local reticulation structure, and for level-1 networks the set of displayed trinets $T(N)$ encodes $N$ [1703.05097].

This encoding perspective predates the cubic-time distance algorithm. For 1-nested networks, displayed trinets were shown to determine the network uniquely and to support a polynomial-time construction algorithm from dense trinet sets [1110.0728]. Subsequent work extended identifiability beyond level-1: recoverable binary level-2 networks and binary tree-child networks are also encoded by their trinets, via decomposition theorems based on cut-arc sets and biconnected components [1210.0362]. These results place TriNet within a broader line of work in which three-taxon subnetworks are not merely local summaries but complete invariants for several important network classes.

A common misconception is that trinets are simply a network analogue of rooted triplets and therefore inherit the same limitations. The theory suggests the opposite for level-1 networks: triplets discard reticulation and cut-arc information, whereas trinets preserve enough local structure to determine the global network. A plausible implication is that TriNet’s discriminative power is a direct consequence of identifiability, not merely of using more local configurations.

## 3. Distance definition and metric properties

For a level-1 network $N$ on leaf set $X$, TriNet considers the set of displayed labeled trinets
$$
T(N)=\{\tau_{abc}(N): \{a,b,c\}\subseteq X\}.
$$
For two level-1 networks $N_1$ and $N_2$ on the same leaf set, the trinet distance is
$$
d_{\mathrm{trinet}}(N_1,N_2)=|\,T(N_1)\,\Delta\,T(N_2)\,|,
$$
where $\Delta$ is symmetric difference [1703.05097].

Because there are exactly ${n \choose 3}$ triples and each triple contributes at most one trinet to each network’s set, the diameter satisfies
$$
d_{\mathrm{trinet}}(N_1,N_2)\le 2{n \choose 3}.
$$
Equality is achievable, for example when one network is a tree and the other is a saturated level-1 network in which every interior vertex lies in a 3-cycle. This cubic scaling is intrinsic to the comparison unit: TriNet counts local disagreements over all three-taxon views, not just over vertex-induced clusters [1703.05097].

The metric interpretation is strengthened by the encoding theorem. Since the set of displayed trinets uniquely determines a level-1 network, zero trinet distance implies isomorphism of the compared networks. This is precisely the respect in which TriNet improves on triplet-based comparison: it is a proper metric on the target class rather than a pseudo-metric that can collapse distinct reticulate topologies.

A worked four-leaf example illustrates the counting mechanism. If $N_1$ is the rooted binary tree with topology $((a,b),(c,d))$ and $N_2$ is obtained by introducing a reticulation forming a reticulate cherry between $a$ and $c$, then the displayed trinets differ on $\{a,b,c\}$ and $\{a,c,d\}$ but agree on $\{a,b,d\}$ and $\{b,c,d\}$. Hence $d_{\mathrm{trinet}}(N_1,N_2)=2$ [1703.05097].

## 4. Cubic-time algorithm and implementation

The principal algorithmic contribution associated with TriNet is an optimal $O(n^3)$ procedure for computing $T(N)$, and hence the distance between two level-1 networks. The algorithm has two stages. First, it precomputes binets and the $\mathrm{lsa}$ table in $O(n^2)$ time. A binet is a displayed subnetwork on two taxa; up to relabeling there are two types, the cherry $T_0(x,y)$ and the reticulate cherry $S_0(x;y)$. The algorithm topologically orders tree vertices, computes clusters $C(v)$, and inspects the two child clusters $A$ and $B$ of each interior vertex. If $x\in A\cap B$ and $y\in A\Delta B$, then $S_0(x;y)$ is displayed with splitting ancestor $v$, and $\mathrm{lsa}(x,y)$ is set to $v$. If $x\in A\setminus B$ and $y\in B\setminus A$, then $T_0(x,y)$ is displayed with $\mathrm{lca}(x,y)=v$; if $\mathrm{lsa}(x,y)$ has not been recorded previously, it is set to $v$ [1703.05097].

The structural facts behind this preprocessing are specific to level-1 networks. For any pair $\{x,y\}$, the network has a unique $\mathrm{lca}$. Moreover, $T_0(x,y)$ occurs if and only if $\mathrm{lca}(x,y)=\mathrm{lsa}(x,y)$, equivalently if there is no splitting ancestor of $x$ and $y$. By contrast, $S_0(x;y)$ occurs if and only if $\mathrm{lca}(x,y)\prec \mathrm{lsa}(x,y)$, equivalently if $\mathrm{lsa}(x,y)$ is the unique splitting ancestor. These equivalences allow the algorithm to represent each pair by a binet type plus an $\mathrm{lsa}$ entry.

Second, the algorithm infers the displayed trinet for each unordered triple in $O(1)$ time per triple. For $Y=\{x_1,x_2,x_3\}$, it examines the three binets $N[x_i,x_j]$, counts the number $t$ of cherries among them, orders the taxa so that $\mathrm{lsa}(x_1,x_2)\preceq \mathrm{lsa}(x_2,x_3)=\mathrm{lsa}(x_1,x_3)$, and checks whether $N[x_1,x_2]$ is $T_0$ or $S_0(x_1;x_2)$. The resulting case analysis decides among the eight trinet types. When $t=3$, the trinet is $T_1(x_1,x_2;x_3)$; when $t=2$, it is $N_3(x_1;x_2;x_3)$; when $t=1$, the outcome is one of $S_1$, $S_2$, $N_2$, or $N_1$ depending on $\mathrm{lsa}$ relations and whether $S_0(x_1;x_3)\in B(N)$; when $t=0$, the outcome is $N_5$ or $N_4$ depending on the same binet membership test [1703.05097].

The total runtime is therefore $O(|X|^3)$, with $O(n^2)$ preprocessing and constant-time inference for each of the ${n \choose 3}$ triples. Space usage is $O(n^2)$ for the $\mathrm{lsa}$ table plus $O(n^3)$ to store all trinet encodings or hashed signatures. The bound is optimal in the standard exact model because any exact algorithm must in general inspect all triples, which are $\Omega(n^3)$ in number. Auxiliary size bounds for saturated level-1 networks, namely $|V(N)|\le 4n-3$ and $|E(N)|\le 5n-5$, support the preprocessing analysis [1703.05097].

The algorithms were implemented in Java in the TriLoNet package. The implementation supports parsing level-1 networks with labeled leaves, computing $T(N)$ by the cubic procedure, evaluating $d_{\mathrm{trinet}}$ and the restricted Robinson–Foulds distance, and running simulation workflows akin to those used in the original empirical study [1703.05097].

## 5. Comparison with the restricted Robinson–Foulds network metric

TriNet was evaluated against the Robinson–Foulds network metric restricted to level-1 networks. In that setting, $d_{RF}(N,N')$ is defined as the size of the symmetric difference of the cluster multisets induced by interior vertices. Using the bound $|V(N)|\le 4n-3$ and noting that root and leaf clusters are identical, one obtains
$$
d_{RF}(N,N')\le 6n-10.
$$
The contrast with TriNet is immediate: the trinet diameter scales as $\Theta(n^3)$, whereas the restricted RF diameter scales as $\Theta(n)$ [1703.05097].

Conceptually, the two metrics summarize different structures. RF compares vertex-induced clusters, which can be coarse in reticulate regions. TriNet compares all displayed three-leaf subnetworks and is therefore sensitive to local reticulate arrangements such as reticulate cherries and their position relative to $\mathrm{lca}$ and $\mathrm{lsa}$. This suggests why TriNet is typically more discriminative, though computationally more expensive.

The empirical comparison used three datasets of level-1 networks with 50 leaves. Lev(1) and Lev(10) were generated with the lev1athan model using one versus ten seeds, and Ran was generated by repeatedly attaching leaves to randomly chosen arcs via three operations. Distances were normalized to $[0,1]$ using the diameters $2{n \choose 3}$ for $d_{\mathrm{trinet}}$ and $6n-10$ for $d_{RF}$. Across datasets, the trinet metric exhibited a broader range and larger variance than RF, whereas the RF distributions were tighter [1703.05097].

| Metric | Normalized diameter | Average time on 50-leaf datasets |
|---|---:|---:|
| $d_{\mathrm{trinet}}$ | $2{n \choose 3}$ | 140, 145, and 231 minutes |
| $d_{RF}$ | $6n-10$ | 16, 21, and 58 minutes |

Timing measurements were obtained on a machine with an i7 CPU and 16 GB RAM. The results indicate a practical trade-off rather than a contradiction: RF is faster in practice, but TriNet captures more local reticulate disagreement and therefore yields a broader discriminatory range [1703.05097].

## 6. Scope, limitations, and later developments

TriNet, as defined in the cubic-time algorithm, is restricted to binary level-1 networks. This is not an incidental technical choice: the existence and uniqueness of $\mathrm{lca}$, the structure of splitting ancestors, and the fact that displayed trinets encode the network are all used directly in the algorithm and in the metric’s correctness arguments [1703.05097].

Extensions beyond level-1 are nontrivial. Trinets determine recoverable binary level-2 networks and binary tree-child networks, which suggests that trinet-based comparison may remain meaningful on broader classes, but the general statement that higher-level networks are determined by their trinets is not available. Indeed, the data explicitly notes that general higher-level networks are not necessarily determined by their trinets [1210.0362]. A plausible implication is that the TriNet metric remains most principled when identifiability by displayed trinets is established for the class under study.

Related reconstruction results clarify the surrounding landscape. Dense trinet sets can be used to decide displayability by a 1-nested network and to construct that network in polynomial time [1110.0728]. By contrast, for nondense collections of binets and trinets, deciding whether a binary level-1 network displays a given trinet set is NP-hard, although binet-only instances and certain restricted mixed instances remain polynomial-time solvable [1411.6804]. These results underscore that TriNet occupies the comparison side of a broader program in which trinets serve both as local encodings and as algorithmic primitives.

From a practical perspective, exact TriNet computation is optimal but cubic, so it is feasible for moderate numbers of leaves rather than very large networks. The original study notes that the method is usable up to dozens of leaves, while RF may be preferable for rapid screening. The same study also leaves several directions open, including faster approximate trinet distances, normalization and diameter results for other network metrics, and better random generators for level-1 networks [1703.05097].

Source: https://www.emergentmind.com/topics/trinet