Abstract 1 Introduction 2 Preliminaries 3 Generalizing the interleaving distance 4 Locally correct interleavings 5 Conclusion References

Locally Correct Interleavings Between Merge Trees

Thijs Beurskens ORCID TU Eindhoven, The Netherlands    Tim Ophelders ORCID TU Eindhoven, The Netherlands    Bettina Speckmann ORCID TU Eindhoven, The Netherlands    Kevin Verbeek ORCID TU Eindhoven, The Netherlands
Abstract

Merge trees are typically used as a topological summary of scalar fields. To analyze e.g. a time-varying scalar field via its merge tree representation, one needs a suitable method to match and compare two merge trees. We consider the interleaving distance as a method to match and compare merge trees. An interleaving between two merge trees consists of two maps, one in each direction. These maps must satisfy ancestor relations and hence introduce a “shift” between points and their image. An optimal interleaving minimizes the maximum shift; the interleaving distance is the value of this shift. However, to study the evolution of merge trees, we need not only a number but also a meaningful matching between the two trees. The two maps of an optimal interleaving induce a matching, but due to the bottleneck nature of the interleaving distance, this matching fails to capture local similarities between the trees. In this paper we hence propose a notion of local optimality for interleavings. To do so, we define the residual interleaving distance, a generalization of the interleaving distance that allows additional constraints on the maps. This allows us to define locally correct interleavings, which use a range of shifts across the two merge trees that reflect the local similarity well. We give a constructive proof that a locally correct interleaving always exists.

Keywords and phrases:
Interleaving distance, merge trees, local correctness, matchings, topological data analysis
Funding:
Thijs Beurskens: Supported by the Dutch Research Council (NWO) under project no. OCENW.M20.089.
Tim Ophelders: Supported by the Dutch Research Council (NWO) under project no. VI.Veni.212.260.
Copyright and License:
[Uncaptioned image] © Thijs Beurskens, Tim Ophelders, Bettina Speckmann, and Kevin Verbeek; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
Related Version:
Full Version: https://arxiv.org/abs/2512.16474
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

Terrains that vary over time are a common data type in various application areas, such as scientific computing or geographic information science. Typically such data sets are very large; to analyze them efficiently one often needs a compact abstraction that captures salient features. Topological data analysis (TDA) provides several topological descriptors, such as persistence diagrams, Reeb graphs, and Morse-Smale complexes, that can serve as abstractions for 2D, 3D, or higher-dimensional terrains. In this paper we focus in particular on merge trees, which are graph-based descriptors that encode the evolution of connected components of sublevel or superlevel sets of a terrain (see Figure 1). In the context of time-varying terrains, they have been used for feature tracking [7], cluster detection [16], and various other tasks in scientific visualization [17].

Figure 1: A terrain and its merge tree; leaves and internal vertices represent minima and saddles.

To analyze temporal sequences of terrains one does not only need a compact representation, but also efficient ways to compare these representations over time. For merge trees in particular, several distance measures have been proposed, including the (local) edit distance [13, 14], the Wasserstein distance [11], and the interleaving distance [8]. However, a distance measure returns only a numeric value that quantifies the similarity of two merge trees T1 and T2. In many application scenarios, we would also like to track the merge trees over time and hence need to understand which parts of T1 most closely correspond to parts of T2. That is, we are interested in a matching between T1 and T2.

The interleaving distance in fact relies on a type of matching between the two trees: the so-called interleaving. An interleaving is a pair of ancestor-preserving maps, one from T1 to T2 and one from T2 to T1, whose compositions send points to ancestors: if a point x of T1 is mapped to a point y of T2, then y must be mapped to an ancestor of x, and vice versa. The interleaving distance is the maximum shift – the distance between a point and its image – minimized over all interleavings between the trees. We give exact definitions of the interleaving distance and interleavings in Sections 2 and 3.

Figure 2: Two optimal interleavings between two merge trees (both with shift δ). Intuitively, the right interleaving induces a tighter and more meaningful matching than the left interleaving.

Two merge trees typically admit many optimal interleavings. The interleaving distance is a bottleneck measure and hence a given optimal interleaving might be locally quite “loose”: the shift might exceed what is needed and thereby fail to capture local similarities between the trees; see Figure 2. In the following we are hence developing a notion of locally optimal interleavings which allows us to distinguish between “tight” and “loose” optimal interleavings.

Contributions.

Our work is inspired by the concept of locally correct Fréchet matchings [3]; the Fréchet distance is a bottleneck measure for curves based on a matching between points on the curves. A locally correct Fréchet matching is then an optimal matching that remains optimal even when considering any two matched subcurves. This is a desirable feature, however, it cannot be directly reproduced for the interleaving distance. First of all, there might not even be a one-to-one correspondence between the points of T1 and T2. Furthermore, two optimal interleavings between different pairs of subtrees do not necessarily combine into an optimal interleaving between the two complete trees. As a first step we hence introduce a novel generalization of the interleaving distance that can handle additional constraints on the maps. Specifically, we aim to use constraints that force a point x to be mapped to an ancestor of a particular point y within the other tree. Over interleavings that satisfy such constraints, we aim to minimize the maximum shift over points x that are either unconstrained or map to a strict ancestor of their corresponding point y. We refer to the resulting distance as the residual interleaving distance. In Section 3, we provide formal definitions and show that an optimal interleaving exists for any constraints.

In Section 4 we then propose a definition for locally correct interleavings that builds upon the residual interleaving distance. Specifically, we define a restriction of an interleaving =(α,β) to two subsets S1 of T1 and S2 of T2 as the restriction of α to S1 together with the restriction of β to S2. We call locally correct if it minimizes the residual interleaving distance with respect to any restriction of . We constructively prove that a locally correct interleaving always exists. All omitted proofs can be found in the full version.

Related work.

