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:
- N
int Number of vertices.
- m1
int Number of edges attached by a new vertex, with probability
p.- m2
int Number of edges attached by a new vertex, with probability
1 - p.- p
float Probability of attaching
m1edges.
- N
- Returns:
- g
Graph The generated undirected graph.
- g
See also
price_networkPrice’s and Barabási-Albert’s preferential attachment
generate_extended_baPreferential attachment with rewiring
generate_holme_kimPreferential 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") <...>
Dual Barabási–Albert graph with \(N=200\), \(m_1=1\), \(m_2=3\), and \(p=0.5\).#