Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

networkx.generators.directed.scale_free_graph

scale_free_graph(n, alpha=0.41, beta=0.54, gamma=0.05, delta_in=0.2, delta_out=0, create_using=None, seed=None)[source]

Returns a scale-free directed graph.

Parameters
ninteger

Number of nodes in graph

alphafloat

Probability for adding a new node connected to an existing node chosen randomly according to the in-degree distribution.

betafloat

Probability for adding an edge between two existing nodes. One existing node is chosen randomly according the in-degree distribution and the other chosen randomly according to the out-degree distribution.

gammafloat

Probability for adding a new node connected to an existing node chosen randomly according to the out-degree distribution.

delta_infloat

Bias for choosing nodes from in-degree distribution.

delta_outfloat

Bias for choosing nodes from out-degree distribution.

create_usingNetworkX graph constructor, optional

The default is a MultiDiGraph 3-cycle. If a graph instance, use it without clearing first. If a graph constructor, call it to construct an empty graph.

seedinteger, random_state, or None (default)

Indicator of random number generation state. See Randomness.

Notes

The sum of alpha, beta, and gamma must be 1.

References

1

B. Bollobás, C. Borgs, J. Chayes, and O. Riordan, Directed scale-free graphs, Proceedings of the fourteenth annual ACM-SIAM Symposium on Discrete Algorithms, 132–139, 2003.

Examples

Create a scale-free graph on one hundred nodes:

>>> G = nx.scale_free_graph(100)