generate_preferential_aging

generate_preferential_aging#

graph_tool.generation.generate_preferential_aging(N, m=1, pa_exp=1, aging_exp=0, aging_bins=300, zero_deg_appeal=1, zero_age_appeal=0, deg_coef=1, age_coef=1, outpref=False, directed=False)[git][source]#

Generate a multigraph by preferential attachment with aging of the vertices.

Parameters:
Nint

Number of vertices.

mint or iterable of int (optional, default: 1)

Number of edges attached by every new vertex, or a sequence with this number for each vertex (the first value is ignored).

pa_expfloat (optional, default: 1)

Exponent \(\alpha \ge 0\) of the degree. A ValueError is raised if it is negative.

aging_expfloat (optional, default: 0)

Exponent \(\beta\) of the age, usually negative.

aging_binsint (optional, default: 300)

Number of age bins.

zero_deg_appealfloat (optional, default: 1)

Constant \(A_k\) of the degree term.

zero_age_appealfloat (optional, default: 0)

Constant \(A_l\) of the age term.

deg_coeffloat (optional, default: 1)

Coefficient \(c_k\) of the degree term.

age_coeffloat (optional, default: 1)

Coefficient \(c_l\) of the age term.

outprefbool (optional, default: False)

If True, the edges created by a vertex also count in its degree.

directedbool (optional, default: False)

If True, a directed graph is generated, with edges from the new vertices to the older ones.

Returns:
gGraph

The generated multigraph.

See also

price_network

Preferential attachment

generate_recent_degree

Preferential attachment to the recent degree

Notes

The graph starts with a single vertex, and every new vertex \(t\) attaches \(m\) edges to existing vertices \(v\), chosen independently (so that parallel edges may form) with probability proportional to

\[(c_kk_v^\alpha + A_k)(c_ll_v^\beta + A_l),\]

where \(k_v\) is the number of edges that \(v\) has received from newer vertices (its in-degree, for directed graphs), plus the number of edges it created, if outpref=True, with \(k_v^\alpha = 1\) for \(\alpha = 0\), and \(l_v = \lfloor (t - 1 - v)/w\rfloor + 1\) its age bin, for bins of width \(w = \lfloor N / n_b\rfloor + 1\), given the number \(n_b\) of bins. If all weights vanish, the vertex is chosen uniformly. This is the model of Dorogovtsev and Mendes [dorogovtsev-evolution-2000], in which, with the parametrization above, a power-law degree distribution is only obtained for \(\beta > -1\).

The algorithm runs in time \(O((N + E + N n_b)\log N)\).

References

[dorogovtsev-evolution-2000]

S. N. Dorogovtsev and J. F. F. Mendes, “Evolution of networks with aging of sites”, Physical Review E 62, 1842-1845 (2000), DOI: 10.1103/PhysRevE.62.1842 [sci-hub, @tor]

Examples

>>> g = gt.generate_preferential_aging(10000, 2, aging_exp=-1)
>>> print(g.num_edges(), g.degree_property_map("total").a.max())
19998 178

A smaller instance is drawn as follows:

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

Preferential attachment graph with aging, with \(N=200\), \(m=1\), \(\beta=-1\), and the default values of the other parameters.#