Gapped Indexing for Consecutive Occurrences

Philip Bille, Inge Li Gørtz, Max Rishøj Pedersen, Teresa Anna Steiner · DOI

Abstract

This paper presents a novel data structure for the gapped indexing problem with a consecutive occurrence constraint. Given a text $T$ and two patterns $P_1, P_2$, the goal is to find pairs of occurrences $(i, j)$ such that $P_1$ occurs at $i$, $P_2$ occurs at $j$, the distance $j-i$ falls within a range $[\alpha, \beta]$, and no other occurrences of $P_1$ or $P_2$ exist between $i$ and $j$. We achieve near-optimal query times of $\tilde{O}(n^{2/3})$ using near-linear space, significantly bridging the gap between previous quadratic-space solutions and slow linear-time approaches.

Introduction

Indexing strings for complex queries is a cornerstone of bioinformatics and large-scale text processing. While searching for a single pattern is well-understood, many applications require finding pairs of patterns separated by a specific distance. This is known as gapped indexing. A particularly challenging variant is the "consecutive occurrence" problem, where the search is restricted to pairs $(P_1, P_2)$ that are "neighbors" in the text.

Historically, researchers faced a "space-time chasm." Simple suffix-tree-based methods use $O(n)$ space but suffer from $O(n)$ query times in the worst case due to the need to filter non-consecutive occurrences. Conversely, 2D range searching techniques provide fast queries but require $\Omega(n^2)$ space, which is prohibitive for genomic-scale data.

Methodology

The proposed solution leverages the structural properties of suffix trees through two primary decompositions.

Cluster Decomposition for Existence and Counting

For existence and counting queries, the authors employ a cluster decomposition of the suffix tree. The strategy differs based on the gap size:

  • Large Gaps ($>\tau$): For gaps exceeding a threshold $\tau$, the consecutive constraint limits the number of potential pairs. These are identified by segmenting the text and applying orthogonal range successor queries.
  • Small Gaps ($\le\tau$): For smaller gaps, the algorithm precomputes answers for boundary nodes within tree clusters. This allows the query to skip redundant internal nodes and achieve sublinear time.

Induced Suffix Tree Decomposition for Reporting

To efficiently list all occurrences, the authors introduce the Induced Suffix Tree Decomposition. This recursive structure represents the suffix tree of a text as a hierarchy of smaller trees.

Figure 3: (a) Induced Suffix Tree Decomposition mapping subtrees to the suffix array (SA). (b) Cluster-based approach showing paths $P_1, P_2$ and boundary nodes $b_1, b_2$ for consecutive occurrences.

As shown in Figure 3(a), subtrees branching off the main paths $P_1$ and $P_2$ are mapped to intervals in the suffix array. By traversing this hierarchy, the algorithm can "zoom in" on valid consecutive pairs. Figure 3(b) illustrates how the consecutive constraint is handled within clusters, ensuring that no intermediate occurrences of $i$ or $j'$ disrupt the pair $(i, j')$.

Complexity and Lower Bounds

A key contribution of this work is the establishment of a conditional lower bound. By reducing the Set Disjointness problem to gapped indexing, the authors prove that any data structure using near-linear space must have a query time of at least $\Omega(\sqrt{n})$, assuming the Strong SetDisjointness Conjecture.

The current upper bounds achieved are:

  • Existence/Counting: $O(n)$ space and $\tilde{O}(|P_1| + |P_2| + n^{2/3})$ query time.
  • Reporting: $O(n \log n)$ space and $\tilde{O}(|P_1| + |P_2| + n^{2/3} \cdot occ^{1/3})$ query time.

Conclusion

This research provides the first near-linear space data structure for consecutive gapped indexing with sublinear query time. While a gap remains between the $O(n^{2/3})$ upper bound and the $\Omega(n^{1/2})$ lower bound, this work sets a new standard for efficiency in complex string matching. Future work may focus on closing this theoretical gap or extending these techniques to non-consecutive gapped queries.

Summary updated

BibTeX
@article{bille2023gapped,
  author = {Philip Bille and Inge Li Gørtz and Max Rishøj Pedersen and Teresa Anna Steiner},
  title = {{Gapped Indexing for Consecutive Occurrences}},
  journal = {Algorithmica},
  year = {2023},
  doi = {10.1007/s00453-022-01051-6},
}
Figure