Lune

STOC2025Top-tier venue

Faster Weighted and Unweighted Tree Edit Distance and APSP Equivalence

Jakob Nogler, Adam Polak, Barna Saha, Virginia Vassilevska Williams, Yinzhan Xu, Christopher Ye

Abstract

The tree edit distance (TED) between two rooted ordered trees with 𝑛 nodes labeled from an alphabet Σ is the minimum cost of transforming one tree into the other by a sequence of valid operations consisting of insertions, deletions and relabeling of nodes. The tree edit distance is a well-known generalization of string edit distance and has been studied since the 1970s. Its running time has seen steady improvements starting with an 𝒪(𝑛 6 ) algorithm [Tai, J.ACM 1979], improved to 𝒪(𝑛 4 ) [Shasha, Zhang, SICOMP 1989] and to 𝒪(𝑛 3 log 𝑛) [Klein, ESA 1998], and culminating in an 𝒪(𝑛 3 ) algorithm [Demaine, Mozes, Rossman, Weimann, ACM TALG 2010]. The latter is known to be optimal for any dynamic programming based algorithm that falls under a certain decomposition framework that captures all known sub-𝑛 4 time algorithms. Fine-grained complexity casts further light onto this hardness showing that a truly subcubic time algorithm for TED implies a truly subcubic time algorithm for All-Pairs Shortest Paths (APSP) [Bringmann, Gawrychowski, Mozes, Weimann, ACM TALG 2020]. Therefore, under the popular APSP hypothesis, a truly subcubic time algorithm for TED cannot exist. However, unlike many problems in fine-grained complexity for which conditional hardness based on APSP also comes with equivalence to APSP, whether TED can be reduced to APSP has remained unknown. In this paper, we resolve this. Not only we show that TED is fine-grained equivalent to APSP, our reduction is tight enough, so that combined with the fastest APSP algorithm to-date [Williams, SICOMP 2018] it gives the first ever subcubic time algorithm for TED running in 𝑛 3 /2 Ω( √ log 𝑛) time. We also consider the unweighted tree edit distance problem in which the cost of each edit (insertion, deletion, and relabeling) is one. For unweighted TED, a truly subcubic algorithm is known due to Mao [Mao, FOCS 2022], and later improved slightly by D ürr [D ürr, IPL 2023] to run in 𝒪(𝑛 2.9148 ) time. Since their algorithm uses bounded monotone min-plus product as a crucial subroutine, and the best running time for this product is Õ(𝑛 3+𝜔 2 ) ≤ 𝒪(𝑛 2.6857 ) (where 𝜔 is the exponent of fast matrix multiplication), the much higher running time of unweighted TED remained unsatisfactory. In this work, we close this gap and give an algorithm for unweighted TED that runs in Õ(𝑛 3+𝜔 2 ) time.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Dynamic Dyck and Tree Edit Distance: Decompositions and Reductions to String Edit Distance cites Truly Subcubic Min-Plus Product for Less Structured Matrices, with Applications
  • Dynamic Dyck and Tree Edit Distance: Decompositions and Reductions to String Edit Distance cites More Asymmetry Yields Faster Matrix Multiplication
  • Dynamic Dyck and Tree Edit Distance: Decompositions and Reductions to String Edit Distance cites Breaking the Cubic Barrier for (Unweighted) Tree Edit Distance
  • Breaking the Cubic Barrier for (Unweighted) Tree Edit Distance cites Truly Subcubic Min-Plus Product for Less Structured Matrices, with Applications
  • Universe Reduction for APSP: Equivalence of Three Fine-Grained Hypotheses cites Truly Subcubic Min-Plus Product for Less Structured Matrices, with Applications
  • Universe Reduction for APSP: Equivalence of Three Fine-Grained Hypotheses cites More Asymmetry Yields Faster Matrix Multiplication
  • Universe Reduction for APSP: Equivalence of Three Fine-Grained Hypotheses cites Breaking the Cubic Barrier for (Unweighted) Tree Edit Distance
  • Universe Reduction for APSP: Equivalence of Three Fine-Grained Hypotheses cites Faster min-plus product for monotone instances
  • Faster min-plus product for monotone instances cites Breaking the Cubic Barrier for (Unweighted) Tree Edit Distance
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Universe Reduction for APSP: Equivalence of Three Fine-Grained HypothesesNick FischerSTOC 2026 · 2 citations
  2. Dynamic Dyck and Tree Edit Distance: Decompositions and Reductions to String Edit DistanceDebarati Das, Jacob Gilbert, MohammadTaghi Hajiaghayi, Tomasz Kociumaka et al.FOCS 2025 · 1 citation

Builds on12

  1. More Asymmetry Yields Faster Matrix MultiplicationJosh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu et al.SODA 2025 · 35 citations
  2. Truly Subcubic Min-Plus Product for Less Structured Matrices, with ApplicationsVirginia Vassilevska Williams, Yinzhan XuSODA 2020 · 19 citations
  3. Faster min-plus product for monotone instancesShucheng Chi, Ran Duan, Tianle Xie, Tianyi ZhangSTOC 2022 · 12 citations
  4. Breaking the Cubic Barrier for (Unweighted) Tree Edit DistanceXiao MaoFOCS 2021 · 7 citations
  5. Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv FactorizationDaniel Gibney, Ce Jin, Tomasz Kociumaka, Sharma V. ThankachanSODA 2024 · 7 citations

Related papers

  1. Õ(n+poly(k))-time Algorithm for Bounded Tree Edit DistanceDebarati Das, Jacob Gilbert, MohammadTaghi Hajiaghayi, Tomasz Kociumaka et al.FOCS 2022 · 5 citations
  2. Weighted Edit Distance Computation: Strings, Trees, and DyckDebarati Das, Jacob Gilbert, MohammadTaghi Hajiaghayi, Tomasz Kociumaka et al.STOC 2023 · 4 citations
  3. Optimal Algorithms for Bounded Weighted Edit DistanceAlejandro Cassis, Tomasz Kociumaka, Philip WellnitzFOCS 2023 · 4 citations
  4. Approximating Edit Distance in the Fully Dynamic ModelTomasz Kociumaka, Anish Mukherjee, Barna SahaFOCS 2023 · 1 citation
  5. Bounded Edit Distance: Optimal Static and Dynamic Algorithms for Small Integer WeightsEgor Gorbachev, Tomasz KociumakaSTOC 2025 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines