Skip to main content
QUICK REVIEW

[Paper Review] The Wavelet Trie: Maintaining an Indexed Sequence of Strings in Compressed Space

Roberto Grossi, Giuseppe Ottaviano|arXiv (Cornell University)|Apr 16, 2012
Network Packet Processing and OptimizationComputer Science1 references4 citations
TL;DR

The paper introduces the Wavelet Trie, a compressed data structure that efficiently maintains an indexed sequence of strings in nearly-optimal space by combining a Patricia trie with wavelet trees. It supports dynamic operations like insertion, deletion, and prefix queries with near-entropy space occupancy and polylogarithmic time complexity, achieving high space efficiency and strong theoretical guarantees for dynamic string sequences.

ABSTRACT

An indexed sequence of strings is a data structure for storing a string sequence that supports random access, searching, range counting and analytics operations, both for exact matches and prefix search. String sequences lie at the core of column-oriented databases, log processing, and other storage and query tasks. In these applications each string can appear several times and the order of the strings in the sequence is relevant. The prefix structure of the strings is relevant as well: common prefixes are sought in strings to extract interesting features from the sequence. Moreover, space-efficiency is highly desirable as it translates directly into higher performance, since more data can fit in fast memory. We introduce and study the problem of compressed indexed sequence of strings, representing indexed sequences of strings in nearly-optimal compressed space, both in the static and dynamic settings, while preserving provably good performance for the supported operations. We present a new data structure for this problem, the Wavelet Trie, which combines the classical Patricia Trie with the Wavelet Tree, a succinct data structure for storing a compressed sequence. The resulting Wavelet Trie smoothly adapts to a sequence of strings that changes over time. It improves on the state-of-the-art compressed data structures by supporting a dynamic alphabet (i.e. the set of distinct strings) and prefix queries, both crucial requirements in the aforementioned applications, and on traditional indexes by reducing space occupancy to close to the entropy of the sequence.

Motivation & Objective

  • To address the need for space-efficient, dynamic data structures that support indexing and querying of sequences of strings in compressed space.
  • To enable efficient prefix queries (e.g., rank and select on common prefixes) in sequences where string order and repetition matter.
  • To support dynamic updates (insert, delete, append) while maintaining compressed space occupancy close to the entropy of the sequence.
  • To handle arbitrary universes of strings without prior knowledge of the alphabet, using randomized hashing to ensure balanced structure with high probability.
  • To provide theoretical guarantees on time and space complexity for fundamental operations like access, rank, and select in both static and dynamic settings.

Proposed method

  • Combines a Patricia trie with a wavelet tree to compress the sequence while preserving efficient access and query operations.
  • Uses a randomized hash function $ h_a(x) = ax \mod 2^{\lceil \log u \rceil} $ to map elements from a universe $ U $ to binary strings, ensuring balanced trie depth with high probability.
  • Applies the wavelet tree to the sequence of hashed string labels, enabling compressed representation and efficient rank/select operations on the labels.
  • Employs the inverse hash function to map results back to original values, maintaining correctness of operations.
  • Uses Lemma 6.1 from prior work to prove that with high probability, the first $ \ell = (\alpha+2)\log|\Sigma| $ bits of the hashes distinguish all strings in the alphabet $ \Sigma $, ensuring balanced trie height.
  • Supports dynamic operations by maintaining the wavelet trie on the hashed strings, with updates propagating through the wavelet tree structure.

Experimental results

Research questions

  • RQ1Can a compressed data structure be designed to support dynamic operations on indexed sequences of strings while achieving space occupancy close to the entropy of the sequence?
  • RQ2How can prefix queries (e.g., counting or selecting strings with a given prefix) be efficiently supported in a compressed, dynamic setting?
  • RQ3Can the structure maintain good time complexity even when the alphabet is not known in advance and may grow dynamically?
  • RQ4Is it possible to achieve balanced tree depth in a trie over hashed values without explicit rebalancing, using only randomization?
  • RQ5What is the trade-off between space efficiency and query/update time in a dynamic, compressed string sequence data structure?

Key findings

  • The Wavelet Trie supports all standard operations—Access, Rank, Select, Insert, Delete—on a dynamic sequence of strings in $ O(\log u + h\log n) $ time, where $ h \leq (\alpha+2)\log|\Sigma| $ with high probability.
  • The space occupancy is bounded by $ O(nH_0(S) + |\Sigma|w + |\Sigma|\log u) $ bits, achieving near-entropy compression for the sequence.
  • With high probability, the height of the trie is bounded by $ (\alpha+2)\log|\Sigma| $, ensuring balanced performance even for arbitrary input sets.
  • The use of a random hash function ensures that all strings in the alphabet are distinguished by their first $ \ell $ bits with probability at least $ 1 - |\Sigma|^{-\alpha} $, enabling balanced structure.
  • The data structure supports prefix queries (RankPrefix, SelectPrefix) efficiently by extending the wavelet tree operations to prefix-based ranges on the hashed strings.
  • The approach generalizes to non-string data by hashing numeric values into binary strings of length $ \lceil \log u \rceil $, enabling application to arbitrary universes.

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.