generate_recent_degree

generate_recent_degree#

graph_tool.generation.generate_recent_degree(N, m, window, power=1, zero_appeal=1, outpref=False, directed=False)[git][source]#

Generate a multigraph by preferential attachment to the recently gained degree.

Parameters:
Nint

Number of vertices.

mint or iterable of int

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

windowint

Number of past steps in which the gained edges are counted.

powerfloat (optional, default: 1)

Exponent \(\alpha\) of the attachment kernel.

zero_appealfloat (optional, default: 1)

Attractiveness \(A > 0\) of vertices without recent edges.

outprefbool (optional, default: False)

If True, the edges created by a vertex also count as gained.

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_preferential_aging

Preferential attachment with aging

Notes

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

\[w_v = r_v^\alpha + A,\]

where \(r_v\) is the number of edges that \(v\) gained in the last window steps, i.e. that were attached to it by the vertices \(s - \text{window}, \dots, s - 1\) (and, with outpref=True, also the edges created by \(v\) itself, if it is one of them), and \(r_v^\alpha\) is taken to be zero for \(r_v = 0\). The algorithm runs in time \(O(Nm\log N)\).

Examples

>>> g = gt.generate_recent_degree(10000, 2, 100)
>>> print(g.num_edges(), g.degree_property_map("total").a.max())
19998 115

A smaller instance is drawn as follows:

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

Recent-degree preferential attachment graph with \(N=200\), \(m=1\), and a window of 20 steps.#