Skip to main content
QUICK REVIEW

[Paper Review] Approximation of grammar-based compression via recompression

Artur Jeż|arXiv (Cornell University)|Jan 24, 2013
Algorithms and Data CompressionComputer Science13 references15 citations
TL;DR

This paper presents a simple, linear-time algorithm that constructs a context-free grammar of size $\mathcal{O}(g\log(N/g))$ for any input string, where $N$ is the string length and $g$ is the size of the optimal grammar. The method uses a novel application of recompression techniques without relying on LZ77 or derivation tree balancing, achieving a near-optimal approximation ratio with minimal algorithmic complexity.

ABSTRACT

In this paper we present a simple linear-time algorithm constructing a context-free grammar of size O(g log(N/g)) for the input string, where N is the size of the input string and g the size of the optimal grammar generating this string. The algorithm works for arbitrary size alphabets, but the running time is linear assuming that the alphabet Σof the input string can be identified with numbers from {1, ..., N^c} for some constant c. Otherwise, additional cost of O(n log|Σ|) is needed. Algorithms with such approximation guarantees and running time are known, the novelty of this paper is a particular simplicity of the algorithm as well as the analysis of the algorithm, which uses a general technique of recompression recently introduced by the author. Furthermore, contrary to the previous results, this work does not use the LZ representation of the input string in the construction, nor in the analysis.

Motivation & Objective

  • To develop a simple, efficient algorithm for grammar-based compression that approximates the smallest possible grammar for a given string.
  • To achieve an approximation ratio of $\mathcal{O}(g\log(N/g))$ without relying on LZ77 or balanced tree structures.
  • To simplify the analysis and implementation of grammar compression by introducing a new recompression-based framework.
  • To demonstrate that the algorithm runs in linear time under standard assumptions on alphabet representation.

Proposed method

  • The algorithm uses a recompression technique that repeatedly replaces pairs of symbols with new nonterminals, maintaining a compressed representation throughout.
  • It introduces a marking system to track the cost of introducing new nonterminals and ensures credit is maintained for future operations.
  • The method avoids explicit use of LZ77 or balanced derivation trees (e.g., AVL or length-balanced trees), unlike prior approaches.
  • It uses a credit-based accounting system to bound the total cost of grammar construction, ensuring the final grammar size remains within $\mathcal{O}(g\log(N/g))$.
  • The algorithm processes the string in phases, reducing the length of the current representation iteratively while maintaining a bounded cost per phase.
  • The analysis relies on bounding the sum of logarithms of block sizes and the number of blocks introduced, using properties of the recompression process.

Experimental results

Research questions

  • RQ1Can a grammar-based compression algorithm achieve an $\mathcal{O}(g\log(N/g))$ approximation ratio with linear running time using a simpler method than prior approaches?
  • RQ2Is it possible to avoid using LZ77 or balanced tree structures in the construction and analysis of grammar compression algorithms?
  • RQ3Can the recompression technique be adapted to provide a tight approximation guarantee for the smallest grammar problem?
  • RQ4What is the minimal overhead in grammar size when using a credit-based accounting system in a recompression framework?

Key findings

  • The algorithm constructs a grammar of size $\mathcal{O}(g\log(N/g))$ for any input string of length $N$, where $g$ is the size of the optimal grammar.
  • The running time is linear in $N$ under the assumption that the alphabet can be represented as integers in $\{1,\ldots,N^c\}$ for a constant $c$.
  • An additional cost of $\mathcal{O}(n\log|\Sigma|)$ is required if the alphabet cannot be assumed to be numerically representable in this way.
  • The method does not rely on LZ77 or derivation tree balancing (e.g., AVL or length-balanced trees), distinguishing it from prior work.
  • The credit-based analysis ensures that the total cost of introducing new nonterminals is bounded by $\mathcal{O}(g + g\log(N/g))$.
  • The final grammar size is guaranteed to be within $\mathcal{O}(g\log(N/g))$ of the optimal, and this bound is achieved through a clean, unified analysis using recompression.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.