dual_barabasi_albert_graph#
- dual_barabasi_albert_graph(n, m1, m2, p, seed=None, initial_graph=None)[source]#
Returns a random graph using dual Barabási–Albert preferential attachment
A graph of
nodes is grown by attaching new nodes each with either edges (with probability ) or edges (with probability ) that are preferentially attached to existing nodes with high degree.- Parameters:
- nint
Number of nodes
- m1int
Number of edges to link each new node to existing nodes with probability
- m2int
Number of edges to link each new node to existing nodes with probability
- pfloat
The probability of attaching
edges (as opposed to edges)- seedinteger, random_state, or None (default)
Indicator of random number generation state. See Randomness.
- initial_graphGraph or None (default)
Initial network for Barabási–Albert algorithm. A copy of
initial_graph
is used. It should be connected for most use cases. If None, starts from an star graph on max(m1, m2) + 1 nodes.
- Returns:
- GGraph
- Raises:
- NetworkXError
If
m1
andm2
do not satisfy1 <= m1,m2 < n
, orp
does not satisfy0 <= p <= 1
, or the initial graph number of nodes m0 does not satisfy m1, m2 <= m0 <= n.
References
[1]Moshiri “The dual-Barabasi-Albert model”, arXiv:1810.10538.