networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
dual_barabasi_albert_graph(n, m1, m2, p, seed=None, initial_graph=None)

A graph of $n$ nodes is grown by attaching new nodes each with either $m_1$ edges (with probability $p$) or $m_2$ edges (with probability $1-p$) that are preferentially attached to existing nodes with high degree.

Parameters

n : int

Number of nodes

m1 : int

Number of edges to link each new node to existing nodes with probability $p$

m2 : int

Number of edges to link each new node to existing nodes with probability $1-p$

p : float

The probability of attaching $m_1$ edges (as opposed to $m_2$ edges)

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

initial_graph : Graph or None (default)

Initial network for Barabási–Albert algorithm. A copy of :None:None:`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.

Raises

NetworkXError

If :None:None:`m1` and :None:None:`m2` do not satisfy 1 <= m1,m2 < n , or p does not satisfy 0 <= p <= 1 , or the initial graph number of nodes m0 does not satisfy m1, m2 <= m0 <= n.

Returns

G : Graph

Returns a random graph using dual Barabási–Albert preferential attachment

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/generators/random_graphs.py#686
type: <class 'function'>
Commit: