Enumerating Length-Bounded Simple Paths and Cycles in Directed Graphs with O(k(n+m)) Delay Using Edge-Consistent Node Barriers
Abstract
Enumerating simple paths and cycles subject to a given length bound is a fundamental problem in graph algorithms. Recent algorithms, namely BC-DFS (Peng et al. 2019, 2021) and CYCLE_SEARCH (Gupta and Suzumura 2021, arXiv:2105.10094v2), employ cached barrier values to prune fruitless searches. Both algorithms turn out to produce incomplete output, and their delay-bound arguments rely on flawed claims. For CYCLE_SEARCH this is known (arXiv:2512.08392); here we establish the analogous results for BC-DFS by exhibiting graphs on which paths are missed, by identifying the defect in its barrier-update procedure, and by refuting the monotonicity claim on which its delay-bound proof rests. As our main contribution, we introduce edge-consistency, a local invariant on barrier values analogous to heuristic consistency in informed search. It provides an incremental mechanism for maintaining admissible barrier estimates and yields concise correctness proofs. We use edge-consistency as a unifying framework for design and analysis of Bounded-Scope Depth-First Search (BS-DFS) --- a new algorithm for enumerating simple paths or cycles of length at most $k$ in a directed graph. For BS-DFS we prove a worst-case delay of at most $3(k+1)(n+m)$ elementary steps between consecutive events (start, each output, termination) and an amortized delay of at most $2(k+1)(n+m)$ steps per event, the $p$-th event being reached within $2p(k+1)(n+m)$ steps; both bounds are in $O(k(n+m))$. Barrier admissibility alone is not sufficient for the delay bound: for two variants with simpler barrier management, we exhibit a graph family forcing $\Omega(k^2(n+m))$ delay between outputs. Experiments on two families of random graphs confirm our findings, support the significance of the incompleteness result, and show that achieving completeness has modest empirical cost.