How can I generate an Erdos-Renyi network which follows Possion distribution with random_graph function?

Dear Tiago,

I am trying to generate an Erdos-Renyi network like this:

import graph_tool.all as gt
import numpy.random as np

g = gt.random_graph(1000, deg_sampler=np.poisson(4), directed=False)

but it doesn't work out. Is anything I misunderstood in the documentation?
I am new in this field. Thanks for your help!

Best,
Liu

attachment.html (504 Bytes)

Dear Liu,
as per documentation, the second argument of random_graph takes a function,
passing np.poisson(4) is like passing one single value form that
distribution.
Try changing your code to:

g = gt.random_graph(1000, deg_sampler=lambda:np.poisson(4), directed=False)

and see if it works as intended.

Best,
Giuseppe

2014-04-17 15:30 GMT+02:00 Liu <boxiliu.hust(a)gmail.com>:

attachment.html (1.51 KB)