generate_dual_ba

generate_dual_ba#

graph_tool.generation.generate_dual_ba(N, m1, m2, p)[git][source]#

Generate a graph with the dual Barabási-Albert model.

Parameters:
Nint

Number of vertices.

m1int

Number of edges attached by a new vertex, with probability p.

m2int

Number of edges attached by a new vertex, with probability 1 - p.

pfloat

Probability of attaching m1 edges.

Returns:
gGraph

The generated undirected graph.

See also

price_network

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

generate_extended_ba

Preferential attachment with rewiring

generate_holme_kim

Preferential attachment with tunable clustering

Notes

The graph starts as a star with \(\max(m_1, m_2)\) leaves, and every new vertex attaches, with probability \(p\), \(m_1\) edges, or otherwise \(m_2\) edges, to distinct vertices chosen with probability proportional to their degrees, as in the Barabási–Albert model [moshiri-dual-2018]. The algorithm runs in time \(O(E)\).

References

[moshiri-dual-2018]

Niema Moshiri, “The dual-Barabási-Albert model”, arXiv: 1810.10538

Examples

>>> g = gt.generate_dual_ba(10000, 1, 5, 0.5)
>>> print(g.num_edges())
29767

A smaller instance is drawn as follows:

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

Dual Barabási–Albert graph with \(N=200\), \(m_1=1\), \(m_2=3\), and \(p=0.5\).#