MSO Queries on Trees: Enumerating Answers under Updates Using Forest Algebras
Sarah Kleest-Meißner, Jonas Marasus, Matthias Niewerth
TL;DR
This paper tackles dynamic MSO query enumeration on unranked trees under local updates by introducing a forest-algebra representation of trees with height $O(\log n)$. It builds a linear-time preprocessing pipeline to construct a parse-tree balanced formula and develops rotation-based updates that preserve the log-height invariant, enabling $O(\log n)$ update times. The authors connect forest algebras to tree automata via transition algebras, enabling incremental Boolean evaluation and, crucially, logarithmic-delay enumeration of MSO results after updates. They extend the framework to MSO with free node variables using $k$-NFSTA and extended transition algebras, achieving $O(\log n)$-time restarts and $O(\log n)$-delay enumeration, with a pathway to further generalization to structures of bounded treewidth. The framework provides a principled algebraic approach for lifting static-tree MSO results to dynamic settings, offering both theoretical insight and potential practical impact for dynamic XML-like data and related tree-structured data systems.
Abstract
We describe a framework for maintaining forest algebra representations that are of logarithmic height for unranked trees. Such representations can be computed in O(n) time and updated in O(log(n)) time. The framework is of potential interest for data structures and algorithms for trees whose complexity depend on the depth of the tree (representation). We provide an exemplary application of the framework to the problem of efficiently enumerating answers to MSO-definable queries over trees which are subject to local updates. We exhibit an algorithm that uses an O(n) preprocessing phase and enumerates answers with O(log(n)) delay between them. When the tree is updated, the algorithm can avoid repeating expensive preprocessing and restart the enumeration phase within O(log(n)) time. Our algorithms and complexity results in the paper are presented in terms of node-selecting tree automata representing the MSO queries.
