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:
- N
int Number of vertices.
- m
intor iterable ofint(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_exp
float(optional, default:1) Exponent \(\alpha \ge 0\) of the degree. A
ValueErroris raised if it is negative.- aging_exp
float(optional, default:0) Exponent \(\beta\) of the age, usually negative.
- aging_bins
int(optional, default:300) Number of age bins.
- zero_deg_appeal
float(optional, default:1) Constant \(A_k\) of the degree term.
- zero_age_appeal
float(optional, default:0) Constant \(A_l\) of the age term.
- deg_coef
float(optional, default:1) Coefficient \(c_k\) of the degree term.
- age_coef
float(optional, default:1) Coefficient \(c_l\) of the age term.
- outpref
bool(optional, default:False) If
True, the edges created by a vertex also count in its degree.- directed
bool(optional, default:False) If
True, a directed graph is generated, with edges from the new vertices to the older ones.
- N
- Returns:
- g
Graph The generated multigraph.
- g
See also
price_networkPreferential attachment
generate_recent_degreePreferential 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") <...>
Preferential attachment graph with aging, with \(N=200\), \(m=1\), \(\beta=-1\), and the default values of the other parameters.#