NetworkX

Previous topic

networkx.generators.random_graphs.random_shell_graph

Next topic

networkx.generators.random_graphs.random_powerlaw_tree_sequence

networkx.generators.random_graphs.random_powerlaw_tree

random_powerlaw_tree(n, gamma=3, create_using=None, seed=None, tries=100)

Return a tree with a powerlaw degree distribution.

Parameters:

n : int,

The number of nodes

gamma : float

Exponent of the power-law

create_using : graph, optional (default Graph)

The graph instance used to build the graph.

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