English

Computing all-vs-all MEMs in grammar-compressed text

Information Retrieval 2023-06-30 v1 Data Structures and Algorithms

Abstract

We describe a compression-aware method to compute all-vs-all maximal exact matches (MEM) among strings of a repetitive collection T\mathcal{T}. The key concept in our work is the construction of a fully-balanced grammar G\mathcal{G} from T\mathcal{T} that meets a property that we call \emph{fix-free}: the expansions of the nonterminals that have the same height in the parse tree form a fix-free set (i.e., prefix-free and suffix-free). The fix-free property allows us to compute the MEMs of T\mathcal{T} incrementally over G\mathcal{G} using a standard suffix-tree-based MEM algorithm, which runs on a subset of grammar rules at a time and does not decompress nonterminals. By modifying the locally-consistent grammar of Christiansen et al 2020., we show how we can build G\mathcal{G} from T\mathcal{T} in linear time and space. We also demonstrate that our MEM algorithm runs on top of G\mathcal{G} in O(G+occ)O(G +occ) time and uses O(logG(G+occ))O(\log G(G+occ)) bits, where GG is the grammar size, and occocc is the number of MEMs in T\mathcal{T}. In the conclusions, we discuss how our idea can be modified to implement approximate pattern matching in compressed space.

Keywords

Cite

@article{arxiv.2306.16815,
  title  = {Computing all-vs-all MEMs in grammar-compressed text},
  author = {Diego Diaz-Dominguez and Leena Salmela},
  journal= {arXiv preprint arXiv:2306.16815},
  year   = {2023}
}
R2 v1 2026-06-28T11:17:44.419Z