generate_gnc

Contents

generate_gnc#

graph_tool.generation.generate_gnc(N)[git][source]#

Generate a directed acyclic graph with the growing network with copying (GNC) model.

Parameters:
Nint

Number of vertices.

Returns:
gGraph

The generated directed acyclic graph.

See also

generate_gn

Growing network

generate_gnr

Growing network with redirection

generate_forest_fire

Forest fire model

Notes

In the model of Krapivsky and Redner [krapivsky-network-2005], every new vertex chooses an existing vertex uniformly at random, and links to it and to all its targets. The algorithm runs in time \(O(N + E)\).

References

[krapivsky-network-2005]

P. L. Krapivsky and S. Redner, “Network growth by copying”, Physical Review E 71, 036118 (2005), DOI: 10.1103/PhysRevE.71.036118 [sci-hub, @tor]

Examples

>>> g = gt.generate_gnc(10000)
>>> print(g.num_edges())
82812

A smaller instance is drawn as follows:

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

Growing network with copying (GNC) with \(N=60\), with the edges pointing from the newer to the older vertices.#