, Volume 58, Issue 4, pp 860–910 | Cite as

A Sequential Algorithm for Generating Random Graphs



We present a nearly-linear time algorithm for counting and randomly generating simple graphs with a given degree sequence in a certain range. For degree sequence (di)i=1n with maximum degree dmax =O(m1/4−τ), our algorithm generates almost uniform random graphs with that degree sequence in time O(mdmax ) where \(m=\frac{1}{2}\sum_{i}d_{i}\) is the number of edges in the graph and τ is any positive constant. The fastest known algorithm for uniform generation of these graphs (McKay and Wormald in J. Algorithms 11(1):52–67, 1990) has a running time of O(m2dmax 2). Our method also gives an independent proof of McKay’s estimate (McKay in Ars Combinatoria A 19:15–25, 1985) for the number of such graphs.

We also use sequential importance sampling to derive fully Polynomial-time Randomized Approximation Schemes (FPRAS) for counting and uniformly generating random graphs for the same range of dmax =O(m1/4−τ).

Moreover, we show that for d=O(n1/2−τ), our algorithm can generate an asymptotically uniform d-regular graph. Our results improve the previous bound of d=O(n1/3−τ) due to Kim and Vu (Adv. Math. 188:444–469, 2004) for regular graphs.


Random graphs Sequential importance sampling FPRAS 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alderson, D., Doyle, J., Willinger, W.: Toward and optimization-driven framework for designing and generating realistic Internet topologies. HotNets (2002) Google Scholar
  2. 2.
    Alon, N., Spencer, J.: The Probabilistic Method. Wiley, New York (1992) MATHGoogle Scholar
  3. 3.
    Amraoui, A., Montanari, A., Urbanke, R.: How to find good finite-length codes: from art towards science. Preprint, cs.IT/0607064 (2006)
  4. 4.
    Bassetti, F., Diaconis, P.: Examples comparing importance sampling and the Metropolis algorithm (2005) Google Scholar
  5. 5.
    Bayati, M., Montanari, A., Saberi, A.: Generating random graphs with large girth. In: ACM-SIAM Symposium on Discrete Algorithms (SODA) (2009) Google Scholar
  6. 6.
    Bender, E.A., Canfield, E.R.: The asymptotic number of labeled graphs with given degree sequence. J. Comb. Theory Ser. A 24(3), 296–307 (1978) MATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Bezáková, I., Bhatnagar, N., Vigoda, E.: Sampling binary contingency tables with a greedy start. In: Symposium on Discrete Algorithms (SODA) (2006) Google Scholar
  8. 8.
    Bezáková, I., Sinclair, A., S̆tefankovič, D., Vigoda, E.: Negative examples for sequential importance sampling of binary contingency tables. In: Proceedings of Annual European Symposium, vol. 14. Lecture Notes in Computer Science, vol. 4168, pp. 136–147. Springer, Berlin (2006) Google Scholar
  9. 9.
    Blanchet, J.: Efficient importance sampling for binary contingency tables. Ann. Appl. Probab. 19(3), 949–982 (2009) MATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Blitzstein, J., Diaconis, P.: A sequential importance sampling algorithm for generating random graphs with prescribed degrees. Ann. Appl. Probab. (2005, submitted) Google Scholar
  11. 11.
    Bollobás, B.: A probabilistic proof of an asymptotic formula for the number of labelled regular graphs. Eur. J. Comb. 1(4), 311–316 (1980) MATHGoogle Scholar
  12. 12.
    Bu, T., Towsley, D.: On distinguishing between Internet power law topology generator. In: INFOCOM (2002) Google Scholar
  13. 13.
    Chen, Y., Diaconis, P., Holmes, S., Liu, J.S.: Sequential Monte Carlo methods for statistical analysis of tables. J. Am. Stat. Assoc. 100, 109–120 (2005) MATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    Chung, F., Lu, L.: Connected components in random graphs with given expected degree sequence. Ann. Comb. 6(2), 125–145 (2002) MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Cooper, C., Dyer, M., Greenhill, C.: Sampling regular graphs and peer-to-peer network. Comb. Probab. Comput. 16 (2007) Google Scholar
  16. 16.
    Diaconis, P., Gangolli, A.: Rectangular arrays with fixed margins. In: Discrete Probability and Algorithms, Minneapolis, MN, 1993. IMA Volumes in Mathematics and Its Applications, vol. 72, pp. 15–41. Springer, New York (1995) Google Scholar
  17. 17.
    Faloutsos, M., Faloutsos, P., Faloutsos, C.: On power-law relationships of the Internet topology. In: SIGCOM (1999) Google Scholar
  18. 18.
    Gkantsidis, C., Mihail, M., Zegura, E.: The Markov chain simulation method for generating connected power law random graphs. Alenex (2003) Google Scholar
  19. 19.
    Jerrum, M., Sinclair, A.: Approximate counting, uniform generation and rapidly mixing Markov chains. Inf. Comput. 82(1), 93–133 (1989) MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Jerrum, M., Sinclair, A.: Fast uniform generation of regular graphs. Theor. Comput. Sci. 73(1), 91–100 (1990) MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Jerrum, M., Valiant, L., Vazirani, V.: Random generation of combinatorial structures from a uniform distribution. Theor. Comput. Sci. 43, 169–188 (1986) MATHCrossRefMathSciNetGoogle Scholar
  22. 22.
    Jerrum, M., Sinclair, A., McKay, B.: When is a graphical sequence stable? In: Random Graphs, Poznań, 1989, vol. 2, pp. 101–115. Wiley-Interscience, New York (1992) Google Scholar
  23. 23.
    Kannan, R., Tetali, P., Vempala, S.: Simple Markov chain algorithms for generating bipartite graphs and tournaments. Random Struct. Algorithms 14, 293–308 (1999) MATHCrossRefMathSciNetGoogle Scholar
  24. 24.
    Kim, J.H.: On Brooks’ theorem for sparse graphs. Comb. Probab. Comput. 4, 97–132 (1995) MATHCrossRefGoogle Scholar
  25. 25.
    Kim, J.H., Vu, V.H.: Concentration of multivariate polynomials and its applications. Combinatorica 20(3), 417–434 (2000) MATHCrossRefMathSciNetGoogle Scholar
  26. 26.
    Kim, J.H., Vu, V.H.: Generating random regular graphs. In: STOC 2003, pp. 213–222 Google Scholar
  27. 27.
    Kim, J.H., Vu, V.: Sandwiching random graphs. Adv. Math. 188, 444–469 (2004) MATHCrossRefMathSciNetGoogle Scholar
  28. 28.
    Knuth, D.: Mathematics and computer science: coping with finiteness. Science 194(4271), 1235–1242 (1976) CrossRefMathSciNetGoogle Scholar
  29. 29.
    McKay, B.: Asymptotics for symmetric 0-1 matrices with prescribed row sums. Ars Combinatoria A 19, 15–25 (1985) MathSciNetGoogle Scholar
  30. 30.
    McKay, B., Wormald, N.C.: Uniform generation of random regular graphs of moderate degree. J. Algorithms 11(1), 52–67 (1990) MATHCrossRefMathSciNetGoogle Scholar
  31. 31.
    McKay, B., Wormald, N.C.: Asymptotic enumeration by degree sequence of graphs with degrees o(n 1/2). Combinatorica 11(4), 369–382 (1991) MATHCrossRefMathSciNetGoogle Scholar
  32. 32.
    Medina, A., Matta, I., Byers, J.: On the origin of power laws in Internet topologies. ACM Comput. Commun. Rev. 30(2), 18–28 (2000) CrossRefGoogle Scholar
  33. 33.
    Milo, R., ShenOrr, S., Itzkovitz, S., Kashtan, N., Chklovskii, D., Alon, U.: Network motifs: simple building blocks of complex networks. Science 298, 824–827 (2002) CrossRefGoogle Scholar
  34. 34.
    Milo, R., Kashtan, N., Itzkovitz, S., Newman, M., Alon, U.: On the uniform generation of random graphs with prescribed degree sequences. (2004)
  35. 35.
    Molloy, M., Reed, B.: A critical point for random graphs with a given degree sequence. Random Struct. Algorithms 6(2–3), 161–179 (1995) MATHMathSciNetGoogle Scholar
  36. 36.
    Sinclair, A.: Personal communication (2006) Google Scholar
  37. 37.
    Steger, A., Wormald, N.C.: Generating random regular graphs quickly. Comb. Probab. Comput. 8(4), 377–396 (1997) (English summary in Random Graphs and Combinatorial Structures, Oberwolfach) CrossRefMathSciNetGoogle Scholar
  38. 38.
    Tangmunarunkit, H., Govindan, R., Jamin, S., Shenker, S., Willinger, W.: Network topology generators: degree based vs. structural. In: ACM SIGCOM (2002) Google Scholar
  39. 39.
    Vu, V.H.: Concentration of non-Lipschitz functions and applications, Probabilistic methods in combinatorial optimization. Random Struct. Algorithms 20(3), 267–316 (2002) CrossRefMathSciNetGoogle Scholar
  40. 40.
    Wormald, N.C.: Models of random regular graphs. In: Surveys in Combinatorics. Canterbury. London Mathematical Society Lecture Note Series, vol. 265, pp. 239–298. Cambridge University Press, Cambridge (1999) Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2009

Authors and Affiliations

  1. 1.Department of Electrical EngineeringStanford UniversityStanfordUSA
  2. 2.Department of MathematicsYonsei UniversityYonseiSouth Korea
  3. 3.Departments of Management Science and Engineering, Institute for Computational and Mathematical EngineeringStanford UniversityStanfordUSA

Personalised recommendations