Compact q-gram Profiling of Compressed Strings
Preprint
Abstract
We consider the problem of computing the q-gram profile of a string \str of size $N$ compressed by a context-free grammar with $n$ production rules. We present an algorithm that runs in $O(N-\alpha)$ expected time and uses $O(n+q+\kq)$ space, where $N-\alpha\leq qn$ is the exact number of characters decompressed by the algorithm and $\kq\leq N-\alpha$ is the number of distinct q-grams in $\str$. This simultaneously matches the current best known time bound and improves the best known space bound. Our space bound is asymptotically optimal in the sense that any algorithm storing the grammar and the q-gram profile must use $\Omega(n+q+\kq)$ space. To achieve this we introduce the q-gram graph that space-efficiently captures the structure of a string with respect to its q-grams, and show how to construct it from a grammar.
Keywords
All Related Versions
This publication has 9 references indexed in Scilit:
- Fast q-gram mining on SLP compressed stringsJournal of Discrete Algorithms, 2013
- Efficient algorithms to compute compressed longest common substrings and compressed palindromesTheoretical Computer Science, 2009
- The Smallest Grammar ProblemIEEE Transactions on Information Theory, 2005
- A survey of kernels for structured dataACM SIGKDD Explorations Newsletter, 2003
- Application of Lempel-Ziv Factorization to the Approximation of Grammar-Based Compression2002
- Constructing the Suffix Tree of a Tree with a Large AlphabetLecture Notes in Computer Science, 1999
- Lempel-Ziv index for q-gramsLecture Notes in Computer Science, 1996
- Approximate string-matching with q-grams and maximal matchesTheoretical Computer Science, 1992
- Efficient randomized pattern-matching algorithmsIBM Journal of Research and Development, 1987