The interleaving distance between merge trees was defined by Morozov, Beketayev, and Weber [8] as a tool to study the stability of merge trees. The authors of [1] establish a connection between the interleaving distance and the Gromov-Hausdorff distance, and they argue that approximating the interleaving distance within a factor of 3 is NP-hard. They also describe an 𝒪(min(n,rn))-approximation algorithm, where n is the total size of the trees and r is the ratio of the longest to the shortest edge. Touli and Wang [15] provide an equivalent definition of the interleaving distance in terms of a single map and use this characterization to design an FPT-algorithm for computing the interleaving distance exactly. More recently, the authors of [6] show that the interleaving distance can be formulated in terms of a related metric [9] for labeled merge trees, also known as phylogenetic trees.

Several attempts have been made to develop versions of the interleaving distance that can be used in practical applications. In particular, the results in [6] gave rise to heuristic algorithms for computing the interleaving distance [4] and for comparing terrains [16, 18]. Pegoraro [10] uses yet another reformulation of the interleaving distance, in terms of couplings, as the basis of a heuristic for computing the distance via linear integer programming. Lastly, the authors of [2] introduce a variant of the interleaving distance that imposes total orders on the merge trees, which can be computed efficiently via a connection to the Fréchet distance between one-dimensional curves.

2 Preliminaries

Let T be a rooted tree, that is, a tree with one vertex identified as the root. In the remainder of this paper, we identify T with a topological realization: we represent each edge of T by a unit segment [0,1] and connect these segments according to the adjacencies of their corresponding edges in T. We distinguish elements of the topological realization T, which we refer to as points of T, from vertices of the combinatorial tree, which we denote by V(T). A merge tree is a pair (T,f), where T is a finite rooted tree, and f:T{} is a continuous height function on T that is strictly increasing towards the root and such that the root has height . When clear from context, we use T to refer to the pair (T,f).

For two points x1 and x2 of T, we say x1 is a descendant of x2, written x1x2, if there exists an f-monotonically increasing path in T from x1 to x2. If furthermore x1x2 then x1 is a strict descendant of x2. We say x2 is a (strict) ancestor of x1 if x1 is a (strict) descendant of x2. Lastly, for a point x and a height value hf(x), we use x|h to denote the unique ancestor of x at height f(x|h)=h (see Figure 3a).

Figure 3: (a) The point x|h is the ancestor of x at height h. (b) A pair of δ-compatible maps. Left: C1 and C2 ensure that each point is mapped to a point of the other tree δ higher. Right: C3 and C4 ensure that both compositions map points to their ancestor 2δ higher.

Compatible maps.

The original definition of the interleaving distance between two merge trees (T1,f1) and (T2,f2) was given by Morozov, Beketayev, and Weber [8].

Definition 1 ([8]).

Fix a value δ0. Two continuous maps α:T1T2 and β:T2T1 are δ-compatible between T1 and T2 if for all xT1 and all yT2:

  1. (C1)

    f2(α(x))=f1(x)+δ,

  2. (C2)

    f1(β(y))=f2(y)+δ,

  3. (C3)

    β(α(x))=x|f1(x)+2δ, and

  4. (C4)

    α(β(y))=y|f2(y)+2δ.

The interleaving distance d(T1,T2) between T1 and T2 is the infimum δ for which there exist δ-compatible maps (see Figure 3b).

Critical values.

It has been shown [1, 15] that the interleaving distance between any two merge trees attains a value in a set of critical values. Specifically, let ΔΔ(T1,T2) be the union of three sets Δ1, Δ2, and Δ3, with

Δ1 {|f1(v)f2(w)|:vV(T1),wV(T2)},
Δ2 {12|f1(v1)f1(v2)|:v1,v2V(T1)}, (1)
Δ3 {12|f2(w1)f2(w2)|:w1,w2V(T2)}.
Lemma 2 ([1, 15]).

For any two merge trees T1 and T2, it holds that d(T1,T2)Δ(T1,T2).

3 Generalizing the interleaving distance

The interleaving distance is based on a pair of maps. As noted in [1], we can relax the requirements on these maps to allow varying height differences between points and their images. Building on this relaxed definition, we introduce a generalized version of the interleaving distance that accommodates constraints on the maps we consider. Specifically, each constraint specifies that a point x must be mapped to an ancestor of a particular point y within the other tree. Our goal is then to find the optimal pair of maps that “extends” a given set of constraints. We call the corresponding distance the residual interleaving distance. To define it formally, we first introduce partial up-maps, which represent the allowed maps between the two merge trees. In Section 3.1 we relax Definition 1 using partial up-maps. In Section 3.2 we then give the formal definition of the residual interleaving distance.

Partial up-maps.

Let (T1,f1) and (T2,f2) be two merge trees. An arrow from T1 to T2 is any pair of points (x,y)T1×T2 such that f1(x)f2(y). The shift of an arrow (x,y) is the height difference between x and y, denoted σ(x,y)f2(y)f1(x). Consider a subset of points ST1. A map φ:ST2 is a partial up-map from S to T2 if (i) f2(φ(x))f1(x) for all points x of S and (ii) it preserves ancestors, that is, x1x2 implies φ(x1)φ(x2) for all points x1,x2 of S. We use dom(φ)S to denote the domain of φ. For each point x of S, the pair (x,φ(x)) is an arrow. The graph of φ is the set of arrows of φ, denoted Aφ{(x,φ(x)):xS}. We define the shift of the partial up-map φ as the supremum shift over all arrows of φ:

σ(φ)sup{σ(a):aAφ}. (2)

Given an arrow (x,y) from S to T2, we say φ extends (x,y) if φ(x)y, and we say φ uses (x,y) if φ(x)=y. Similarly, for a subset SS and a partial up-map φ from S to T2, we say φ extends or uses φ if, respectively, φ extends or uses all arrows of φ (Figure 4a).

For any δ0, we can define a partial up-map φ[δ] from S to T2 that extends φ and such that the shift of each arrow is at least δ. Specifically, for each point x of S, let hxmax(f1(x)+δ,f2(φ(x))) and define φ[δ](x)φ(x)|hx (see Figure 4b).

