Warning

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

random_powerlaw_tree

random_powerlaw_tree(n, gamma=3, seed=None, tries=100)[source]

Return a tree with a powerlaw degree distribution.

Parameters:

n : int,

The number of nodes

gamma : float

Exponent of the power-law

seed : int, optional

Seed for random number generator (default=None).

tries : int

Number of attempts to adjust sequence to make a tree

Notes

A trial powerlaw degree sequence is chosen and then elements are swapped with new elements from a powerlaw distribution until the sequence makes a tree (#edges=#nodes-1).