Tree Edit Distance: Near-Linear-Time Approximate, Sublinear, and Dynamic
Bingbing Hu, Tomasz Kociumaka, Jakob Nogler, Barna Saha
Abstract
Tree edit distance (TED), the analog of string edit distance (ED) for hierarchical data, is the minimum number of node insertions, deletions, and substitutions transforming one labeled rooted ordered tree into another. We narrow polynomial gaps between TED and ED in near-linear-time approximation, sublinear algorithms, and dynamic algorithms. We give an no(1)-approximation in O(n) time and, for every 0<δ<1, a ( n)O(1/δ)-approximation in O(n1+δ) time. This improves the previous near-linear-time O( n)-approximation [Boroujeni et al., STOC'19] and brings TED to parity with ED in this regime up to polylogarithmic factors. With query access to the balanced-parentheses (Euler-tour) representation of the input trees, we give the first sublinear-time TED algorithm: for every τ∈[1,n], it computes a τno(1)-approximation of 1+ted in O(n/τ) time. For dynamic TED, we give an exact algorithm with amortized update time O(k7) and a (1+)-approximation with amortized update time O(k), where k caps the distance that must be reported. The exact algorithm is the first to beat recomputation in a nontrivial parameter regime. The approximation improves prior dynamic guarantees [Das et al., FOCS'25] and cannot be significantly improved in any parameter regime without a breakthrough for static (1+)-approximation of ED. All results use dynamic programming on a new hierarchical tree decomposition, analogous to partitioning strings into blocks of geometrically decreasing sizes. It combines structural properties previously achieved only in isolation, providing a framework for transferring algorithmic ideas from ED to TED, with additional ingredients addressing the obstacles in each computational setting.
Create a lesson
Related papers
Near-Optimal Parallel M-Matrix Scaling
Chih-Hung Liu, Aaron Sidford, Ta-Wei Tu
Subgraph Counting with Local Node Differential Privacy
Sofya Raskhodnikova, Adam Smith, Connor Wagaman et al.
Per-State Signatures and Mean Time-to-Failure: An Algorithm for Systems With Simultaneous Failures
Guido Lagos, Simón Ávila
Asteroidal Triples and Friends in (Likely Necessary) Matrix Multiplication Time
Jakob Nogler, Agnès Totschnig, Virginia Vassilevska Williams
Parameterized Complexity of Isometric Path Cover: Treewidth and Diameter
Dibyayan Chakraborty, Oscar Defrain, Florent Foucaud et al.
Preprocessed 3SUM: From Reals to Integers
Nick Fischer, Jonas Schmidt