Lemma 3.

For any δ0, the map φ[δ] is a partial up-map that extends φ.

Proof.

Let φφ[δ]. By construction, we have f2(φ(x))f1(x). To see that φ preserves ancestors, take two points x1,x2 of S such that x2 is an ancestor of x1. Since φ preserves ancestors, φ(x2) is an ancestor of φ(x1). If φ(x1)=φ(x1), we get φ(x1)φ(x2)φ(x2). Otherwise φ(x1) is a strict ancestor of φ(x1). By construction, f2(φ(x1))=f1(x1)+δf1(x2)+δf2(φ(x2)). Both φ(x1) and φ(x2) are ancestors of φ(x1), so φ(x2) is an ancestor of φ(x1). So φ is a partial up-map, and by construction also extends φ. We define arrows and up-maps from a subset S of T2 to T1 symmetrically.

Partial interleavings.

Fix two subsets S1T1 and S2T2. A partial interleaving 𝒫 between S1 and S2 is a pair of partial up-maps φ:S1T2 and ψ:S2T1 such that for all points x of S1 and all points y of S2 it holds that if φ(x)y then ψ(y)x, and if ψ(y)x then φ(x)y (Figure 4c). The shift of 𝒫, denoted σ(𝒫), is the maximum of the shift of φ and the shift of ψ. The graph of 𝒫 is the union of the graph of φ and the graph of ψ, denoted A𝒫AφAψ. Given another partial interleaving 𝒫=(φ,ψ), we say 𝒫 extends 𝒫 if φ extends φ and ψ extends ψ. Similarly, 𝒫 uses 𝒫 if φ uses φ and ψ uses ψ.

Figure 4: (a) A partial up-map (non-dashed) that extends another partial up-map (dashed). (b) A partial up-map φ (dashed) and the map φ[δ] (non-dashed). (c) A partial interleaving.
Lemma 4.

For any δ0, the pair (φ[δ],ψ[δ]) is a partial interleaving that extends (φ,ψ).

Proof.

Denote φφ[δ] and ψψ[δ]. By Lemma 3, the maps φ and ψ are partial up-maps that extend φ and ψ, respectively. Therefore, it suffices to show that the pair (φ,ψ) is a partial interleaving. Let x be a point of S1 and y be a point of S2 such that φ(x)y. By construction, the point φ(x) is an ancestor of φ(x), so y is also an ancestor of φ(x). Since (φ,ψ) is a partial interleaving, the point ψ(y) must be an ancestor of x. As ψ(y) is an ancestor of ψ(y), we get ψ(y)x. Symmetrically, if ψ(y)x then φ(x)y.

3.1 Complete Interleavings

If S1=T1, we call a partial up-map α:S1T2 a complete up-map, or simply an up-map, from T1 to T2. Symmetrically, if S2=T2, we call a partial up-map β:S2T1 a (complete) up-map from T2 to T1. Correspondingly, if S1=T1 and S2=T2, we call the partial interleaving (α,β) a (complete) interleaving. The defining property for a complete interleaving then becomes that for all xT1 it holds that β(α(x))x and for all yT2 it holds that α(β(y))y.

Lemma 5.

d(T1,T2)=inf{δ:T1 and T2 admit a complete interleaving with shift δ}.

Optimal interleavings.

The interleaving distance is defined as an infimum, but in both [5, 10] the authors prove that the infimum can be replaced by a minimum: there always exists an interleaving with shift d(T1,T2) (Theorem 6). We call an interleaving that realizes the interleaving distance an optimal interleaving. Both proofs rely on alternative definitions of the interleaving distance, namely in terms of labellings [5] and in terms of couplings [10]. We can show the same statement more directly: if the shift δ of an interleaving is not equal to a critical value, we can obtain an interleaving whose shift δ<δ is equal to a critical value. Intuitively, we “push down” each arrow of so that its shift becomes δ (see Figure 5). Later, in Section 3.2, we describe a formal construction to prove a generalization of Theorem 6.

Figure 5: The shift of the dashed interleaving is not equal to a critical value, so we can obtain another interleaving (non-dashed) with strictly smaller shift by “pushing down” the image of each point. If we push below a vertex (right) we carefully need to choose the correct subtree.
Theorem 6.

Any two merge trees T1 and T2 admit an optimal interleaving.

3.2 Residual Interleaving Distance

Fix a partial interleaving 𝒫=(φ,ψ). We refer to a (partial) interleaving that extends 𝒫 as a (partial) 𝒫-extension. We first observe that there always exists a complete 𝒫-extension. Indeed, the maps that take every point of T1 to the root at of T2, and every point of T2 to the root at of T1 form a complete interleaving that extends 𝒫.

Our goal is to find a “tightest possible” complete 𝒫-extension, that is, an interleaving that extends 𝒫 and minimizes the shift of the remaining arrows. For some intuition, consider the example in Figure 6. The map φ consists of a single (dashed) arrow (x,y). Intuitively, the map α2 describes a “tighter” extension of φ than the map α1. However, if we only disregard the shift of (x,y), the shift of the remaining arrows of α1 is equal to the (supremum) shift of the remaining arrows of α2. The arrow (x,y) implicitly induces a “fan” of arrows that all valid up-maps need to extend. Specifically, any ancestor of x needs to be mapped to an ancestor of y. To distinguish between the maps α1 and α2, we therefore not only disregard the shift of (x,y), but of any arrow that is “contained” within such a fan.

Figure 6: The φ-residual shift of arrows within the fan F[(x,y)] (illustrated with the shaded area) is equal to 0, so the φ-residual shift of α2 is smaller than the φ-residual shift of α1.

Formally, we define the fan of an arrow (x,y) as the set of arrows (x,y) for all ancestors x of x with height at most that of y, written,

F[(x,y)]{(x,y):xT1 such that xx and f1(x)f2(y)}.

