NetworkX

Previous topic

networkx.random_powerlaw_tree

Next topic

networkx.configuration_model

networkx.random_powerlaw_tree_sequence

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

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

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