The CDAWG Index and Pattern Matching on Grammar-Compressed Strings
Abstract
The compact directed acyclic word graph (CDAWG) is the minimal compact automaton that recognizes all the suffixes of a string. Classically the CDAWG has been implemented as an index of the string it recognizes, requiring space for a copy of the string being indexed, where . In this work, we propose using the CDAWG as an index for grammar-compressed strings. While this enables all analyses supported by the CDAWG on any grammar-compressed string, in this work we specifically consider pattern matching. Using the CDAWG index, pattern matching can be performed on any grammar-compressed string in time while requiring only additional space, where is the length of the pattern, is the grammar random access time, is the number of occurrences of the pattern in , and is the number of right-extensions of the maximal repeats in . Our experiments show that even when using a na\"ive random access algorithm, the CDAWG index achieves state of the art run-time performance for pattern matching on grammar-compressed strings. Additionally, we find that all of the grammars computed for our experiments are smaller than the number of right-extensions in the string they produce and, thus, their CDAWGs are within the best known space asymptotic bound.
Keywords
Cite
@article{arxiv.2407.08826,
title = {The CDAWG Index and Pattern Matching on Grammar-Compressed Strings},
author = {Alan M. Cleary and Joseph Winjum and Jordan Dood and Shunsuke Inenaga},
journal= {arXiv preprint arXiv:2407.08826},
year = {2024}
}