17 research outputs found
From LZ77 to the run-length encoded burrows-wheeler transform, and back
The Lempel-Ziv factorization (LZ77) and the Run-Length encoded Burrows-Wheeler Transform (RLBWT) are two important tools in text compression and indexing, being their sizes z and r closely related to the amount of text self-repetitiveness. In this paper we consider the problem
of converting the two representations into each other within a working space proportional to the input and the output. Let n be the text length. We show that RLBW T can be converted to LZ77 in O(n log r) time and O(r) words of working space. Conversely, we provide an algorithm to convert LZ77 to RLBW T in O n(log r + log z) time and O(r + z) words of working space. Note that r and z can be constant if the text is highly repetitive, and our algorithms can operate with (up to) exponentially less space than naive solutions based on full decompression
Space-efficient conversions from SLPs
We give algorithms that, given a straight-line program (SLP) with rules
that generates (only) a text , builds within space the
Lempel-Ziv (LZ) parse of (of phrases) in time or in time
. We also show how to build a locally consistent grammar
(LCG) of optimal size from the SLP
within space and in time, where is the
substring complexity measure of . Finally, we show how to build the LZ parse
of from such a LCG within space and in time . All our results hold with high probability
Grammar Boosting: A New Technique for Proving Lower Bounds for Computation over Compressed Data
Grammar compression is a general compression framework in which a string
of length is represented as a context-free grammar of size whose
language contains only . In this paper, we focus on studying the limitations
of algorithms and data structures operating on strings in grammar-compressed
form. Previous work focused on proving lower bounds for grammars constructed
using algorithms that achieve the approximation ratio
. Unfortunately, for the majority of
grammar compressors, is either unknown or satisfies
. In their seminal paper, Charikar et al. [IEEE
Trans. Inf. Theory 2005] studied seven popular grammar compression algorithms:
RePair, Greedy, LongestMatch, Sequential, Bisection, LZ78, and
-Balanced. Only one of them (-Balanced) is known to achieve
.
We develop the first technique for proving lower bounds for data structures
and algorithms on grammars that is fully general and does not depend on the
approximation ratio of the used grammar compressor. Using this
technique, we first prove that time is required
for random access on RePair, Greedy, LongestMatch, Sequential, and Bisection,
while time is required for random access to LZ78. All
these lower bounds hold within space and
match the existing upper bounds. We also generalize this technique to prove
several conditional lower bounds for compressed computation. For example, we
prove that unless the Combinatorial -Clique Conjecture fails, there is no
combinatorial algorithm for CFG parsing on Bisection (for which it holds
) that runs in time for all constants and . Previously,
this was known only for
Compression by Contracting Straight-Line Programs
In grammar-based compression a string is represented by a context-free
grammar, also called a straight-line program (SLP), that generates only that
string. We refine a recent balancing result stating that one can transform an
SLP of size in linear time into an equivalent SLP of size so that
the height of the unique derivation tree is where is the length
of the represented string (FOCS 2019). We introduce a new class of balanced
SLPs, called contracting SLPs, where for every rule the string length of every variable on the right-hand side
is smaller by a constant factor than the string length of . In particular,
the derivation tree of a contracting SLP has the property that every subtree
has logarithmic height in its leaf size. We show that a given SLP of size
can be transformed in linear time into an equivalent contracting SLP of size
with rules of constant length.
We present an application to the navigation problem in compressed unranked
trees, represented by forest straight-line programs (FSLPs). We extend a linear
space data structure by Reh and Sieber (2020) by the operation of moving to the
-th child in time where is the degree of the current node.
Contracting SLPs are also applied to the finger search problem over
SLP-compressed strings where one wants to access positions near to a
pre-specified finger position, ideally in time where is the
distance between the accessed position and the finger. We give a linear space
solution where one can access symbols or move the finger in time for any constant where is the -fold
logarithm of . This improves a previous solution by Bille, Christiansen,
Cording, and G{\o}rtz (2018) with access/move time