Skip to main content
QUICK REVIEW

[Paper Review] A Faster Grammar-Based Self-Index

Travis Gagie, Paweł Gawrychowski|arXiv (Cornell University)|Sep 19, 2011
Algorithms and Data CompressionComputer Science28 references31 citations
TL;DR

This paper presents a faster grammar-based self-index that supports compressed storage and efficient pattern matching in compressed text. Given a straight-line program (SLP) with $ r $ rules and an LZ77 parse with $ z $ phrases, the index uses $ \mathcal{O}(r + z\log\log n) $ space and answers pattern queries in $ \mathcal{O}(m^2 + \mathrm{occ}\log\log n) $ time, improving over prior bounds in both space and time complexity.

ABSTRACT

To store and search genomic databases efficiently, researchers have recently started building compressed self-indexes based on grammars. In this paper we show how, given a straight-line program with $r$ rules for a string (S [1..n]) whose LZ77 parse consists of $z$ phrases, we can store a self-index for $S$ in $\Oh{r + z \log \log n}$ space such that, given a pattern (P [1..m]), we can list the $\occ$ occurrences of $P$ in $S$ in $\Oh{m^2 + \occ \log \log n}$ time. If the straight-line program is balanced and we accept a small probability of building a faulty index, then we can reduce the $\Oh{m^2}$ term to $\Oh{m \log m}$. All previous self-indexes are larger or slower in the worst case.

Motivation & Objective

  • To design a compressed self-index for highly repetitive strings, such as genomic data, that supports fast pattern matching and text extraction.
  • To reduce the time complexity of pattern matching in grammar-based compressed indexes, especially for long patterns.
  • To achieve better space-time trade-offs by combining SLPs with LZ77 parsing and advanced data structures.
  • To support efficient extraction of substrings and reporting of pattern occurrences in compressed form.
  • To extend the approach to balanced SLPs to further improve query time to $ \mathcal{O}(m\log m + \mathrm{occ}\log\log n) $ with a small failure probability.

Proposed method

  • The index uses a straight-line program (SLP) with $ r $ rules to represent the string $ S $, and augments it with an LZ77 parse of $ z $ phrases to guide pattern matching.
  • It builds two augmented Patricia tries: one for substrings starting at phrase boundaries and one for substrings ending at phrase boundaries, each storing range-reporting information.
  • For short patterns ($ m \leq \log\log z $), it uses one-dimensional range-reporting data structures at the top $ \log\log z $ levels of the Patricia trees to achieve $ \mathcal{O}(m\log m) $ query time.
  • For medium-length patterns ($ \log\log z < m < \log z $), it constructs a separate Patricia tree for substrings crossing phrase boundaries, storing boundary-crossing positions in $ \mathcal{O}(\log\log z) $ bits per leaf.
  • It performs range-emptiness queries using wavelet trees or four-sided range reporting structures to validate candidate pattern occurrences efficiently.
  • For balanced SLPs, it reduces the $ \mathcal{O}(m^2) $ term in query time to $ \mathcal{O}(m\log m) $ by leveraging structural properties of balanced parse trees.

Experimental results

Research questions

  • RQ1Can we reduce the time complexity of grammar-based pattern matching from $ \mathcal{O}(m^2) $ to $ \mathcal{O}(m\log m) $ while maintaining sublinear space?
  • RQ2How can we combine SLPs and LZ77 parsing to achieve better space-time trade-offs in compressed self-indexes?
  • RQ3What is the impact of using balanced SLPs on query performance and index construction time?
  • RQ4Can we support efficient extraction and pattern reporting in compressed text using only $ \mathcal{O}(r + z\log\log n) $ space?
  • RQ5Is it possible to design a practical self-index that supports approximate pattern matching using exact matching primitives?

Key findings

  • The proposed self-index uses $ \mathcal{O}(r + z\log\log n) $ space, where $ r $ is the number of SLP rules and $ z $ is the number of phrases in the LZ77 parse of the string.
  • Pattern matching is supported in $ \mathcal{O}(m^2 + \mathrm{occ}\log\log n) $ time, improving over previous $ \mathcal{O}(m^2 \log(\log n / \log r') + \mathrm{occ}\log r') $ bounds.
  • For balanced SLPs, the query time is reduced to $ \mathcal{O}(m\log m + \mathrm{occ}\log\log n) $ with a small probability of index failure.
  • The index supports fast text extraction in $ \mathcal{O}(\ell + \log n) $ time, matching the best known bounds for grammar-based indexes.
  • The construction of the index is compatible with practical SLP construction algorithms, such as Maruyama et al.’s online algorithm, which produces balanced SLPs with $ \mathcal{O}(z\log^2 n) $ rules.
  • The approach enables efficient approximate pattern matching by leveraging exact matching primitives, with potential integration of distance-preserving Karp-Rabin hashes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.