Generating random graphs with arbitrary specified degree distribution

"Rui Carvalho" <rui.carvalho(a)> writes:


I'd like to use graph-tool to generate random graphs obeying example
(d) from Newman et al., PRE 64, 026118.

Basically, there are 1000 people and each person knows between zero
and five others, the number of people in each category being from zero
to five:{86,150,363,238,109,54} -this is the histogram.

Can I use graph-tool to generate graphs with this pdf a la Newman et
al.? Did I miss an example in the documentation detailing how to do

Also can I use graph tool to generate random graphs *exactly* with
this degree sequence as in the configurational model?

With graph-tool you can specify the sampling function for the degrees,
so you could (inside your function) simply sample one degree from each
bucket, and subtract from one from it, and stop when it's empty. This
implies also that you could supply a function which "samples" in a
specific sequence, and thus achieves what you asked for in the second

For details on how to implement this see this part of the documentation:


Hi Tiago,

The reason why I want to do this is I have a "real world" network and would
like to benchmark it against random networks. I had a look at the
documentation and it didn't seem oriented towards this task -correct me if
I'm wrong, but it sounds too difficult?

I'm not sure whether this would be of interest to others, but if the answer
would be yes, than perhaps we could have it easier in a future release? Or
maybe I'm just missing the point -anyway, graph-tool is a great program :slight_smile:


Behalf Of Tiago de Paula Peixoto