Streaming Algorithms For Computing Edit Distance Without Exploiting Suffix Trees

Diptarka Chakraborty, Elazar Goldenberg, Michal KouckýarXiv 2016

Abstract

Computing the edit distance between two strings is a fundamental task in bioinformatics and text processing. While classic algorithms require $O(n^2)$ time, many applications involve strings with a small distance $k \ll n$. Existing $O(n+k^2)$ algorithms often rely on complex suffix tree structures that are difficult to implement and memory-intensive. This paper introduces two streaming algorithms that operate in $O(k)$ space. The primary contribution is an $O(n+k^3)$ time algorithm that avoids suffix trees entirely by exploiting string periodicity, making it highly practical and alphabet-independent.

Introduction

The edit distance (Levenshtein distance) measures the minimum number of edits (insertions, deletions, substitutions) required to transform one string into another. In the context of massive datasets, such as genomic sequences, the standard $O(n^2)$ dynamic programming approach is computationally prohibitive.

Graph representation of the edit distance problem between two strings.

The problem is often modeled as finding the shortest path in a grid graph, as shown in Figure 1. When the distance $k$ is small, we can optimize the search. However, previous optimizations like the Landau-Vishkin algorithm require suffix trees, which have large hidden constants and high memory overhead.

Methods

The authors propose two distinct streaming algorithms designed to process input in a single pass with limited memory.

1. Block-Wise Suffix Tree Approach

This method adapts the Landau-Vishkin algorithm to a streaming setting. By partitioning strings into overlapping blocks of size $O(k)$ and constructing suffix trees only for these local segments, the algorithm achieves $O(n \cdot \min\{\log k, \log |\Sigma|\} + k^2)$ time while maintaining $O(k)$ space.

2. Periodicity-Exploiting Approach

This is the paper's main contribution. It avoids suffix trees by using direct character comparisons. To maintain efficiency, it identifies "mature" diagonals—alignments that have matched for a significant duration. The algorithm recognizes that long matches imply periodicity in the underlying strings. By leveraging this mathematical property, the algorithm can "zip" through periodic sections, reducing the number of active comparisons needed.

Comparative Analysis

The proposed algorithms significantly improve upon the state-of-the-art for streaming environments, particularly in terms of space complexity and implementation simplicity.

Comparison of time and space complexities for edit distance algorithms.

As summarized in Figure 2, while the $O(n+k^3)$ algorithm is theoretically slower than the $O(n+k^2)$ offline limit, its independence from alphabet size and lack of complex data structures make it highly attractive for practical implementations.

Key Insights

  • Streaming Feasibility: The authors demonstrate that the traditional "wave-front" edit distance calculation can be restructured into a "row-by-row" streaming process.
  • Periodicity as an Optimizer: The core innovation is using string periodicity to bypass the need for suffix trees. If multiple alignments persist, the strings must repeat, allowing for mathematical shortcuts.
  • Alphabet Independence: Unlike suffix-tree-based methods, the $O(n+k^3)$ algorithm's performance is unaffected by the size of the alphabet $\Sigma$.

Conclusion

This work bridges the gap between theoretical complexity and practical streaming requirements. By providing an $O(n+k^3)$ algorithm that is easy to implement and memory-efficient, the authors offer a robust tool for real-time sequence alignment where $k$ is small. Future research may explore extending the "mature diagonal" concept to further reduce the $k^3$ factor toward the $k^2$ theoretical bound without reintroducing suffix trees.

Summary updated

BibTeX
@misc{chakraborty2016streaming,
  author = {Diptarka Chakraborty and Elazar Goldenberg and Michal Koucký},
  title = {{Streaming Algorithms For Computing Edit Distance Without Exploiting Suffix Trees}},
  year = {2016},
  eprint = {1607.03718},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1607.03718},
}
Figure