networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
extended_barabasi_albert_graph(n, m, p, q, seed=None)

An extended Barabási–Albert model graph is a random graph constructed using preferential attachment. The extended model allows new edges, rewired edges or new nodes. Based on the probabilities $p$ and $q$ with $p + q < 1$, the growing behavior of the graph is determined as:

  1. With $p$ probability, $m$ new edges are added to the graph,

starting from randomly chosen existing nodes and attached preferentially at the other end.

  1. With $q$ probability, $m$ existing edges are rewired

by randomly choosing an edge and rewiring one end to a preferentially chosen node.

  1. With $(1 - p - q)$ probability, $m$ new nodes are added to the graph

with edges attached preferentially.

When $p = q = 0$, the model behaves just like the Barabási–Alber model.

Parameters

n : int

Number of nodes

m : int

Number of edges with which a new node attaches to existing nodes

p : float

Probability value for adding an edge between existing nodes. p + q < 1

q : float

Probability value of rewiring of existing edges. p + q < 1

seed : integer, random_state, or None (default)

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

Raises

NetworkXError

If m does not satisfy 1 <= m < n or 1 >= p + q

Returns

G : Graph

Returns an extended Barabási–Albert model graph.

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#785
type: <class 'function'>
Commit: