Introduction
String attractors, introduced in 2018, have emerged as a powerful combinatorial tool for measuring the compressibility of repetitive data. A string attractor is defined as a set of positions within a text such that every distinct substring has at least one occurrence crossing one of these positions. The size of the smallest attractor serves as a proxy for the inherent repetitiveness and compressibility of the string.
While offline string attractors—where the entire string is known in advance—have been extensively studied, many real-world applications require processing data in a streaming or "online" fashion. This paper establishes the first theoretical framework for online string attractors, where an algorithm must decide whether to include a position in the attractor as it processes the string character by character, without knowledge of future characters.
The Online Setting and the Lazy Algorithm
In the online variant of the string attractor problem, the algorithm receives the string position by position. Upon receiving a character, it must immediately decide whether to add the current position to the attractor. The primary strategy investigated is the Lazy algorithm, a greedy approach that adds a position to the attractor only when it encounters a "novel" substring—one that has not appeared previously in the string.
A significant contribution of this work is the formal link between the Lazy algorithm and the classic Lempel-Ziv (LZ77) factorization. Specifically, the paper proves that the Lazy algorithm is equivalent to a self-referencing, novel variant of LZ77.
As shown in the table above, different constraints on self-referencing and novelty lead to different factorizations and attractor sizes ($z$). The Lazy algorithm's strategy aligns with the most efficient online approach.
Theoretical Analysis and Word Families
To evaluate the performance of online algorithms, the study utilizes competitive analysis, comparing the online attractor size to the optimal offline attractor size. The analysis focuses on specific mathematical "word families" that exhibit extreme repetitive properties, serving as stress tests for compression algorithms.
Key sequences analyzed include:
- Fibonacci Words: Highly repetitive strings where the offline attractor size remains constant (size 2) regardless of length.
- Thue-Morse Words: Infinite binary words with low complexity.
- De Bruijn Sequences: Used to construct "hard" instances that force online algorithms to perform poorly.
The table above illustrates the growth of Fibonacci words ($F_m$) and related sequences ($K_m$). These sequences are crucial for demonstrating the "price of streaming"—the inherent gap between offline and online performance.
Key Results and Competitive Ratios
The paper establishes several foundational results for online string attractors:
- Optimality of LZ77: The Lazy algorithm (equivalent to LZ77) is proven to be the optimal deterministic online strategy.
- General Competitive Ratio: For general string attractors, the competitive ratio is established as $\Theta(\log n)$. This indicates that an online algorithm is at most a logarithmic factor worse than an optimal offline algorithm. For strings like Fibonacci words, where the offline optimum is constant, the online attractor must grow at a rate of $\Omega(\log n)$.
- $k$-Attractor Tightness: In the $k$-attractor problem, which considers only substrings up to length $k$, the author proves a strict $k$-competitiveness. This bound is shown to be tight, meaning no online algorithm can achieve a better ratio than $k$.
Conclusion
This research bridges modern combinatorial string theory with classical compression techniques. By proving that LZ77 is the optimal online strategy for string attractors, the paper provides a new theoretical justification for the enduring success of Lempel-Ziv based compression. While the $\Theta(\log n)$ bound is tight for highly compressible strings, future work remains to determine if the competitive ratio improves for less repetitive data. These insights pave the way for more efficient streaming-aware compression formats and data structures.
Summary updated