Skip to content
Contains methods to uniformly sample graphs with a given degree sequence.
Jupyter Notebook HTML JavaScript Python CSS
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Double Edge Swap MCMC Graph Sampler

What is it?

For a fixed degree sequence and a given graph space, a configuration model is a uniform distribution of graphs with that degree sequence in that space. This code package implements Markov chain Monte Carlo methods to sample from configuration models, as discussed in the associated paper [1]. Given an input graph (and its implicit degree sequence), these methods can sample graphs from the configuration model on the space of (either stub or vertex-labeled): simple graphs, loopy graphs, multigraphs or loopy multigraphs.

[1] Bailey K. Fosdick, Daniel B. Larremore, Joel Nishimura, Johan Ugander (2018) Configuring Random Graph Models with Fixed Degree Sequences. SIAM Review 60(2):315–355. (SIAM version, arXiv version).

How to Cite

If this code is utilized in work contributing to an academic publication please cite the associated paper [1].


  • dbl_edge_doc.pdf
  • dbl_edge_worksheet.ipynb (Jupyter Notebook demonstration)
  • geomnet_edgelist
  • /output
  • /verification
  • /html_doc


Please see the documentation available in either 'html_doc/index.hmtl' or 'dbl_edge_doc.pdf’. Alternatively, jump immediately into ‘dbl_edge_worksheet.ipynb’.


This package utilizes Python 2.7.x, Numba 0.24.0, Numpy, Scipy, Networkx, and Pylab. The tutorial script runs in Jupyter. Note that this packages are currently included in the Anaconda distribution of python 2.7, available at Failure to load Numba will negatively impact performance, but should not affect output.


Simply import desired python modules into an instance of Python 2.7.x.


  • 8/9/2016 v.1 Renamed some functions and variables for added clarity.
  • 8/1/2016 v.1 More documentation added.
  • 7/29/2016 v.1 Additional documentation added.
  • 7/23/2016 v.1 iPython worksheet added.


  • Bailey K. Fosdick, Department of Statistics, Colorado State University, Ft. Collins, CO 80523 USA (bailey [at]
  • Daniel B. Larremore, Santa Fe Institute, 1399 Hyde Park Rd. Sante Fe, NM, 87501 USA (larremore [at]
  • Joel Nishimura, School of Mathematical and Natural Sciences, Arizona State University, Glendale, AZ 85306 USA (joel.nishimura [at]
  • Johan Ugander, Management Science & Engineering, Stanford University, Stanford, CA, 94305 USA (jugander [at]


Please direct questions and bug reports to joel.nishimura [at]

You can’t perform that action at this time.