The BEST theorem, due to de Bruijn, van Aardenne-Ehrenfest, Smith, and Tutte, is a classical tool from graph theory that links the Eulerian trails in a directed graph $G=(V,E)$ with the arborescences in $G$. In particular, one can use the BEST theorem to count the Eulerian trails in $G$ in polynomial time. For enumerating the Eulerian trails in $G$, one could naturally resort to first enumerating the arborescences in $G$ and then exploiting the insight of the BEST theorem to enumerate the Eulerian trails in $G$: every arborescence in $G$ corresponds to at least one Eulerian trail in $G$. For over two decades, the fastest algorithm for enumerating arborescences in $G$ took $O(m\log n + n + z_A \log^2 n)$ time, where $n=|V|$, $m=|E|$, and $z_A$ is the number of arborescences in $G$ [Uno, ISAAC 1998]. Since Uno's algorithm does not lead to an optimal enumeration of Eulerian trails in directed graphs, we were motivated to develop a direct algorithm for this problem. Our central contribution is a remarkably simple algorithm to directly enumerate the $z_T$ Eulerian trails in $G$ in the optimal $O(m + z_T)$ time. As a consequence, our result improves on an implementation of the BEST theorem for counting Eulerian trails in $G$ when $z_T=o(n^2)$, and also unconditionally improves the combinatorial $O(m\cdot z_T)$-time algorithm of Conte et al. [FCT 2021] for the same task. Moreover, we show that, with some care, our algorithm can be extended to enumerate Eulerian trails in directed multigraphs in optimal time, enabling applications in bioinformatics and data privacy.
翻译:BEST定理(由de Bruijn、van Aardenne-Ehrenfest、Smith和Tutte提出)是图论中的经典工具,它将有向图$G=(V,E)$中的欧拉迹与$G$中的树形图联系起来。特别地,利用BEST定理可以在多项式时间内计算$G$中欧拉迹的数量。若要枚举$G$中的欧拉迹,自然可以先枚举$G$中的树形图,再借助BEST定理的洞见完成枚举:$G$中的每个树形图至少对应一条欧拉迹。二十多年来,枚举$G$中树形图的最快算法需要$O(m\log n + n + z_A \log^2 n)$时间,其中$n=|V|$,$m=|E|$,$z_A$为$G$中树形图的数量[Uno, ISAAC 1998]。由于Uno的算法未能实现有向图中欧拉迹的最优枚举,我们因此致力于为该问题设计直接算法。本文的核心贡献在于提出一种极为简洁的算法,能以最优的$O(m + z_T)$时间直接枚举$G$中的$z_T$条欧拉迹。这一结果改进了当$z_T=o(n^2)$时利用BEST定理计算$G$中欧拉迹数量的实现方案,并无条件地超越了Conte等人[FCT 2021]针对同一任务提出的$O(m\cdot z_T)$时间组合算法。此外,我们证明经过适当处理,该算法可扩展至有向多重图中欧拉迹的最优时间枚举,从而在生物信息学与数据隐私领域获得应用。