Efficient Grammar Compression via RLZ-based RePair
Abstract
Among grammar-based compression techniques, RePair is a notable offline encoding scheme known for its simplicity and powerful combinatorial properties, producing compact grammars by repeatedly replacing the most frequent adjacent pairs of symbols, known as bigrams. However, RePairs memory usage scales poorly with input size, as it loads the entire text into memory. In contrast, Relative Lempel-Ziv (RLZ) parsing offers a scalable and lightweight online encoding scheme that losslessly represents a text in terms of phrases that refer to a reference string, but it often fails to expose deeper structural patterns. We introduce an algorithm that produces a RePair grammar from the RLZ parse of the input, leveraging the strengths of both methods. Our method, RLZ-RePair, performs bigram replacements systematically, preserving the integrity of the RLZ phrases throughout the RePair iterations. When the reference is well chosen, our method achieves the same grammar as standard RePair while significantly reducing both memory usage and the number of bigram replacements. In particular, we show that RLZ-RePair can reduce memory usage by more than 80% while incurring only a modest runtime increase compared to RePair. To our knowledge, RLZ-RePair is one of the first scalable methods that constructs exact RePair grammars, resulting in a grammar-based compressor that is both practical for large datasets and faithful to the theoretical elegance of RePair.
02 /Specification & Classification
Click any tag to browse matching papers- Citations
- 3
- Research Focus
- Approach
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- Recursive RePair: Increasing the Scalability of RePair by Decreasing Memory Usage
J.H. Kim, Rahul Varki, … Christina A. Boucher·bioRxiv·Jul 11, 2024
- Accelerating String Comparison in RLZ Compressed Sequences via LCE Jumps
Rahul Varki, Christina A. Boucher·bioRxiv·Aug 10, 2026
- Recursive Prefix-Free Parsing for Building Big BWTs
Marco Oliva, Travis Gagie, Christina A. Boucher·DCCPeer-reviewed·Mar 1, 2023
- Constructing smaller genome graphs via string compression
Yutong Qiu, Carl Kingsford·BioinformaticsPeer-reviewed·Apr 28, 2021
- RLBWT-Based LCP Computation in Compressed Space for Terabase-Scale Pangenome Analysis
Ahsan Sanaullah, Nathaniel K. Brown, … Shaojie Zhang·BioinformaticsPeer-reviewed·Jul 1, 2026
- PgRC: Pseudogenome based Read Compressor
Tomasz Kowalski, Szymon Grabowski·BioinformaticsPeer-reviewed·Dec 5, 2019