paper

Dynamic Grammar-Compressed Self-Index in -Optimal Space

arXiv:2604.24080

Abstract

A compressed self-index stores a string in compressed form while supporting locate queries without decompression. For highly repetitive strings, such as those arising in web crawls, versioned documents, and genomic collections, static self-indexes can match the -optimal lower bound of bits up to constant factors, where is the string length, is the alphabet size, and is the substring complexity. Their dynamic counterparts, however, remain scarce: every existing dynamic self-index either fails to attain -optimal space, pays time per reported occurrence for locate queries, or has an update time that grows with the maximum value in the longest common prefix (LCP) array of the text. We present the dynamic RR-index, a dynamic grammar-compressed self-index built on the restricted recompression run-length straight-line program (RLSLP). To our knowledge, it is the first dynamic self-index to attain -optimal space. The index uses bits in expectation, answers locate queries in expected time, where is the pattern length and is the number of occurrences, and supports insertion of a length- string and deletion of a length- substring in expected amortized time, with no dependence on the maximum LCP value. On eleven highly repetitive corpora, including a GB Wikipedia dump and a GB human-chromosome collection, the dynamic RR-index is up to faster than the dynamic r-index for updates and up to faster than other dynamic indexes for locate queries.

Revised in response to the reviewers' comments

Dynamic Grammar-Compressed Self-Index in $δ$-Optimal Space · wovepaper