Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.generators.random_graphs.extended_barabasi_albert_graph

extended_barabasi_albert_graph(n, m, p, q, seed=None)[source]

Returns an extended Barabási–Albert model graph.

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.

2) With \(q\) probability, \(m\) existing edges are rewired by randomly choosing an edge and rewiring one end to a preferentially chosen node.

3) 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 mo

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.
Returns:

G

Return type:

Graph

Raises:

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

References

[1]Albert, R., & Barabási, A. L. (2000) Topology of evolving networks: local events and universality Physical review letters, 85(24), 5234.