Random Barabási–Albert network

random_barabasi_albert_graph[vert_type](n: int, m: int, random_state) undirected_network[vert_type]
template<integer_network_vertex VertT, std::uniform_random_bit_generator Gen>
undirected_network<VertT> random_barabasi_albert_graph(VertT n, VertT m, Gen &generator)

Generates a random Barabási–Albert network [3] of size n. \(n-m\) vertices are added one-by-one and each vertex is connected to \(m\) randomly selected existing vertices with probability proportional to their degrees. The initial “seed” of the network is a set of \(m\) isolated vertices.

The parameter m needs to be smaller than n and larger than or equal to 1, otherwise the function fails by raising a ValueError exception in Python or a std::invalid_argument exception in C++.

>>> import reticula as ret
>>> gen = ret.mersenne_twister(42)
>>> ret.random_barabasi_albert_graph[ret.int64](n=128, m=3, random_state=gen)
<undirected_network[int64] with 128 verts and 375 edges>