Streaming and Small Space Approximation Algorithms for Edit Distance and Longest Common Subsequence

Kuan Cheng, Alireza Farhadi, MohammadTaghi Hajiaghayi, Zhengzhong Jin, Xin Li, Aviad Rubinstein, Saeed Seddighin, Yu ZhengICALP 2021

TL;DR

This paper introduces novel, deterministic algorithms for approximating Edit Distance (ED) and Longest Common Subsequence (LCS) in both streaming and non-streaming settings. The key breakthrough is achieving significantly improved space complexity, particularly in the non-streaming case where algorithms use poly-logarithmic space, a substantial improvement over prior Ω(√n) bounds.

What Problem Does This Paper Address?

Edit Distance (ED) and Longest Common Subsequence (LCS) are fundamental problems in computer science, crucial for measuring string similarity across various domains like bioinformatics and text processing. Traditional dynamic programming solutions for these problems require quadratic time and linear space, which can be prohibitive for very long strings. While much research has focused on improving time complexity, achieving small space complexity, especially in streaming scenarios where memory is limited, has remained a significant challenge. This paper tackles the problem of designing efficient algorithms for ED and LCS that use substantially less memory, particularly in the asymmetric streaming model (where one string is accessible randomly and the other is streamed) and in the non-streaming setting.

Methods

The authors employ a combination of techniques, including:

  • Asymmetric Streaming Model: They leverage the ability to randomly access one string while streaming the other.
  • Recursive Algorithms: Many of their algorithms are built upon recursive structures, breaking down problems into smaller subproblems.
  • Triangle Inequality: This fundamental property of distance metrics is used to relate approximations of subproblems to approximations of the overall problem.
  • "Closest Substring" Problem: For streaming ED, they introduce and solve an approximate version of finding a substring in the offline string that is closest to the online string.
  • Patience Sorting and LIS Algorithms: For Longest Increasing Subsequence (LIS), they adapt and modify existing streaming algorithms, particularly those based on Patience Sorting, to achieve better space complexity.
  • Reduction Techniques: They show how to reduce ED to deletion distance and LCS to LIS, allowing them to leverage existing or newly developed algorithms for these related problems.
  • Bounded Recursion and Candidate Sets: For non-streaming problems, they use recursive calls with bounded inputs and carefully constructed "candidate sets" of intervals to manage space.

Datasets

Not discussed in the paper. The algorithms are designed for general strings and do not rely on specific datasets for evaluation.

Key Insights and Ideas

  • Sublinear Space for Streaming ED/LCS is Achievable: The paper demonstrates that it's possible to achieve constant-factor approximations for ED and (1±ε)-approximations for ED/LCS in the asymmetric streaming model using significantly less than linear space (e.g., O(√n) or even O(n^δ)). This is a notable improvement over previous results that often required more space or had limitations.
  • Poly-logarithmic Space for Non-Streaming ED/LCS is a Breakthrough: The most striking result is achieving poly-logarithmic space complexity for approximating ED, LCS, and LIS in the non-streaming setting. This is a massive leap from the Ω(√n) lower bounds that were previously known, opening up possibilities for processing much larger strings with limited memory.
  • Novel Use of Recursion and Triangle Inequality: The authors' algorithms cleverly combine recursive decomposition with the triangle inequality to manage space. By approximating subproblems and combining these approximations, they avoid the need for large, exact computations.
  • Connecting ED/LCS to LIS and Deletion Distance: The paper effectively uses reductions to related problems (LIS, deletion distance) to leverage existing algorithmic tools and extend their applicability to ED and LCS with improved space bounds.

Key Results

  • Asymmetric Streaming:
    • A deterministic O(2<sup>1/δ</sup>)-approximation for ED using Õ(n<sup>δ</sup>) space (Theorem 1).
  • A deterministic (1-ε)-approximation for LCS and (1+ε)-approximation for ED using Õ(√n) space (Theorem 2).
  • Non-Streaming (Small Space):
    • A deterministic (1+ε)-approximation for ED using Õ<sub>ε,δ</sub>(n<sup>δ</sup>) space and Õ<sub>ε,δ</sub>(n<sup>2</sup>) time (Theorem 3.1).
  • A deterministic (1+O(log log n))-approximation for ED using O(log<sup>2</sup> n) space and n<sup>7+o(1)</sup> time (Theorem 3.2).
  • A deterministic (1-ε)-approximation for LCS using Õ<sub>ε,δ</sub>(n<sup>δ</sup>) space and Õ<sub>ε,δ</sub>(n<sup>3-δ</sup>) time (Theorem 4.1).
  • A deterministic (1-O(log log n))-approximation for LCS using O(log<sup>2</sup> log n) space and n<sup>6+o(1)</sup> time (Theorem 4.2).
  • Similar results for LIS (Theorem 5).
  • Streaming ED (Improved Runtime): Techniques from small-space non-streaming algorithms are used to reduce the runtime of streaming ED algorithms to Õ(n<sup>δ</sup>) while maintaining Õ(n<sup>δ</sup>) space (Section 5.2).
  • Streaming LCS: A single-pass deterministic (1-ε)-approximation for LCS using Õ(√n/ε) memory and polynomial time (Theorem 13).

Limitations and Future Work

  • Approximation Ratios: While the paper achieves significant space improvements, the approximation ratios for some results are constant factors (e.g., O(2<sup>1/δ</sup>) for streaming ED) or involve logarithmic terms in the non-streaming case. Further work could aim for tighter approximations.
  • Time Complexity: In some cases, the time complexity remains polynomial, and further improvements in runtime while maintaining small space are an ongoing area of research.
  • Generalization: The paper focuses on ED, LCS, and LIS. Extending these techniques to other string similarity problems or more general sequence alignment problems could be a future direction.
  • Randomized vs. Deterministic: The paper emphasizes deterministic algorithms. Exploring randomized algorithms might offer different trade-offs between space, time, and approximation guarantees.

Summary updated

BibTeX
@inproceedings{cheng2021streaming,
  author = {Kuan Cheng and Alireza Farhadi and MohammadTaghi Hajiaghayi and Zhengzhong Jin and Xin Li and Aviad Rubinstein and Saeed Seddighin and Yu Zheng},
  title = {{Streaming and Small Space Approximation Algorithms for Edit Distance and Longest Common Subsequence}},
  booktitle = {ICALP},
  year = {2021},
  url = {https://openreview.net/forum?id=VrzOgSwHVeI},
}

Loading related content...

Figure