Table of Contents
Fetching ...

Optimal Enumeration of Eulerian Trails in Directed Graphs

Ben Bals, Solon P. Pissis, Matei Tinca

Abstract

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$. Instead, we take a simple and direct approach. Our central contribution is a remarkably simple algorithm to directly enumerate the $z_T$ Eulerian trails in $G$ in the \emph{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, in addition, it 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.

Optimal Enumeration of Eulerian Trails in Directed Graphs

Abstract

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 with the arborescences in . In particular, one can use the BEST theorem to count the Eulerian trails in in polynomial time. For enumerating the Eulerian trails in , one could naturally resort to first enumerating the arborescences in and then exploiting the insight of the BEST theorem to enumerate the Eulerian trails in : every arborescence in corresponds to at least one Eulerian trail in . Instead, we take a simple and direct approach. Our central contribution is a remarkably simple algorithm to directly enumerate the Eulerian trails in in the \emph{optimal} time. As a consequence, our result improves on an implementation of the BEST theorem for counting Eulerian trails in when , and, in addition, it unconditionally improves the combinatorial -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.
Paper Structure (23 sections, 18 theorems, 1 equation, 8 figures, 1 table, 1 algorithm)

This paper contains 23 sections, 18 theorems, 1 equation, 8 figures, 1 table, 1 algorithm.

Key Result

lemma 4.1

A state $s$ of $T^u$ is branching if and only if the last node on $P_{s}$ has at least two out-edges that are not crossings in $G'_{s}$.

Figures (8)

  • Figure 1: A directed graph, the arborescence rooted at node $a$, and the two Eulerian trails starting at $a$.
  • Figure 2: A directed graph and the uncompressed state tree encoding the two Eulerian trails starting at $a$. For readability, each state is only labeled with the last node on the prefix.
  • Figure 3: On the left, $P_{s}$ can be extended both by $v \to a$ and by $v\to b$ since both of these out-edges are non-crossing. On the right, $P_{s}$ can be extended only by $v \to a$. If instead we choose the crossing edge $v \to w$ first, the other edges from $\mathrm{SCC}(v)$ would not be reachable anymore.
  • Figure 4: The graph from \ref{['fig:uncompressed-tree']} after \ref{['rule:1']} has been applied exhaustively and the compressed state tree. Compare this smaller state tree to the one from \ref{['fig:uncompressed-tree']}.
  • Figure 5: For a state $s$ in the state tree, $P_{s}$ is some prefix of an Eulerian trail. On the left, notice that $v \to w$ is a crossing. Thus, $P_{s}$ can only be extended by first using the edges from $\mathrm{SCC}(v)$ and then using $v \to w$. In the state tree, displayed on the right, the state $s$ therefore only has a single child state.
  • ...and 3 more figures

Theorems & Definitions (29)

  • lemma 4.1
  • proof : Proof of \ref{['lem:crossings']}
  • lemma 4.2
  • proof
  • theorem 4.3
  • lemma 5.3
  • proof
  • lemma 5.4
  • proof
  • lemma 5.7
  • ...and 19 more