Lune

FOCS2023顶会

Optimal Algorithms for Bounded Weighted Edit Distance

Alejandro Cassis, Tomasz Kociumaka, Philip Wellnitz

摘要

The edit distance (also known as Levenshtein distance) of two strings is the minimum number of insertions, deletions, and substitutions of characters needed to transform one string into the other. The textbook dynamic-programming algorithm computes the edit distance of two length- n strings in O(n2)\mathcal{O}\left(n^{2}\right) time, which is optimal up to subpolynomial factors assuming the Strong Exponential Time Hypothesis (SETH). An established way of circumventing this hardness is to consider the bounded setting, where the running time is parameterized by the edit distance k. A celebrated algorithm by Landau and Vishkin (JCSS’88) achieves a running time of O(n+k2)\mathcal{O}\left(n+k^{2}\right), which is optimal as a function of n and k (again, up to subpolynmial factors and assuming SETH).While the theory community thoroughly studied the Levenshtein distance, most practical applications rely on a more general weighted edit distance, where each edit has a weight depending on its type and the involved characters from the alphabet Σ\Sigma. This is formalized through a weight function w:Σ∪{ε}×Σ∪{ε}→Rw: \Sigma \cup\{\varepsilon\} \times \Sigma \cup\{\varepsilon\} \rightarrow \mathbb{R} normalized so that w(a↦a)=0w(a \mapsto a)=0 for a∈Σ∪{ε}a \in \Sigma \cup\{\varepsilon\} and w(a↦b)≥1w(a \mapsto b) \geq 1 for a,b∈Σ∪{ε}a, b \in \Sigma \cup\{\varepsilon\} with a≠ba \neq b; the goal is to find an alignment of the two strings minimizing the total weight of edits. The classic O(n2)\mathcal{O}\left(n^{2}\right)-time algorithm supports this setting seamlessly, but for many decades just a straightforward O(nk)\mathcal{O}(n k)-time solution was known for the bounded version of the weighted edit distance problem. Only very recently, Das, Gilbert, Hajiaghayi, Kociumaka, and Saha (STOC’23) gave the first non-trivial algorithm, achieving a time complexity of O(n+k5)\mathcal{O}\left(n+k^{5}\right). While this running time is linear for k≤n1/5k \leq n^{1 / 5}, it is still very far from O(n+k2)\mathcal{O}\left(n+k^{2}\right)-the bound achievable in the unweighted setting. This is unsatisfactory, especially given the lack of any compelling evidence that the weighted version is inherently harder.In this paper, we essentially close this gap by showing both an improved O~(n+nk3)\widetilde{\mathcal{O}}\left(n+\sqrt{n k^{3}}\right)-time algorithm and, more surprisingly, a matching lower bound: Conditioned on the All-Pairs Shortest Paths (APSP) hypothesis, the running time of our solution is optimal for n≤k≤n\sqrt{n} \leq k \leq n (up to subpolynomial factors). In particular, this is the first separation between the complexity of the weighted and unweighted edit distance problems.Just like the Landau-Vishkin algorithm, our algorithm can be adapted to a wide variety of settings, such as when the input is given in a compressed representation. This is because, independently of the string length n, our procedure takes O~(k3)\widetilde{\mathcal{O}}\left(k^{3}\right) time assuming that the equality of any two substrings can be tested in O~(1)\widetilde{\mathcal{O}}(1) time.Consistently with the previous work, our algorithm relies on the observation that strings with a rich structure of low-weight alignments must contain highly repetitive substrings. Nevertheless, achieving the optimal running time requires multiple new insights. We capture the right notion of repetitiveness using a tailor-made compressibility measure that we call self-edit distance. Our divide-and-conquer algorithm reduces the computation of weighted edit distance to several subproblems involving substrings of small self-edit distance and, at the same time, distributes the budget for edit weights among these subproblems. We then exploit the repetitive structure of the underlying substrings using state-of-the-art results for multiple-source shortest paths in planar graphs (Klein, SODA’05).As a stepping stone for our conditional lower bound, we study a dynamic problem of maintaining two strings subject to updates (substitutions of characters) and weighted edit distance queries. We significantly extend the construction of Abboud and Dahlgaard (FOCS’16), originally for dynamic shortest paths in planar graphs, to show that a sequence of n updates and q≤nq \leq n queries cannot be handled much faster than in O(n2q)\mathcal{O}\left(n^{2} \sqrt{q}\right) time. We then compose the snapshots of the dynamic strings to derive hardness of the static problem in the bounded setting.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Gap Edit Distance via Non-Adaptive Queries: Simple and Optimal 引用了 Sublinear-Time Algorithms for Computing & Embedding Gap Edit Distance
  • Gap Edit Distance via Non-Adaptive Queries: Simple and Optimal 引用了 Does preprocessing help in fast sequence comparisons?
  • Sublinear-Time Algorithms for Computing & Embedding Gap Edit Distance 引用了 Does preprocessing help in fast sequence comparisons?
  • Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization 引用了 Small-space and streaming pattern matching with k edits
  • Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization 引用了 Sublinear-Time Algorithms for Computing & Embedding Gap Edit Distance
  • Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization 引用了 Does preprocessing help in fast sequence comparisons?
  • Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization 引用了 How Compression and Approximation Affect Efficiency in String Distance Measures
  • Faster Weighted and Unweighted Tree Edit Distance and APSP Equivalence 引用了 Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization
  • How Compression and Approximation Affect Efficiency in String Distance Measures 引用了 Does preprocessing help in fast sequence comparisons?
  • Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic Time 引用了 Gap Edit Distance via Non-Adaptive Queries: Simple and Optimal
  • Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic Time 引用了 Small-space and streaming pattern matching with k edits
  • Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic Time 引用了 Sublinear-Time Algorithms for Computing & Embedding Gap Edit Distance
  • Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic Time 引用了 Does preprocessing help in fast sequence comparisons?
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper9

  1. Dynamic Dynamic Time WarpingKarl Bringmann, Nick Fischer, Ivor van der Hoog, Evangelos Kipouridis 等SODA 2024 · 21 次引用
  2. Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv FactorizationDaniel Gibney, Ce Jin, Tomasz Kociumaka, Sharma V. ThankachanSODA 2024 · 7 次引用
  3. Faster Weighted and Unweighted Tree Edit Distance and APSP EquivalenceJakob Nogler, Adam Polak, Barna Saha, Virginia Vassilevska Williams 等STOC 2025 · 4 次引用
  4. Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic TimeXiao Mao, Aviad RubinsteinSTOC 2026 · 4 次引用
  5. Pattern Matching under Weighted Edit DistancePanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2025 · 3 次引用

