Compressed Indexing for Consecutive Occurrences

Pawel Gawrychowski, Garance Gourdel, Tatiana Starikovskaya, Teresa Anna Steiner

Introduction

In the field of string processing, the fundamental task of indexing involves preprocessing a text $T$ to facilitate rapid searches for a pattern $P$. While standard indexing techniques are well-matured, modern applications in bioinformatics and large-scale text mining often demand more sophisticated queries. One such challenge is the gapped consecutive occurrence problem.

Given two patterns, $P_1$ and $P_2$, and a distance range $[a, b]$, the goal is to identify all pairs of occurrences $(q_1, q_2)$ such that $P_2$ begins between $a$ and $b$ characters after the start of $P_1$. Crucially, these occurrences must be "consecutive," meaning no other instances of $P_1$ or $P_2$ appear in the text between them.

The Theoretical Barrier

Previous algorithmic research established a significant "conditional lower bound" for this problem. For a text of length $N$, any index of reasonable size (polynomial in $N$) is expected to require at least $\Omega(\sqrt{N})$ time to process such a query. In the era of massive datasets, where $N$ can reach billions, a square-root dependency is computationally prohibitive.

This paper investigates whether this "speed limit" can be bypassed by exploiting the internal structure of the text. Specifically, the authors ask: If a text is highly repetitive and thus highly compressible, can we achieve query times that depend on the compressed size rather than the raw length?

Methodology: Leveraging Straight-Line Programs

The authors utilize Straight-Line Programs (SLPs) as their primary model for compression. An SLP is a context-free grammar in Chomsky Normal Form that generates exactly one string. This model is particularly effective for repetitive data, as it can represent a string of exponential length using a linear number of production rules.

To handle the complexities of consecutive occurrences within this compressed framework, the authors employ several advanced techniques:

  • Run-Length SLPs (RLSLPs): The input grammar is transformed into a balanced version capable of handling long periodic repetitions (e.g., "aaaaa...") efficiently.
  • Heavy Path Decomposition: By applying this technique to the compact tries storing prefixes and suffixes of the grammar's rules, the authors enable logarithmic-time navigation of the grammar's derivation tree.
  • 2D Orthogonal Range Emptiness: The problem of finding pattern matches that "straddle" the split points of grammar rules is mapped into a geometric space. Potential matches are represented as points in a 2D plane, and the search for consecutive pairs becomes a query for empty regions between these points.

Addressing the "Consecutive" Constraint

The most difficult aspect of the problem is ensuring that no other matches exist between $P_1$ and $P_2$. In an uncompressed text, this is a linear check; in a compressed representation, it requires sophisticated combinatorial analysis.

The authors categorize the relative positions of the two patterns into eight distinct subcases based on their geometric and combinatorial properties. They utilize classical string theory, including Fine and Wilf’s theorem, to manage periodic patterns. Periodicity often leads to a "combinatorial explosion" of overlapping matches, which the authors prune by identifying "relevant" occurrences—those that straddle the boundaries of the grammar's rules.

Key Results and Complexity

The paper introduces a data structure that successfully achieves polylogarithmic query times, effectively breaking the $\sqrt{N}$ barrier for compressible strings. For a text of length $N$ and a grammar of size $g$, the index provides:

  • Space Complexity: $O(g^5 \log^5 N)$.
  • Query Time: $O(m \log N + (1 + occ) \cdot \log^4 N \log \log N)$, where $m$ is the pattern length and $occ$ is the number of reported pairs.

For the simpler "close occurrence" variant (where the distance range is unrestricted, $[0, N]$), the authors provide a more optimized structure with a space complexity of $O(g^2 \log^4 N)$.

Discussion and Future Work

While this work represents a major theoretical breakthrough, several challenges remain for practical implementation. The $O(g^5)$ space factor, while polynomial, is quite large for real-world engineering applications. Future research will likely focus on reducing this exponent to make the index more practical.

Additionally, the current primary result is optimized for the range $[0, b]$. Extending these efficiencies to the general range $[a, b]$ where $a > 0$ remains an open problem in the field of compressed indexing. As a purely theoretical contribution, the next logical step for the community is the development of a high-performance implementation to benchmark these structures against real-world repetitive datasets.

Summary updated

BibTeX
@inproceedings{gawrychowski2023compressed,
  author = {Pawel Gawrychowski and Garance Gourdel and Tatiana Starikovskaya and Teresa Anna Steiner},
  title = {{Compressed Indexing for Consecutive Occurrences}},
  booktitle = {CPM},
  year = {2023},
  doi = {10.4230/lipics.cpm.2023.12},
}
Figure