TL;DR
This paper introduces "suffix trays" and "suffix trists," novel data structures that combine the strengths of suffix trees and suffix arrays to achieve faster text indexing. These structures offer deterministic query times of $O(m + \log |\Sigma|)$ for static texts and $O(m + \log |\Sigma|)$ for online text extensions, improving upon existing methods while maintaining linear space and construction time.
What Problem Does This Paper Address?
Text indexing is crucial for efficiently searching for patterns within large texts. Two dominant data structures for this task are suffix trees and suffix arrays. While both can be built in linear time and space, they have different query time complexities. Suffix trees typically offer $O(m \log |\Sigma| + occ)$ query time (where $m$ is query length, $|\Sigma|$ is alphabet size, and $occ$ is the number of occurrences), while suffix arrays achieve $O(m + \log n + occ)$ (where $n$ is text length). The paper aims to bridge this gap by developing data structures that offer the best of both worlds: deterministic, fast query times comparable to suffix arrays, but with the structural advantages of suffix trees, and also address the challenge of online text indexing where the text grows character by character.
Methods
The paper introduces two main data structures:
- Suffix Tray: This structure combines suffix trees and suffix arrays by leveraging the concept of "suffix intervals." It introduces special "suffix interval nodes" and utilizes arrays at "branching-σ-nodes" (nodes in the suffix tree with at least $|\Sigma|$ leaves in their subtree) to facilitate faster navigation. The key idea is to efficiently map query characters to relevant parts of the suffix array, achieving $O(m + \log |\Sigma|)$ query time. Construction is linear.
- Suffix Trist: This is an online version of the suffix tray designed for scenarios where the text arrives character by character. It replaces the static suffix array with dynamic data structures (balanced indexing structures or BISs) that can handle insertions. The suffix trist aims to mimic the suffix tray's query performance while supporting efficient text extensions. The update time for text extensions depends on the underlying online suffix tree construction, with a bound of $O(f(n, |\Sigma|) + \log |\Sigma|)$, where $f(n, |\Sigma|)$ is the cost of adding a character to the suffix tree.
Datasets
Not discussed in the paper. The paper focuses on theoretical data structure design and analysis rather than empirical evaluation on specific datasets.
Key Insights and Ideas
- Bridging Suffix Trees and Suffix Arrays: The core insight is that by carefully combining the hierarchical structure of suffix trees with the ordered nature of suffix arrays (via suffix intervals), one can achieve query times that outperform either structure individually for certain scenarios.
- Suffix Intervals as a Unifying Concept: The paper effectively uses suffix intervals, derived from suffix tree nodes, to connect the tree structure to contiguous ranges in the suffix array. This connection is fundamental to both the suffix tray and trist.
- σ-Nodes for Efficient Partitioning: The introduction of σ-nodes (nodes with at least $|\Sigma|$ leaves) and their classification (branching-σ-nodes, σ-leaves) provides a principled way to partition the suffix tree and manage auxiliary data structures (like arrays $A_v$) for efficient query routing.
- Lazy Updates for Dynamic Structures: For the online suffix trist, the paper proposes a "lazy" approach to constructing the branching-σ-node arrays ($A_v$), deferring the cost of construction to future insertions. This is crucial for maintaining efficient update times in a dynamic setting.
Key Results
- Suffix Tray:
- Linear space complexity ($O(n)$).
- Linear construction time ($O(n)$).
- Deterministic query time of $O(m + \log |\Sigma|)$ for patterns of length $m$.
- Supports outputting all occurrences with an additional $O(occ)$ cost.
- Suffix Trist:
- Linear space complexity ($O(n)$).
- Supports online text extensions with a cost of $O(f(n, |\Sigma|) + \log |\Sigma|)$, where $f(n, |\Sigma|)$ is the cost of extending an online suffix tree.
- Supports indexing queries in $O(m + \log |\Sigma|)$ time.
Limitations and Future Work
- Alphabet Size Dependency: The query time for the suffix tray is $O(m + \log |\Sigma|)$, which means it can be slower than $O(m + \log n)$ if the alphabet size $|\Sigma|$ is significantly larger than the text size $n$. The paper notes that this can be improved for integer alphabets from a linear range.
- Online Construction Dependency: The efficiency of the suffix trist for text extensions is dependent on the existence and performance of an underlying online suffix tree construction algorithm.
- Future Work: The authors explicitly mention that a significant future challenge is to allow deletions of texts from a collection, in addition to insertions, for generalized suffix trists. They also suggest exploring generalized suffix trists for managing collections of texts.
Summary updated