The fan of a collection of arrows A, denoted F[A], is the union of all fans F[a] for aA. We refer to the fan F[Aφ] as the fan of φ.

We use fans to define the φ-residual shift, or φ-shift for short. Recall that we use Aφ to denote the set of all arrows (x,φ(x)). For an arrow a from T1 to T2, the φ-residual shift of a, denoted σφ(a), is zero if a lies within F[Aφ], and is σ(a) otherwise. Similar to the definition of shift in Eq. 2, we define the φ-residual shift of an up-map φ, denoted σφ(φ), as the supremum φ-residual shift over all arrows of φ. That is,

σφ(x,y){0if (x,y)F[Aφ],σ(x,y)else,σφ(φ)sup{σφ(a):aAφ}.

Consider again the example in Figure 6. We disregard the shifts of all arrows within the fan F[(x,y)]. As a result, the φ-shift of α2 is δ, whereas the φ-shift of α1 is δ.

We define the ψ-(residual) shift of a partial up-map ψ symmetrically. Finally, for a partial interleaving 𝒫=(φ,ψ), we define the 𝒫-residual shift, or 𝒫-shift, of 𝒫 as the maximum of the φ-shift of φ and the ψ-shift of ψ, denoted σ𝒫(𝒫).

Definition 7.

The 𝒫-residual interleaving distance d𝒫(T1,T2) between T1 and T2 is the infimum δ for which there exists a complete 𝒫-extension whose 𝒫-residual shift is δ.

When they are clear from context, we omit the arguments T1 and T2 and simply write d𝒫 to denote the 𝒫-residual interleaving distance between T1 and T2. We say an extension is optimal if its residual shift is equal to the residual interleaving distance.

Critical values and pairs.

Figure 7: In both examples, the non-dashed arrow is (part of) an optimal interleaving; the value δ is not equal to a critical value. It is equal to a 𝒫-critical value.

For the remainder of this section, we consider finite partial interleavings 𝒫: both dom(φ) and dom(ψ) consist of finitely many points. Recall from Section 2 that the non-residual interleaving distance always attains a value in the set of critical values ΔΔ(T1,T2). For the residual interleaving distance, this set Δ is not always sufficient (see Figure 7). Therefore, we extend Δ to a set of 𝒫-critical values. Specifically, we “mark” all vertices in T1 and T2, and all points x of T1 and y of T2 that appear in an arrow (x,y) or (y,x) of 𝒫. We call these the 𝒫-critical points of T1 and T2, denoted C1[𝒫] and C2[𝒫] respectively. Since 𝒫 is finite, there are only finitely many critical points. We define a set Δ1[𝒫] that contains all height differences between critical points:

Δ1[𝒫] {|f1(v)f2(w)|:vC1[𝒫],wC2[𝒫]}.

We define the set of 𝒫-critical values as the set Δ[𝒫](T1,T2)Δ1[𝒫]Δ2Δ3, where Δ2 and Δ3 are as defined in Eq. (2). Each critical value corresponds to a pair of critical points; we refer to such a pair b as a 𝒫-critical pair. We distinguish two types; see Figure 8.

Figure 8: There are two types of critical pairs: arrow critical pairs (w,v) and (v,w) (left) and zigzag critical pairs (v1,v2) and (w1,w2) (right). The pair (v,w) correspond to a 𝒫-critical value.
  • If b=(v,w) for a point vC1[𝒫] and a point wC2[𝒫], then b is an arrow critical pair that corresponds to the critical value σ(v,w). We say a partial interleaving (φ,ψ) uses b if φ(v)=w. The case that b=(w,v) is symmetric.

  • If b=(v1,v2) for two vertices v1,v2 in V(T1), then b is a zigzag critical pair that corresponds to the critical value 12(f1(v2)f1(v1)). We say a partial interleaving (φ,ψ) uses b if there is a point yT2 with f2(y)=f1(v1)+12(f1(v2)f1(v1)) such that φ(v1)=y and ψ(y)=v2. The case that b=(w1,w2) for two vertices w1,w2 in V(T2) is symmetric.

Similar to Lemma 2, we show that the 𝒫-residual interleaving distance always attains a value in the set of 𝒫-critical values. A 𝒫-critical pair is a realizing critical pair if it corresponds to the 𝒫-residual interleaving distance. We can additionally show that there always exists an optimal 𝒫-extension and that any such extension uses a realizing critical pair.

Lemma 8.

Let 𝒫 be a finite interleaving. For any complete 𝒫-extension with 𝒫-shift δ that does not use a critical pair that corresponds to δ, there exists another 𝒫-extension whose 𝒫-shift is equal to a 𝒫-critical value that is strictly less than δ.

Proof sketch..

Consider a 𝒫-extension =(α,β) with 𝒫-shift δ, and assume 𝒫 does not use a critical pair that corresponds to δ. We modify into an extension =(α,β) whose 𝒫-shift is equal to a 𝒫-critical value that is strictly less than δ. Let δΔ[𝒫] be the greatest value that satisfies δ<δ. Intuitively, we modify by “pushing down” each arrow (recall Figure 5). We describe the construction of α; the construction of β is symmetric.

We assume, without loss of generality, that each arrow of α has shift at least δ. Otherwise, we replace α by α[δ]. Since the residual shift of an arrow is bounded by its shift, and since δ<δ, the φ-residual shift of α[δ] is bounded by δ. For xT1, let vxC1[𝒫] be the highest descendant critical point of x; if xC1[𝒫], then vx=x. Moreover, let wxC2[𝒫] be the highest descendant critical point of α(vx). Let hxmax(f1(x)+δ,f2(wx)). We define α(x) as the ancestor of wx at height hx, that is, α(x)wx|hx.

It is not hard to prove that α is an up-map that extends φ. To show that the φ-shift of α is bounded by δ, we argue that any arrow (x,y) of α with shift strictly greater than δ must be inside the fan of φ. Specifically, we show that then also the shift δ of the arrow (vx,wx) is strictly greater than δ. The pair (vx,wx) is a critical pair; since does not use a critical pair that corresponds to δ, it moreover follows that δ cannot be equal to δ. So, by choice of δ, we get δ>δ. As a result, (vx,wx), and therefore also (x,wx) must lie within the fan of φ: their residual shift is 0. Symmetrically, the map β is an up-map that extends ψ and has ψ-shift at most δ. We can then argue that the resulting pair is an interleaving. Lemma 8 directly implies Corollaries 9 and 10.

Corollary 9.

If 𝒫 is finite, then any optimal 𝒫-extension uses a realizing critical pair.

Corollary 10.

If 𝒫 is finite, then d𝒫(T1,T2)Δ[𝒫](T1,T2).

Let δ1Δ[𝒫] be the greatest value that satisfies δ1d𝒫 and let δ2Δ[𝒫] be the smallest value that satisfies δ2>d𝒫. By definition of d𝒫, for all ε>0 there is a 𝒫-extension with 𝒫-shift d𝒫+ε. In particular, for ε small enough, there is a 𝒫-extension with 𝒫-shift δ1<σ𝒫()<δ2. In other words, there are no critical pairs that correspond to σ𝒫(). This means that cannot use a critical pair that corresponds to the 𝒫-shift of . By Lemma 8, it then follows that there exists a 𝒫-extension with 𝒫-shift δ1=d𝒫.

Theorem 11.

Any finite partial interleaving 𝒫 between any two merge trees T1 and T2 admits an optimal 𝒫-extension.

Isolated extensions.

To reason about “greatest” shifts and “highest” ancestors, it is useful to have optimal extensions that satisfy two additional finiteness properties. Specifically, assume the 𝒫-residual interleaving distance is strictly positive, that is, d𝒫>0. We say an optimal 𝒫-extension is isolated if (1) the 𝒫-shift of only finitely many arrows of is equal to d𝒫, and (2) there exists some ε>0 such that for each arrow (x,y) of with 𝒫-shift at least d𝒫ε, there exists a descendant x of x, such that (x,y) is an arrow in with the same target and 𝒫-shift d𝒫.

Lemma 12.

If 𝒫 is finite and d𝒫>0, there exists an isolated 𝒫-extension.

4 Locally correct interleavings

The interleaving distance is a bottleneck distance: it yields a single value that quantifies the worst discrepancy between the two merge trees. While this global value is useful for comparison, we are interested in the actual interleavings that realize the distance. Importantly, we seek interleavings that are not only globally optimal, but also locally meaningful. Specifically, if a part of the interleaving is fixed, we want the remainder to be optimal relative to this fixed part. To formalize this notion of local optimality, we build upon the residual interleaving distance introduced in the previous section.

Let (T1,f1) and (T2,f2) be two merge trees, and fix a partial interleaving 𝒫=(φ,ψ). For a subset S1dom(φ), we define the restriction of φ to S1 as the map φ|S1:S1T2 given by φ|S1(x)φ(x) for all points x of S1. Any restriction of φ is a partial up-map, and φ extends all of its restrictions. The restriction of ψ to a subset S2T2 is defined symmetrically. Lastly, the pair =(φ|S1,ψ|S2) is a partial interleaving such that 𝒫 extends . We call a restriction of 𝒫. Let be a complete interleaving. We make the following observation:

Observation 13.

For any restriction of , it holds that d(T1,T2)σ().

A complete interleaving is locally correct if for all restrictions of , the -residual shift of is equal to the -residual interleaving distance.

Definition 14.

A complete interleaving =(α,β) is locally correct if and only if for all S1T1 and S2T2, the restriction =(α|S1,β|S2) satisfies

d(T1,T2)=σ(). (3)
Figure 9: Three pairs of merge trees; for each pair we show an interleaving that is locally correct (), and one that is not (). If we fix the non-dashed arrows in the cases, the dashed arrows violate Eq. (3); e.g. for the middle example, if we fix the blue arrows, then the image of the red point needs to be an ancestor of both blue points, requiring a shift greater than the interleaving distance.

See Figure 9 for some examples of interleavings that are (not) locally correct.

Suppose is locally correct. Taking as the empty restriction, we see that satisfies d(T1,T2)=σ(). In other words, any locally correct interleaving is an optimal interleaving. The reverse is not necessarily true; not every optimal interleaving is locally correct (see Figure 2). That raises the question: does a locally correct interleaving always exist? In the remainder of this section, we answer this question affirmatively.

Theorem 15.

Any two merge trees T1 and T2 admit a locally correct interleaving.

Overview of the proof.

To prove Theorem 15, we give an explicit construction of a locally correct interleaving. Specifically, we incrementally build a partial interleaving 𝒫 by augmenting it with “bottleneck” arrows. We show that with every augmentation, the 𝒫-residual interleaving distance strictly decreases, until, after a finite number of iterations, it becomes zero. To conclude the proof, we then show that any complete interleaving that extends the resulting partial interleaving 𝒫 is locally correct.

4.1 Bottlenecks

The interleaving distance is determined by the greatest shift among all arrows of an optimal interleaving. Locally, we might improve such an interleaving by “pushing down” some of the arrows, thereby decreasing their shifts. However, we cannot do this for all arrows; otherwise, we would obtain an interleaving whose shift is strictly smaller than the interleaving distance. We are interested in a bottleneck: a set of arrows that we cannot “push down”.

We first define the relative difference of two, not necessarily related, partial up-maps φ and φ. Specifically, consider the set of points for which either φ is defined and φ is not, or for which both are defined but where they do not agree:

Sdom(φ){xdom(φ)dom(φ):φ(x)=φ(x)}.

We define the relative difference of φ and φ as the restriction of φ to S, denoted φφφ|S. Similarly, for two partial interleavings 𝒫=(φ,ψ) and 𝒫=(φ,ψ), we define the relative difference 𝒫𝒫 as the pair of relative differences (φφ,ψψ). The resulting pair is a restriction of 𝒫, so it directly follows that any relative difference is a partial interleaving.

Augmentations.

Fix a partial interleaving 𝒫=(φ,ψ). In the remainder of this section, we assume that 𝒫 is finite, and that the 𝒫-residual interleaving distance is strictly positive, that is, d𝒫>0. A 𝒫-extension 𝒬 is a 𝒫-augmentation if (i) the 𝒫-residual shift of 𝒬 is at most d𝒫, that is, σ𝒫(𝒬)d𝒫, and (ii) the 𝒬-residual interleaving distance is strictly less than d𝒫, that is, d𝒬<d𝒫. We say that 𝒬 is minimal if it does not extend any other 𝒫-augmentation.

Lemma 16.

Any finite interleaving 𝒫 with d𝒫>0 admits a finite minimal 𝒫-augmentation.

Figure 10: A partial interleaving 𝒫 and two augmentations 𝒬1 and 𝒬2. 𝒬1 is not a minimal augmentation, as 𝒬2 is strictly smaller. The 𝒬2-residual shift is strictly smaller than δ (right).

Let 𝒬 be a minimal 𝒫-augmentation. We refer to the relative difference 𝒬𝒫 as a 𝒫-bottleneck. Intuitively, a bottleneck captures a minimal set of arrows that we need to “add” to decrease the residual interleaving distance. See Figure 10 for an illustration.

Recall (the proof of) Lemma 8. If we apply the lemma to a given 𝒫-extension that does not use a realizing critical pair, we can construct another 𝒫-extension that has strictly smaller shift. The exact same proof still works for a slightly stronger statement: it suffices to assume that the relative difference 𝒫 does not use a realizing critical pair.

Observation 17.

Let 𝒫 be a finite interleaving and let be a 𝒫-extension. If 𝒫 does not use a realizing critical pair, there exists a 𝒫-extension with σ𝒫()<σ𝒫().

We use this observation to prove the following lemma.

Lemma 18.

If 𝒫 is finite and d𝒫>0, any 𝒫-bottleneck 𝒬𝒫 uses a realizing critical pair.

Proof.

Let be an optimal 𝒬-extension. Since 𝒬 extends 𝒫, so does . Moreover, as is optimal, the 𝒬-shift of is equal to the 𝒬-residual interleaving distance, that is, σ𝒬()=d𝒬. Since 𝒬 is an augmentation, the shift of all arrows of 𝒬𝒫 is at most d𝒫, and d𝒬<d𝒫. Combining, we obtain σ𝒫()d𝒫. In other words, is an optimal 𝒫-extension. By Observation 17, it follows that 𝒫 uses a realizing critical pair b. As d𝒬<d𝒫, we get that the 𝒬-shift of the arrows that correspond to b must be 0. In other words, 𝒬𝒫 uses b. A direct consequence of Lemma 18 is that if, for a given 𝒫-extension 𝒬, the relative difference 𝒬𝒫 does not use a realizing critical pair, then 𝒬 cannot be a 𝒫-augmentation. In other words, we have the following corollary:

Corollary 19.

Let 𝒫 be a finite interleaving with d𝒫>0, and let 𝒬 be a 𝒫-extension. If σ𝒫(a)<d𝒫(T1,T2) for all arrows aA𝒬, then d𝒬(T1,T2)d𝒫(T1,T2).

For a partial interleaving 𝒫=(φ,ψ), we use 𝒫.φ and 𝒫.ψ to denote φ and ψ, respectively.

4.2 Constructing a Locally Correct Interleaving

We show that a locally correct interleaving always exists by incrementally constructing one. Specifically, let 𝒫 be an empty interleaving. We iteratively replace 𝒫 with a finite minimal 𝒫-augmentation, and we show that after a finite number of iterations the 𝒫-residual interleaving distance becomes zero, at which point we stop iterating. We conclude by showing that for the resulting partial interleaving 𝒫, any optimal 𝒫-extension is locally correct. For this, we maintain three invariants throughout the entire construction. First, we argue that 𝒫 remains dominant: the shift of each arrow of 𝒫 is strictly greater than d𝒫. Secondly, we show that for all restrictions of 𝒫 it holds that dσ(𝒫); we say 𝒫 is partially locally correct. Lastly, we show that after each step of the construction, 𝒫 “specifies” at least one additional vertex of the input merge trees. Since each vertex can be specified at most once, it follows that the construction terminates.

Invariants.

Formally, let 𝒫 be a partial interleaving and assume d𝒫>0. Recall that another partial interleaving 𝒬 uses 𝒫 if they completely agree on the domains of 𝒫.φ and 𝒫.ψ.

Lemma 20.

Let 𝒫 be a dominant, finite interleaving with d𝒫>0. For any finite minimal 𝒫-augmentation 𝒬, (i) 𝒬 uses 𝒫, and (ii) 𝒬𝒫 uses only realizing critical pairs.

We use this lemma to argue that 𝒫 remains locally correct throughout the construction.

Lemma 21.

Let 𝒫 be a finite interleaving and suppose d𝒫>0. Let 𝒬 be a finite minimal 𝒫-augmentation. If 𝒫 is dominant and locally correct, then so is 𝒬.

Proof.

We first argue that 𝒬 is dominant. Let a be an arrow of 𝒬. If a is also an arrow of 𝒫, then from the fact that 𝒫 is dominant we know that σ(a)>d𝒫>d𝒬. Otherwise, a must be an arrow of the bottleneck 𝒬𝒫. By Lemma 20, it then directly follows that σ(a)=d𝒫>d𝒬.

Next, we argue that 𝒬 is locally correct. Consider a restriction of 𝒬; we need to show that dσ(𝒬). If =𝒬, we immediately obtain σ(𝒬)=0d. Otherwise, let be the restriction of to the domains of 𝒫.φ and 𝒫.ψ. Since 𝒬 uses 𝒫, it follows that uses 𝒫 and is hence a restriction of 𝒫. If =𝒫, then by definition of an augmentation we know that the -shift of any arrow of 𝒬 is d𝒫. We obtain σ(𝒬)=d𝒫. Moreover, since 𝒬, the -shift of at least one arrow of 𝒬𝒫 is non-zero. We obtain σ(𝒬)=σ(𝒬)=d𝒫. Since 𝒬 is a minimal augmentation and extends , we know that cannot be an augmentation of 𝒫. It follows that dd𝒫. Putting it together, we obtain d=σ(𝒬).

Lastly, if 𝒫, then since 𝒫 is locally correct and is a restriction of 𝒫, we have

dσ(𝒫). (4)

We first show that σ(𝒫)σ(𝒬). First, none of the arrows of are arrows of 𝒫, so σ(𝒫)=σ(𝒫). Next, the -residual shift of 𝒬 is the maximum of the -residual shifts of 𝒫 and 𝒬𝒫. Since 𝒫 is dominant, we know that the shift of any arrow of 𝒫 is strictly greater than d𝒫. As 𝒫 is not empty, it follows that σ(𝒫)>d𝒫. On the other hand, by definition of an augmentation, we know that the shift of any arrow of 𝒬𝒫 is at most d𝒫. So, we get σ(𝒬)=max(σ(𝒫),σ(𝒬𝒫))=σ(𝒫). Combining, we obtain σ(𝒫)σ(𝒬).

Next, we argue that dd. By construction, extends . As observed before, we have σ(𝒫)=σ(𝒫)>d𝒫. Combining with Equation (4), we obtain dσ(𝒫)>d𝒫. Let a be an arrow of . Then a is an arrow of the bottleneck 𝒬𝒫, so the shift of a is exactly d𝒫. In other words, σ(a)=d𝒫<d. This means that we can apply Corollary 19, for the finite interleaving and the -extension , to obtain dd.

Thus, ddσ(𝒫)=σ(𝒬), which concludes the proof. Recall that for each arrow (x,y), with xT1 and yT2, of 𝒫, both x and y are critical points. However, only the point x has a “specified” target in the other tree. We say a point xT1 or yT2 is specified by 𝒫, if xdom(𝒫.φ) or ydom(𝒫.ψ) respectively (see Figure 11). For our last invariant, we argue that 𝒫 specifies all critical points that are not vertices, i.e., C1[𝒫]V(T1)dom(𝒫.φ) and C2[𝒫]V(T2)dom(𝒫.ψ).

Figure 11: The points x1, x2, y1, y2 and y3 are all critical, but only x2, y1 and y2 are specified.
Lemma 22.

Let 𝒫 be a finite interleaving and suppose d𝒫>0. Let 𝒬 be a finite minimal 𝒫-augmentation. If 𝒫 is dominant and specifies all critical points that are not vertices, then so does 𝒬. Moreover, 𝒬 specifies at least one vertex that 𝒫 does not specify.

Proof.

By Lemma 20, we know that the bottleneck 𝒬𝒫 uses only 𝒫-critical pairs. Consider such a pair b. If b is an arrow critical pair, then without loss of generality assume b=(x,y) for a point xT1 and a point yT2; the case b=(y,x) is symmetric. By definition of an arrow critical pair, both x and y are 𝒫-critical points. So the pair b does not create any additional 𝒬-critical points. As 𝒫 already specifies all critical points that are not vertices and 𝒬 uses 𝒫, we know that x must be a vertex. Since 𝒫 is dominant, the shift of any arrow of 𝒫 is strictly greater than d𝒫. Moreover, the shift of any arrow of 𝒬𝒫 is exactly d𝒫. Hence, the vertex x cannot be specified by 𝒫: at least one new vertex is specified.

If b is a zigzag critical pair, then without loss of generality assume b=(x1,x2) for two points x1 and x2 of T1; if it is a pair of points of T2 the argument is analogous. By definition of a zigzag critical pair, we know that both x1V(T1) and x2V(T1). Moreover, there is a point yT2 such that Q.φ(x1)=y and Q.ψ(y)=x2. So, x1 is a vertex that is specified by 𝒬 but not by 𝒫. Lastly, b creates a single 𝒬-critical point y, which is immediately specified.

Finishing the proof of Theorem 15.

Let 𝒫 be the empty interleaving. Trivially, 𝒫 is dominant and locally correct. Moreover, there are no (unspecified) critical points that are not vertices. Now, we iteratively replace 𝒫 with a finite minimal 𝒫-augmentation until the 𝒫-residual interleaving distance becomes zero. By applying Lemmas 21 and 22 inductively, we maintain that 𝒫 is dominant and locally correct, and specifies all critical points that are not vertices. Additionally, by Lemma 22, each iteration specifies at least one additional vertex. So after i iterations, at least i vertices are specified, and the total number of iterations is at most |V(T1)|+|V(T2)|. Afterwards, the residual interleaving distance is zero. Lemma 23 guarantees that a locally correct interleaving exists; its proof is similar to that of Lemma 21.

Lemma 23.

Let 𝒫 be a locally correct partial interleaving with d𝒫=0. Any optimal 𝒫-extension is locally correct.

Computing a locally correct interleaving.

We sketch how the above construction can be translated into an incremental algorithm. To compute the residual interleaving distance, we modify the dynamic program by Touli and Wang [15] to also incorporate constraints induced by partial interleavings. We use the output to extract some augmentation. We then iteratively reduce the set of critical pairs by repeatedly calling the modified dynamic program until we obtain a (finite) minimal augmentation. This minimal augmentation, in turn, reduces the residual interleaving distance; we iterate until it has dropped to zero. To obtain a locally correct interleaving, we select suitable entries from the table filled by the modified dynamic program. A naive implementation of this algorithm takes n iterations, each of which needs to compute the residual interleaving distance O(n2) times to obtain a minimal augmentation (since an augmentation contains O(n2) critical pairs). So, the total running time of our algorithm is O(n3T(n)), where T(n) is the running time of computing the residual interleaving distance. The algorithm by Touli and Wang [15] takes O(n42τττ+2logn) time, where τ is a parameter related to the maximum degrees in the input trees.

5 Conclusion

We introduced locally correct interleavings between merge trees, which are optimal interleavings that are “tight”. For this, we introduced the residual interleaving distance: a generalized version of the interleaving distance that can accommodate constraints on the interleavings. We presented a constructive proof that there always exists a locally correct interleaving.

We plan to further investigate the complexity of computing a locally correct interleaving, and we will study the effect of partial interleavings on the running time of the modified dynamic program. Furthermore, we will explore the effects of replacing the dynamic program with the approximation algorithm [1] or one of the variants or heuristics. Moreover, it would be interesting to study other (local) criteria of interleavings. Since locally correct interleavings are not necessarily unique, we could minimize their total shift, for a suitable definition of total. We could also consider a lexicographic optimization, inspired by lexicographic Fréchet matchings [12]. Lastly, we want to explore in which way locally correct interleavings can be translated to meaningful matchings between terrains.

References

  • [1] P.K. Agarwal, K. Fox, A. Nath, A. Sidiropoulos, and Y. Wang. Computing the Gromov-Hausdorff distance for metric trees. ACM Transactions on Algorithms, 14(2):1–20, 2018. doi:10.1145/3185466.
  • [2] T. Beurskens, T. Ophelders, B. Speckmann, and K. Verbeek. Relating interleaving and Fréchet distances via ordered merge trees. Journal of Computational Geometry, 17(1):1–36, 2026. doi:10.20382/jocg.v17i1a1.
  • [3] K. Buchin, M. Buchin, W. Meulemans, and B. Speckmann. Locally correct Fréchet-matchings. Computational Geometry, 76(1):1–18, 2019. doi:10.1016/j.comgeo.2018.09.002.
  • [4] J. Curry, H. Hang, W. Mio, T. Needham, and O. B. Okutan. Decorated merge trees for persistent topology. Journal of Applied and Computational Topology, 6(3):371–428, 2022. doi:10.1007/s41468-022-00089-3.
  • [5] E. Gasparovic, E. Munch, S. Oudot, K. Turner, B. Wang, and Y. Wang. Intrinsic interleaving distance for merge trees. arXiv:1908.00063.
  • [6] E. Gasparovic, E. Munch, S. Oudot, K. Turner, B. Wang, and Y. Wang. Intrinsic interleaving distance for merge trees. La Matematica, 4(1):40–65, 2025. doi:10.1007/s44007-024-00143-9.
  • [7] W. Köpp and T. Weinkauf. Temporal merge tree maps: A topology-based static visualization for temporal scalar data. IEEE Transactions on Visualization and Computer Graphics, 29(1):1157–1167, 2022. doi:10.1109/TVCG.2022.3209387.
  • [8] D. Morozov, K. Beketayev, and G. Weber. Interleaving distance between merge trees. Manuscript (accessed on 06-03-2025), 2013. URL: https://mrzv.org/publications/interleaving-distance-merge-trees/manuscript/.
  • [9] E. Munch and A. Stefanou. The -cophenetic metric for phylogenetic trees as an interleaving distance. In Research in Data Science, volume 17 of Association for Women in Mathematics Series, pages 109–127. Springer International Publishing, 2019. doi:10.1007/978-3-030-11566-1_5.
  • [10] M. Pegoraro. A graph-matching formulation of the interleaving distance between merge trees. AIMS Mathematics, 10(6):13025–13081, 2025. doi:10.3934/math.2025586.
  • [11] M. Pont, J. Vidal, J. Delon, and J. Tierny. Wasserstein distances, geodesics and barycenters of merge trees. IEEE Transactions on Visualization and Computer Graphics, 28(1):291–301, 2022. doi:10.1109/TVCG.2021.3114839.
  • [12] G. Rote. Lexicographic Fréchet matchings. In Proc. 30th European Workshop on Computational Geometry (EuroCG’14), 2014. doi:10.17169/refubium-19845.
  • [13] R. Sridharamurthy, T. B. Masood, A. Kamakshidasan, and V. Natarajan. Edit distance between merge trees. IEEE Transactions on Visualization and Computer Graphics, 26(3):1518–1531, 2020. doi:10.1109/TVCG.2018.2873612.
  • [14] R. Sridharamurthy and V. Natarajan. Comparative analysis of merge trees using local tree edit distance. IEEE Transactions on Visualization and Computer Graphics, 29(2):1518–1530, 2021. doi:10.1109/TVCG.2021.3122176.
  • [15] E.F. Touli and Y. Wang. FPT-algorithms for computing the Gromov-Hausdorff and interleaving distances between trees. Journal of Computational Geometry, 13:89–124, 2022. doi:10.20382/jocg.v13i1a4.
  • [16] L. Yan, T. B. Masood, F. Rasheed, I. Hotz, and B. Wang. Geometry aware merge tree comparisons for time-varying data with interleaving distances. IEEE Transactions on Visualization and Computer Graphics, 29(8):3489–3506, 2022. doi:10.1109/TVCG.2022.3163349.
  • [17] L. Yan, T. B. Masood, R. Sridharamurthy, F. Rasheed, V. Natarajan, I. Hotz, and B. Wang. Scalar field comparison with topological descriptors: Properties and applications for scientific visualization. Computer Graphics Forum, 40(3):599–633, 2021. doi:10.1111/cgf.14331.
  • [18] L. Yan, Y. Wang, E. Munch, E. Gasparovich, and B. Wang. A structural average of labeled merge trees for uncertainty visualisation. IEEE Transactions on Visualization and Computer Graphics, 26(1):832–842, 2020. doi:10.1109/TVCG.2019.2934242.