Generating pivot Gray codes for spanning trees of complete graphs in constant amortized time
Bowie Liu, Dennis Wong, Chan-Tong Lam, Sio-Kei Im
Abstract
We present the first known pivot Gray code for spanning trees of complete graphs, listing all spanning trees such that consecutive trees differ by pivoting a single edge around a vertex. This pivot Gray code thus addresses an open problem posed by Knuth in The Art of Computer Programming, Volume 4 (Exercise 101, Section 7.2.1.6, [Knuth 2011]), rated at a difficulty level of 46 out of 50, and imposes stricter conditions than existing revolving-door or edge-exchange Gray codes for spanning trees of complete graphs. Our recursive algorithm generates each spanning tree in constant amortized time using space. In addition, we provide a novel proof of Cayley’s formula, , for the number of spanning trees in a complete graph, derived from our recursive approach. We extend the algorithm to generate edge-exchange Gray codes for general graphs with vertices, achieving time per tree using space. For specific graph classes, the algorithm can be optimized to generate edge-exchange Gray codes for spanning trees in constant amortized time per tree for complete bipartite graphs, -amortized time per tree for fan graphs, and -amortized time per tree for wheel graphs, all using space.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Builds on1
Related papers
- Efficient generation of elimination trees and graph associahedraJean Cardinal, Arturo Merino, Torsten MützeSODA 2022 · 9 citations
- Combinatorial generation via permutation languagesElizabeth J. Hartung, Hung Phuc Hoang, Torsten Mütze, Aaron WilliamsSODA 2020 · 22 citations
- Zigzagging through acyclic orientations of chordal graphs and hypergraphsJean Cardinal, Hung Phuc Hoang, Arturo Merino, Torsten MützeSODA 2023 · 3 citations
- Faster (Δ+1)-Edge Coloring: Breaking the m√n Time BarrierSayan Bhattacharya, Din Carmon, Martín Costa, Shay Solomon et al.FOCS 2024 · 5 citations
- More Than Pivot for Maximal Clique EnumerationZhaoyi Zhong, Rui Zhou, Lu Chen, Xiaofan Li et al.ICDE 2026
