Las Vegas algorithms to generate universal cycles and de Bruijn sequences uniformly at random
Joe Sawada, Daniel Gabrić
TL;DR
This work delivers practical Las Vegas algorithms for uniformly sampling universal cycles across diverse combinatorial families by leveraging random arborescences in Eulerian de Bruijn graphs. The core method seeds a random edge, builds a random arborescence, orients bridges accordingly, and traverses to produce a random Euler cycle with constant-time per-symbol output and linear-space storage of the graph. The authors apply the framework to shorthand permutations, subsets, multiset permutations, weak orders, and several de Bruijn-related ensembles (including weight-range and forbidden-substring variants) and provide extensive experimental data on cover times, along with public code. The results demonstrate the feasibility of uniform random generation for these complex objects and offer insights into performance trade-offs and practical implementations. These contributions facilitate unbiased sampling for universal cycles and related sequences, with implications for combinatorial enumeration and randomized constructions.
Abstract
We present practical algorithms for generating universal cycles uniformly at random. In particular, we consider universal cycles for shorthand permutations, subsets and multiset permutations, weak orders, and orientable sequences. Additionally, we consider de Bruijn sequences, weight-range de Bruin sequences, and de Bruijn sequences, with forbidden $0^z$ substring. Each algorithm, seeded with a random element from the given set, applies a random walk of an underlying Eulerian de Bruijn graph to obtain a random arborescence (spanning in-tree). Given the random arborescence and the de Bruijn graph, a corresponding random universal cycle can be generated in constant time per symbol. We present experimental results on the average cover time needed to compute a random arborescence for each object using a Las Vegas algorithm.
