[Paper Review] An Algorithmic Bridge Between Hamming and Levenshtein Distances
This paper introduces EDa, a parameterized edit distance where substitutions cost 1/a and indels cost 1, bridging Hamming distance (a→∞) and standard edit distance (a=1). It presents a randomized (1+ϵ)-approximation algorithm for EDa running in Õ(n/a + ak³) time, which is sublinear in n when a is large and k is small, and extends this to a (1,1+ϵ)-bicriteria approximation for (kI,kS)-alignment with similar sublinear performance, offering a significant speedup over unit-cost edit distance in real-world scenarios with many substitutions and few indels.
The edit distance between strings classically assigns unit cost to every character insertion, deletion, and substitution, whereas the Hamming distance only allows substitutions. In many real-life scenarios, insertions and deletions (abbreviated indels) appear frequently but significantly less so than substitutions. To model this, we consider substitutions being cheaper than indels, with cost $1/a$ for a parameter $a\ge 1$. This basic variant, denoted $ED_a$, bridges classical edit distance ($a=1$) with Hamming distance ($a o\infty$), leading to interesting algorithmic challenges: Does the time complexity of computing $ED_a$ interpolate between that of Hamming distance (linear time) and edit distance (quadratic time)? What about approximating $ED_a$? We first present a simple deterministic exact algorithm for $ED_a$ and further prove that it is near-optimal assuming the Orthogonal Vectors Conjecture. Our main result is a randomized algorithm computing a $(1+ε)$-approximation of $ED_a(X,Y)$, given strings $X,Y$ of total length $n$ and a bound $k\ge ED_a(X,Y)$. For simplicity, let us focus on $k\ge 1$ and a constant $ε> 0$; then, our algorithm takes $ ilde{O}(n/a + ak^3)$ time. Unless $a= ilde{O}(1)$ and for small enough $k$, this running time is sublinear in $n$. We also consider a very natural version that asks to find a $(k_I, k_S)$-alignment -- an alignment with at most $k_I$ indels and $k_S$ substitutions. In this setting, we give an exact algorithm and, more importantly, an $ ilde{O}(nk_I/k_S + k_S\cdot k_I^3)$-time $(1,1+ε)$-bicriteria approximation algorithm. The latter solution is based on the techniques we develop for $ED_a$ for $a=Θ(k_S / k_I)$. These bounds are in stark contrast to unit-cost edit distance, where state-of-the-art algorithms are far from achieving $(1+ε)$-approximation in sublinear time, even for a favorable choice of $k$.
Motivation & Objective
- To address the algorithmic gap between Hamming distance (linear time) and edit distance (quadratic time) by introducing a cost-bridging model where substitutions are cheaper than indels.
- To investigate whether the time complexity of computing EDa interpolates smoothly between linear and quadratic time as the cost parameter a increases.
- To design efficient approximation algorithms for EDa and the (kI,kS)-alignment problem, especially in sublinear time when the distance is small and a is large.
- To provide theoretical justification for the efficiency of heuristic string comparison methods in real-world applications where substitutions dominate.
Proposed method
- Introduces EDa, a variant of edit distance where substitutions cost 1/a and indels cost 1, parameterized by a ≥ 1.
- Develops a deterministic exact algorithm for EDa and proves its near-optimality under the Orthogonal Vectors Conjecture.
- Proposes a randomized (1+ϵ)-approximation algorithm for EDa that runs in Õ(n/a + ak³) time, leveraging Longest Common Extension (LCE) queries with error tolerance.
- Adapts the algorithm to the (kI,kS)-alignment problem, achieving a (1,1+ϵ)-bicriteria approximation in Õ(nkI/kS + kSk³I) time by tuning a = Θ(kS/kI).
- Uses a layered dynamic programming approach with sampling over substitution counts and LCE-based validation to reduce query overhead.
- Employs LCEd,ϵ queries to estimate common substrings with bounded error, enabling sublinear-time approximation under controlled accuracy.
Experimental results
Research questions
- RQ1Does the time complexity of computing EDa interpolate between linear time (Hamming) and quadratic time (edit distance) as the cost parameter a increases from 1 to ∞?
- RQ2Can a (1+ϵ)-approximation of EDa be computed in sublinear time when a is large and the edit distance is small?
- RQ3Is it possible to achieve a (1,1+ϵ)-bicriteria approximation for the (kI,kS)-alignment problem—where indels and substitutions are bounded—running in sublinear time?
- RQ4How does the performance of the proposed algorithm compare to existing sublinear-time algorithms for unit-cost edit distance in realistic settings with sparse indels and dense substitutions?
- RQ5What is the theoretical limit of sublinear-time approximation for weighted edit distance under the Orthogonal Vectors Conjecture?
Key findings
- The proposed (1+ϵ)-approximation algorithm for EDa runs in Õ(n/a + ak³) time, which is sublinear in n when a ≫ 1 and k is small.
- For the (kI,kS)-alignment problem, the algorithm achieves a (1,1+ϵ)-bicriteria approximation in Õ(nkI/kS + kSk³I) time, again sublinear when kI ≪ kS.
- The algorithm's running time is significantly faster than state-of-the-art sublinear algorithms for unit-cost edit distance, which only achieve polylogarithmic or polynomial approximation ratios.
- The algorithm is correct with high probability and relies on LCEd,ϵ queries with bounded error to validate alignment candidates efficiently.
- The running time is near-optimal under the Orthogonal Vectors Conjecture, suggesting that further improvements would break widely believed complexity assumptions.
- The method provides a theoretical explanation for the empirical speed of string comparison heuristics in domains like computational biology, where substitutions dominate.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.