English

Sketching and Streaming for Dictionary Compression

Data Structures and Algorithms 2024-08-20 v3

Abstract

We initiate the study of sub-linear sketching and streaming techniques for estimating the output size of common dictionary compressors such as Lempel-Ziv '77, the run-length Burrows-Wheeler transform, and grammar compression. To this end, we focus on a measure that has recently gained much attention in the information-theoretic community and which approximates up to a polylogarithmic multiplicative factor the output sizes of those compressors: the normalized substring complexity function δ\delta. We present a data sketch of O(ϵ3logn+ϵ1log2n)O(\epsilon^{-3}\log n + \epsilon^{-1}\log^2 n) words that allows computing a multiplicative (1±ϵ)(1\pm \epsilon)-approximation of δ\delta with high probability, where nn is the string length. The sketches of two strings S1,S2S_1,S_2 can be merged in O(ϵ1log2n)O(\epsilon^{-1}\log^2 n) time to yield the sketch of {S1,S2}\{S_1,S_2\}, speeding up by orders of magnitude tasks such as the computation of all-pairs \emph{Normalized Compression Distances} (NCD). If random access is available on the input, our sketch can be updated in O(ϵ1log2n)O(\epsilon^{-1}\log^2 n) time for each character right-extension of the string. This yields a polylogarithmic-space algorithm for approximating δ\delta, improving exponentially over the working space of the state-of-the-art algorithms running in nearly-linear time. Motivated by the fact that random access is not always available on the input data, we then present a streaming algorithm computing our sketch in O(nlogn)O(\sqrt n \cdot \log n) working space and O(ϵ1log2n)O(\epsilon^{-1}\log^2 n) worst-case delay per character. We show that an implementation of our streaming algorithm can estimate {\delta} on a dataset of 189GB with a throughput of 203MB per minute while using only 5MB of RAM, and that our sketch speeds up the computation of all-pairs NCD distances by one order of magnitude, with applications to phylogenetic tree reconstruction.

Keywords

Cite

@article{arxiv.2310.17980,
  title  = {Sketching and Streaming for Dictionary Compression},
  author = {Ruben Becker and Matteo Canton and Davide Cenzato and Sung-Hwan Kim and Bojana Kodric and Nicola Prezza},
  journal= {arXiv preprint arXiv:2310.17980},
  year   = {2024}
}
R2 v1 2026-06-28T13:03:34.913Z