pythonrandomdistributionigraphgeometric-mean

Geometric distribution values in Forest Fire generation model


I am trying to do implementation (Python) of the Forest Fire graph generation algorithm (http://cs.stanford.edu/~jure/pubs/powergrowth-kdd05.pdf).

Here is how pseudo-code looks like: pseudo-code of FF model The problem I am having with is understanding the second step. How to generate these numbers?

There is an implementation in numpy library https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.geometric.html but it requires not just p value but also size (size of what in case of this algorithm? Why in the algorithms are given geometric means, why not just p value?)

I found one solution here https://stackoverflow.com/a/9083170/7127824 but I am not sure it works right (according to the needs of this algorithm)

Any suggestions?


Solution

  • numpy.random.geometric(p / (1 - p))