How Compression and Approximation Affect Efficiency in String Distance Measures

Arun Ganesh, Tomasz Kociumaka, Andrea Lincoln, Barna Saha

TL;DR

This paper explores the computational limits and possibilities of calculating string distances (like Edit Distance and Longest Common Subsequence) directly on compressed data. The authors prove that while exact calculations for multiple strings remain hard even with compression, combining compression with approximation (FPTAS) allows for massive speedups, effectively cutting the "curse of dimensionality" in half for multi-sequence alignment.

What Problem Does This Paper Address?

In the era of big data, we often store information in compressed formats (like ZIP or specialized genomic compression). Ideally, we want to analyze this data—for example, by calculating the similarity between two DNA sequences—without decompressing it first. This is known as "computing over compressed data."

For two strings, we already know that compression helps. If the total length is $N$ and the compressed size is $n$, we can find the edit distance in $O(nN)$ time instead of the standard $O(N^2)$. However, many real-world applications (like biology) require aligning multiple ($k$) sequences simultaneously. In these cases, the complexity explodes to $O(N^k)$.

The authors ask:

  1. Does compression allow us to significantly reduce the time for multi-sequence similarity?
  2. If exact answers are too slow, can we achieve sublinear dependency on the string length $N$ by allowing a small margin of error (approximation)?

Methods

The paper focuses on Grammar Compression, specifically Straight-Line Programs (SLPs). This is a mathematically elegant framework that unifies many practical schemes like Lempel-Ziv (LZ77), dictionary methods, and byte-pair encoding.

Lower Bounds

The authors use the Strong Exponential Time Hypothesis (SETH) and the $k$-Orthogonal Vectors ($k$-OV) problem to establish theoretical speed limits. They show that for exact calculations, compression doesn't help as much as one might hope as the number of strings $k$ increases.

Approximation Algorithms (FPTAS)

To bypass these hard limits, they develop Fully Polynomial-Time Approximation Schemes (FPTAS). Their core techniques include:

  • Portal-Respecting Walks: For two strings, they decompose the alignment graph into "boxes" and identify specific "portals" (boundary vertices). By restricting the search to walks that only cross boundaries at these portals, they drastically reduce the search space.
  • Window-Respecting Alignments: For multiple strings, they partition the sequences into windows and use a "sliding pyramid" approach to find near-optimal alignments between these windows across all $k$ strings.

Datasets

As a theoretical computer science paper, this work does not use empirical datasets or training sets. Instead, it provides rigorous mathematical proofs and complexity analyses that apply to any data compressed via SLPs.

Key Insights and Ideas

  • The "Power Couple" of Compression and Approximation: The most striking insight is that compression and approximation are far more effective together than either is alone. While compression alone can't beat the $k$-OV lower bounds, the authors show that allowing a $(1+\epsilon)$ error allows them to "save" roughly $k/2$ dimensions in the time complexity.
  • Discretizing the Alignment Graph: The use of "portals" and "boxes" allows the authors to transform a continuous path-finding problem in a massive graph into a discrete optimization problem over a much smaller set of compressed components.
  • Breaking the Subquadratic Barrier: For two strings, they achieve a running time that is sublinear in $N$ (the original length) as long as the string is sufficiently compressible ($n \ll N^{1/4}$), something previously thought impossible for the Longest Common Subsequence (LCS) problem.

Key Results

  • Lower Bound: They proved that exactly computing the $k$-LCS or median edit distance requires $\Omega((N^{k-1}n)^{1-o(1)})$ time under SETH. This answered a major open question from FOCS'17.
  • Multi-String Speedup: They developed an FPTAS for the median edit distance of $k$ sequences that runs in $\tilde{O}(N^{k/2}n^{k/2})$ time. This is a massive improvement over the $O(N^k)$ exact baseline.
  • Two-String FPTAS: They achieved a running time of $\tilde{O}((nm(N+M))^{2/3} \epsilon^{-1/3})$ for edit distance and LCS between two strings.
  • Exact Two-String Algorithm: They improved the state-of-the-art exact algorithm for edit distance to $O(n\sqrt{ND})$, where $D$ is the edit distance.
  • Hamming and Shift Distances: The authors also provided new, improved bounds for simpler measures like Hamming distance ($O(n\sqrt{N})$) and shift distance.

Limitations and Future Work

  • Constant $k$: The current algorithms assume the number of strings $k$ is a constant. The "hidden" factors in the $O(\cdot)$ notation grow exponentially with $k$, making these specific algorithms less practical for very large sets of sequences.
  • The "Holy Grail" of Edit Distance: The authors point out a remaining gap for two-string edit distance. They suggest a "holy grail" algorithm might exist with a running time of $O(\min(nD, n+D^2))$, which remains an open challenge.
  • Gap in Exact Bounds: While they provided a lower bound of $N^{k-1}n$, the best exact algorithms still run in $O(N^k)$. Closing this gap for $k \ge 3$ is a key area for future research.

Summary updated

BibTeX
@inproceedings{ganesh2022how,
  author = {Arun Ganesh and Tomasz Kociumaka and Andrea Lincoln and Barna Saha},
  title = {{How Compression and Approximation Affect Efficiency in String Distance Measures}},
  booktitle = {SODA},
  year = {2022},
  url = {https://openreview.net/forum?id=tmVJzMyG6v},
}
Figure