arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.05129cs.DS
收藏

通过划分精化对有限自动机进行排序

Sorting Finite Automata via Partition Refinement

Ruben Becker, Manuel Cáceres, Davide Cenzato, Sung-Hwan Kim, Bojana Kodric, Francisco Olivares, Nicola Prezza

AI总结:

本文针对有限自动机排序问题,通过扩展经典关系最粗划分精化算法,提出了$O(m\log n)$时间复杂度的WNFA共字典全预序与DFA最小宽度共字典偏序计算方法,效率显著优于现有算法且实用表现优异。

摘要:

Wheeler非确定有限自动机(WNFAs,Wheeler nondeterministic finite automata)是作为前缀排序从字符串到标记图的推广被提出的。WNFAs能为标记图和语言上的经典难题提供最优解。判定给定NFA是否为Wheeler的问题已被证明是NP完全的。然而,近期Alanko等人展示了通过切换到预序来规避这一复杂度的方法:设$Q$为状态集,$E$为转移集,$|Q|=n$,$|E|=m$,他们提出了一种时间复杂度为$O(mn^2)$的算法,用于计算WNFA状态的全序划分,该划分满足:(1) 等价状态识别相同的正则语言;(2) 当存在Wheeler序时,不等价状态的顺序与任意Wheeler序一致。其输出的状态预序在模式匹配中与标准Wheeler序同样有用。后续研究通过引入共字典偏预序将这些概念推广到任意NFA:任何NFA都存在一个状态的偏预序,该预序反映了其接受字符串的共字典序;这类预序的宽度越小,正则表达式匹配查询的执行速度就越快。截至目前,计算NFA上最小宽度偏预序的最快算法时间复杂度为$O(m^2+n^{5/2})$,而在DFA上完成相同任务的时间复杂度为$O(\n^2\log n,mn)$。在本文中,我们为上述问题提供了效率高得多的解决方案。我们的成果是通过将关系最粗划分精化问题的经典算法扩展到适用于有序划分而实现的。具体而言,我们提出了一种时间复杂度为$O(m\log n)$的算法,用于在输入为WNFA时计算共字典全预序,以及一种具有相同时间复杂度的算法,用于计算任意DFA的最小宽度共字典偏序。此外,我们还实现了所提出的算法,并证明它们在实践中非常高效。

英文摘要:

Wheeler nondeterministic finite automata (WNFAs) were introduced as a generalization of prefix sorting from strings to labeled graphs. WNFAs admit optimal solutions to classic hard problems on labeled graphs and languages. The problem of deciding whether a given NFA is Wheeler is known to be NP-complete. Recently, however, Alanko et al. showed how to side-step this complexity by switching to preorders: letting $Q$ be the set of states, $E$ the set of transitions, $|Q|=n$, and $|E|=m$, they provided a $O(mn^2)$-time algorithm computing a totally-ordered partition of the WNFA's states such that (1) equivalent states recognize the same regular language, and (2) the order of non-equivalent states is consistent with any Wheeler order, when one exists. Then, the output is a preorder of the states as useful for pattern matching as standard Wheeler orders. Further research generalized these concepts to arbitrary NFAs by introducing co-lex partial preorders: any NFA admits a partial preorder of its states reflecting the co-lex order of their accepted strings; the smaller the width of such preorder is, the faster regular expression matching queries can be performed. To date, the fastest algorithm for computing the smallest-width partial preorder on NFAs runs in $O(m^2+n^{5/2})$ time, while on DFAs the same can be done in $O(\min(n^2\log n,mn))$ time. In this paper, we provide much more efficient solutions to the problem above. Our results are achieved by extending a classic algorithm for the relational coarsest partition refinement problem to work with ordered partitions. Specifically, we provide a $O(m\log n)$-time algorithm computing a co-lex total preorder when the input is a WNFA, and an algorithm with the same time complexity computing the smallest-width co-lex partial order of any DFA. Also, we present implementations of our algorithms and show that they are very efficient in practice.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