Abstract
Let S be a string of length N compressed into a context-free grammar S of size n. We present two representations of S achieving O(log N) random access time, and either O(n · αk(n)) construction time and space on the pointer machine model, or O(n) construction time and space on the RAM. Here, αk(n) is the inverse of the kth row of Ackermann's function. Our representations also efficiently support decompression of any substring in S: we can decompress any substring of length m in the same complexity as a single random access query and additional O(m) time. Combining these results with fast algorithms for uncompressed approximate string matching leads to several efficient algorithms for approximate string matching on grammar-compressed strings without decompression. For instance, we can find all approximate occurrences of a pattern P with at most k errors in time O(n(min{|P|k, k +|P|} +log N) + occ), where occ is the number of occurrences of P in S. Finally, we are able to generalize our results to navigation and other operations on grammar-compressed trees. All of the above bounds significantly improve the currently best known results. To achieve these bounds, we introduce several new techniques and data structures of independent interest, including a predecessor data structure, two “biased” weighted ancestor data structures, and a compact representation of heavy-paths in grammars.
Highlights
Modern textual or semi-structured databases, e.g. for biological and WWW data, are huge, and are typically stored in compressed form
Let S be a string of length N from an alphabet Σ, given in a compressed representation S of size n
We consider these problems in the context of grammar-based compression, where one replaces a long string by a small context-free grammar (CFG) that generates this string (and this string only, see Fig. 1(a))
Summary
Modern textual or semi-structured databases, e.g. for biological and WWW data, are huge, and are typically stored in compressed form. The random access problem is to compactly represent S while supporting fast random access queries, that is, given an index i, 1 ≤ i ≤ N , report S[i]. An important variant of the pattern matching problem is when we allow approximate matching (i.e., when P is allowed to appear in S with some errors) We consider these problems in the context of grammar-based compression, where one replaces a long string by a small context-free grammar (CFG) that generates this string (and this string only, see Fig. 1(a)).
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have