generate_gnr

Contents

generate_gnr#

graph_tool.generation.generate_gnr(N, p)[git][source]#

Generate a directed tree with the growing network with redirection (GNR) model.

Parameters:
Nint

Number of vertices.

pfloat

Redirection probability.

Returns:
gGraph

The generated directed tree, with edges pointing towards the root (vertex 0).

See also

generate_gn

Growing network

generate_gnc

Growing network with copying

price_network

Price’s model

Notes

In the model of Krapivsky and Redner [krapivsky-organization-2001], every new vertex chooses an existing vertex uniformly at random and, with probability \(p\), links to its (single) target instead, unless the chosen vertex is the root; otherwise, it links to the chosen vertex. The redirection is equivalent to linear preferential attachment with an offset, and leads to a power-law in-degree distribution with exponent \(1 + 1/p\). The algorithm runs in time \(O(N)\).

References

[krapivsky-organization-2001]

P. L. Krapivsky and S. Redner, “Organization of growing random networks”, Physical Review E 63, 066123 (2001), DOI: 10.1103/PhysRevE.63.066123 [sci-hub, @tor], arXiv: cond-mat/0011094

Examples

>>> g = gt.generate_gnr(10000, 0.5)
>>> print(g.get_in_degrees(g.get_vertices()).max())
193

A smaller instance is drawn as follows:

>>> g = gt.generate_gnr(200, 0.5)
>>> gt.graph_draw(g, pos=gt.sfdp_layout(g),
...               output="generate_gnr-small.pdf")
<...>
../_images/generate_gnr-small.png

Growing network with redirection (GNR) with \(N=200\) and \(p=0.5\), with the edges pointing towards the root.#