We present an algorithm that, given an index $t$, produces the $t$-th (lexicographically ordered) answer of an MSO query over a string. The algorithm requires linear-time preprocessing, and builds a data structure that answers each of these calls in logarithmic time. We then show how to extend this algorithm for a string that is compressed by a straight-line program (SLP), also with linear-time preprocessing in the (compressed encoding of the) string, and maintaining direct access in logtime of the original string. Lastly, we extend the algorithm by allowing complex edits on the SLP after the direct-access data structure has been processsed, which are translated into the data structure in logtime. We do this by adapting a document editing framework introduced by Schmid and Schweikardt (PODS 2022). This work improves on a recent result of dynamic direct access of MSO queries over strings (Bourhis et. al., ICDT 2025) by a log-factor on the access procedure, and by extending the results to SLPs.
翻译:本文提出一种算法,给定索引$t$,可生成字符串上MSO查询的第$t$个(按字典序排列)结果。该算法需要线性时间预处理,并构建一个能在对数时间内响应每次查询的数据结构。随后,我们将该算法扩展至通过直线式程序(SLP)压缩的字符串,在字符串的压缩编码上同样保持线性时间预处理,并在原始字符串的对数时间内维持直接访问能力。最后,我们通过引入Schmid与Schweikardt(PODS 2022)提出的文档编辑框架,使算法能够在直接访问数据结构构建后支持对SLP的复杂编辑操作,并以对数时间将这些编辑同步至数据结构。本工作改进了近期关于字符串上MSO查询动态直接访问的研究成果(Bourhis等人,ICDT 2025),将访问过程的时间复杂度降低了对数因子,并将结果扩展至SLP压缩字符串。