English

Dynamic direct access of MSO query evaluation over strings

Databases 2024-09-27 v1 Data Structures and Algorithms Formal Languages and Automata Theory

Abstract

We study the problem of evaluating a Monadic Second Order (MSO) query over strings under updates in the setting of direct access. We present an algorithm that, given an MSO query with first-order free variables represented by an unambiguous variable-set automaton A\mathcal{A} with state set QQ and variables XX and a string ss, computes a data structure in time O(QωX2s)\mathcal{O}(|Q|^\omega\cdot |X|^2 \cdot |s|) and, then, given an index ii retrieves, using the data structure, the ii-th output of the evaluation of A\mathcal{A} over ss in time O(QωX3log(s)2)\mathcal{O}(|Q|^\omega \cdot |X|^3 \cdot \log(|s|)^2) where ω\omega is the exponent for matrix multiplication. Ours is the first efficient direct access algorithm for MSO query evaluation over strings; such algorithms so far had only been studied for first-order queries and conjunctive queries over relational data. Our algorithm gives the answers in lexicographic order where, in contrast to the setting of conjunctive queries, the order between variables can be freely chosen by the user without degrading the runtime. Moreover, our data structure can be updated efficiently after changes to the input string, allowing more powerful updates than in the enumeration literature, e.g.~efficient deletion of substrings, concatenation and splitting of strings, and cut-and-paste operations. Our approach combines a matrix representation of MSO queries and a novel data structure for dynamic word problems over semi-groups which yields an overall algorithm that is elegant and easy to formulate.

Keywords

Cite

@article{arxiv.2409.17329,
  title  = {Dynamic direct access of MSO query evaluation over strings},
  author = {Pierre Bourhis and Florent Capelli and Stefan Mengel and Cristian Riveros},
  journal= {arXiv preprint arXiv:2409.17329},
  year   = {2024}
}
R2 v1 2026-06-28T18:57:21.841Z