它引用的 Paper9

  1. Does preprocessing help in fast sequence comparisons?Elazar Goldenberg, Aviad Rubinstein, Barna SahaSTOC 2020 · 15 次引用
  2. Small-space and streaming pattern matching with kk editsTomasz Kociumaka, Ely Porat, Tatiana StarikovskayaFOCS 2021 · 13 次引用
  3. Sublinear-Time Algorithms for Computing & Embedding Gap Edit DistanceTomasz Kociumaka, Barna SahaFOCS 2020 · 9 次引用
  4. How Compression and Approximation Affect Efficiency in String Distance MeasuresArun Ganesh, Tomasz Kociumaka, Andrea Lincoln, Barna SahaSODA 2022 · 7 次引用
  5. Gap Edit Distance via Non-Adaptive Queries: Simple and OptimalElazar Goldenberg, Tomasz Kociumaka, Robert Krauthgamer, Barna SahaFOCS 2022 · 5 次引用

相关 Paper

  1. Bounded Edit Distance: Optimal Static and Dynamic Algorithms for Small Integer WeightsEgor Gorbachev, Tomasz KociumakaSTOC 2025 · 1 次引用
  2. Weighted Edit Distance Computation: Strings, Trees, and DyckDebarati Das, Jacob Gilbert, MohammadTaghi Hajiaghayi, Tomasz Kociumaka 等STOC 2023 · 4 次引用
  3. Almost-optimal sublinear-time edit distance in the low distance regimeKarl Bringmann, Alejandro Cassis, Nick Fischer, Vasileios NakosSTOC 2022 · 4 次引用
  4. Approximating Edit Distance in the Fully Dynamic ModelTomasz Kociumaka, Anish Mukherjee, Barna SahaFOCS 2023 · 1 次引用
  5. Faster Sublinear-Time Edit DistanceKarl Bringmann, Alejandro Cassis, Nick Fischer, Tomasz KociumakaSODA 2024 · 3 次引用
黄昏的海面,两侧是细线勾勒的悬崖