I am trying to generate a random graph that has small-world properties (exhibits a power law distribution). I just started using the networkx package and discovered that it offers a variety of random graph generation. Can someone tell me if it possible to generate a graph where a given node’s degree follows a gamma distribution (either in R or using python’s networkx package)?
I am trying to generate a random graph that has small-world properties (exhibits a
Share
If you want to use the configuration model something like this should work in NetworkX:
You might need to adjust the mean of the sequence z depending on parameters in the gamma distribution. Also z doesn’t need to be graphical (you’ll get a multigraph), but it does need an even sum so you might have to try a few random sequences (or add 1)…
The NetworkX documentation notes for configuration_model give another example, a reference and how to remove parallel edges and self loops:
Here is an example similar to the one at http://networkx.lanl.gov/examples/drawing/degree_histogram.html that makes a drawing including a graph layout of the largest connected component: