{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/the-cdawg-index-and-pattern-matching-on","title":"The CDAWG Index and Pattern Matching on Grammar-Compressed Strings","arxiv_id":"2407.08826","date":"2024-07-11","proceeding":null,"authors":["Alan M. Cleary","Joseph Winjum","Jordan Dood","Shunsuke Inenaga"],"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 $o(n)$ space for a copy of the string $T$ being indexed, where $n=|T|$. 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 $\\mathcal{O}(\\text{ra}(m)+\\text{occ})$ time while requiring only $\\mathcal{O}(\\text{er}(T))$ additional space, where $m$ is the length of the pattern, $\\text{ra}(m)$ is the grammar random access time, $\\text{occ}$ is the number of occurrences of the pattern in $T$, and $\\text{er}(T)$ is the number of right-extensions of the maximal repeats in $T$. 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 $\\mathcal{O}(\\text{er}(T))$ space asymptotic bound.","url_abs":"https://arxiv.org/abs/2407.08826v1","url_pdf":"https://arxiv.org/pdf/2407.08826v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"the-cdawg-index-and-pattern-matching-on","repo_url":"https://github.com/alancleary/cdawg-index-cfg","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":null,"mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}