generate_holme_kim

generate_holme_kim#

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

Generate a scale-free graph with tunable clustering, with the model of Holme and Kim.

Parameters:
Nint

Number of vertices.

mint

Number of edges attached by every new vertex.

pfloat

Probability of a triad formation step.

Returns:
gGraph

The generated undirected graph.

See also

price_network

Price’s and Barabási-Albert’s preferential attachment

generate_dual_ba

Preferential attachment with two numbers of edges

generate_extended_ba

Extended preferential attachment model

Notes

The graph starts with \(m\) isolated vertices, and every new vertex attaches \(m\) edges [holme-growing-2002]. The first goes to a vertex chosen with probability proportional to its degree (preferential attachment, where the \(m\) initial vertices have a weight equal to their degree plus one, so that the first new vertex attaches to all of them). Each of the remaining ones goes, with probability \(p\), to a uniformly chosen neighbor of the last preferentially chosen vertex (triad formation), among those not yet adjacent to the new vertex, and otherwise, or if there is no such neighbor, to a vertex chosen by preferential attachment, which becomes the last preferentially chosen vertex. The preferential choices are restricted to the vertices not yet adjacent to the new vertex, by rejection. Every new vertex receives exactly \(m\) distinct neighbors, so that the graph has \(m(N-m)\) edges. The degree distribution follows a power law with exponent 3, and the clustering coefficient increases with \(p\). The algorithm runs in time \(O(N m \langle k\rangle)\).

References

[holme-growing-2002]

Petter Holme and Beom Jun Kim, “Growing scale-free networks with tunable clustering”, Physical Review E 65, 026107 (2002), DOI: 10.1103/PhysRevE.65.026107 [sci-hub, @tor], arXiv: cond-mat/0110452

Examples

>>> g = gt.generate_holme_kim(10000, 3, 0.9)
>>> print(g.num_edges(), gt.global_clustering(g)[0])
29991 0.10912...

A smaller instance is drawn as follows:

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

Holme–Kim graph with \(N=200\), \(m=2\), and \(p=0.9\).#