NetworkX

Previous topic

networkx.powerlaw_cluster_graph

Next topic

networkx.random_shell_graph

Quick search

networkx.random_lobster

random_lobster(n, p1, p2, seed=None)

Return a random lobster.

A caterpillar is a tree that reduces to a path graph when pruning all leaf nodes (p2=0). A lobster is a tree that reduces to a caterpillar when pruning all leaf nodes.
Parameters:
  • n: the expected number of nodes in the backbone
  • p1: probability of adding an edge to the backbone
  • p2: probability of adding an edge one level beyond backbone
  • seed: seed for random number generator (default=None)