NetworkX

Previous topic

networkx.random_shell_graph

Next topic

networkx.random_powerlaw_tree_sequence

Quick search

networkx.random_powerlaw_tree

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

Return a tree with a powerlaw degree distribution.

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

Parameters:
  • n: the number of nodes
  • gamma: exponent of power law is gamma
  • tries: number of attempts to adjust sequence to make a tree
  • seed: seed for random number generator (default=None)