JOURNAL OF ALGORITHMS 11, 52-67 (1990) Uniform Generation of Random Regular Graphs of Moderate Degree BRENDAN D. MCKAY Computer Science Department, Australian National University, G.P.O. Box 4, ACT 2601, Australia AND NICHOLASC.WORMALD Department of Mathematics and Statistics, University of Aucklancl, Private Bag, Auckland, New Zealand Received August 17,1988; revised March 7,1989 We show how to generate k-regular graphs on n vertices uniformly at random in expected time 0( nk3), provided k = O(n113). The algorithm employs a modifica- tion of a switching argument previously used to count such graphs asymptotically for k = o(nā/ā). The asymptotic formula is re-derived, using the new switching argument. The method is applied also to graphs with given degree sequences, provided certain conditions are met. In particular, it applies if the maximum degree is 0( IE( G)1ā4). The method is ako applied to bipartite graphs. 6 1990 Academic Press, Inc. 1. INTRODUCTION Random regular graphs have come under ever increasing scrutiny in recent years. However, it is not easy to generate k-regular graphs on n vertices uniformly at random. It is known how to do this for small k in expected time O(e k2ā2nk) per graph, using a procedure which does not necessarily terminate (see Wormald [5] or BolIobh [l]); but even for k = log n this is not polynomial expected time. If one insists on an algorithm which always terminates, the picture is even worse; it can be done [5] for k = 3 and 4 but aheady the algorithm is very complicated. On the other hand, one can slacken the uniformity constraint slightly and ask for an almost uniform probability distribution. Sinclair and Jerrum [4] were 52 0196-6774/N $3.00 Copyright 0 1990 by Academic Press. Inc. All rights of reproduction in any form reserved.