Enumerating m-Length Walks in Directed Graphs with Constant Delay
Duncan Adamson, Pawel Gawrychowski, Florin Manea
TL;DR
We address the problem of enumerating all walks of length $m$ in a directed graph $G$ with $O(|E|)$ preprocessing and $O(1)$-delay between outputs. The approach introduces default edges and the default graph $D(G)$ to decompose walks into concatenations of default walks, allowing the current walk to be updated in constant time. The results extend to prefix-closed languages by representing strings as labeled walks in prefix-closed automata (PCA), achieving $O(|\mathcal{A}|)$-time preprocessing and $O(1)$-delay enumeration of strings of length $m$, with polynomial-time ranking and unranking. Together, these contributions yield constant-delay enumeration after linear preprocessing and apply to enumeration tasks such as crystal-structure representations and other combinatorial objects.
Abstract
In this paper, we provide a novel enumeration algorithm for the set of all walks of a given length within a directed graph. Our algorithm has worst-case constant delay between outputting succinct representations of such walks, after a preprocessing step requiring linear time relative to the size of the graph. We apply these results to the problem of enumerating succinct representations of the strings of a given length from a prefix-closed regular language (languages accepted by a finite automaton which has final states only).
