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


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

Return a degree sequence for a tree with a powerlaw 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


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).