Skip to main content
QUICK REVIEW

[Paper Review] Compression by Contracting Straight-Line Programs

Moses Ganardi|arXiv (Cornell University)|Jan 1, 2021
Algorithms and Data CompressionComputer Science16 references1 citations
TL;DR

This paper introduces contracting straight-line programs (SLPs), a new class of balanced SLPs where each variable on the right-hand side of a rule is strictly smaller in string length by a constant factor than its parent. The authors present a linear-time algorithm to transform any SLP into an equivalent contracting SLP of size O(g), enabling efficient navigation and finger search in compressed strings with O(log d + log^(t) N) time complexity, improving over prior O(log d + log log N) bounds.

ABSTRACT

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 g in linear time into an equivalent SLP of size 𝒪(g) so that the height of the unique derivation tree is 𝒪(log N) where N is the length of the represented string (FOCS 2019). We introduce a new class of balanced SLPs, called contracting SLPs, where for every rule A → β₁ … β_k the string length of every variable β_i on the right-hand side is smaller by a constant factor than the string length of A. 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 g can be transformed in linear time into an equivalent contracting SLP of size 𝒪(g) with rules of constant length. This result is complemented by a lower bound, proving that converting SLPs into so called α-balanced SLPs or AVL-grammars can incur an increase by a factor of Ω(log N). We present an application to the navigation problem in compressed unranked trees, represented by forest straight-line programs (FSLPs). A linear space data structure by Reh and Sieber (2020) supports navigation steps such as going to the parent, left/right sibling, or to the first/last child in constant time. We extend their solution by the operation of moving to the i-th child in time 𝒪(log d) where d 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 𝒪(log d) time where d is the distance between the accessed position and the finger. We give a linear space solution for the dynamic variant where one can set the finger in 𝒪(log N) time, and then access symbols or move the finger in time 𝒪(log d + log^(t) N) for any constant t where log^(t) N is the t-fold logarithm of N. This improves a previous solution by Bille, Christiansen, Cording, and Gørtz (2018) with access/move time 𝒪(log d + log log N).

Motivation & Objective

  • To address the limitations of existing balanced SLPs like α-balanced SLPs and AVL-grammars, which require Ω(log N) size blowup during transformation.
  • To design a new balancing mechanism—contracting SLPs—that ensures logarithmic height in subtree leaf size and enables efficient navigation in compressed strings.
  • To provide a linear-space data structure supporting efficient finger search and navigation in grammar-compressed strings, improving on prior access and move times.
  • To prove a lower bound showing that α-balanced SLPs or AVL-grammars require Ω(log N) size increase during transformation, highlighting the advantage of contracting SLPs.
  • To extend existing compressed data structures to support efficient access to the i-th child in unranked trees and to support dynamic finger search with improved time bounds.

Proposed method

  • Define contracting SLPs such that for every rule A → β₁…βₖ, the string length of each βᵢ is at most a constant factor smaller than |A|, ensuring logarithmic height in subtree leaf size.
  • Design a linear-time transformation from any SLP of size g to an equivalent contracting SLP of size O(g), preserving the derivation tree structure with controlled depth.
  • Use accelerated paths with prefix sums of left and right weights to enable fast navigation in the derivation tree, maintaining dynamic predecessor data structures for efficient path queries.
  • Apply weighted ancestor data structures on forests of left and right edges to support long-step navigation in the derivation tree, combining short and long steps for efficiency.
  • Leverage the path-balanced structure of contracting SLPs to bound the number of short steps in any path to O(log d), enabling O(log d + log^(t) N) finger search time.
  • Prove that for (α, β)-path balanced SLPs, fringe access can be performed in O(log d) time using weighted ancestor queries on forests of edges, enabling efficient navigation.

Experimental results

Research questions

  • RQ1Can a more efficient balancing mechanism be designed for SLPs that avoids the Ω(log N) size blowup seen in α-balanced SLPs and AVL-grammars?
  • RQ2Can contracting SLPs be constructed in linear time from any SLP while preserving equivalence and achieving O(g) size?
  • RQ3Can the navigation and finger search operations in compressed strings be accelerated beyond O(log d + log log N) time using a new SLP structure?
  • RQ4Is there a lower bound proving that α-balanced SLPs or AVL-grammars inherently require Ω(log N) size increase during transformation?
  • RQ5Can the proposed data structure support efficient access to the i-th child in compressed unranked trees, extending prior work on forest SLPs?

Key findings

  • A linear-time algorithm transforms any SLP of size g into an equivalent contracting SLP of size O(g), with rules of constant length.
  • Contracting SLPs ensure that every subtree has height logarithmic in its leaf size, enabling efficient navigation and finger search.
  • The paper proves a lower bound showing that transforming SLPs into α-balanced SLPs or AVL-grammars incurs a Ω(log N) size increase, highlighting the efficiency of contracting SLPs.
  • A dynamic finger search data structure is achieved with O(log d + log^(t) N) time for access and move operations, improving over the prior O(log d + log log N) bound.
  • The method supports O(log d) time access to the i-th child in compressed unranked trees, extending Reh and Sieber's (2020) navigation data structure.
  • For (α, β)-path balanced SLPs, fringe access can be performed in O(log d) time using weighted ancestor queries, demonstrating the power of the new balancing model.

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.