NetworkX

Previous topic

networkx.random_powerlaw_tree

Next topic

networkx.configuration_model

Quick search

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.

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)