NetworkX

Previous topic

networkx.powerlaw_cluster_graph

Next topic

networkx.random_shell_graph

networkx.random_lobster

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

Return a random lobster.

A lobster is a tree that reduces to a caterpillar when pruning all leaf nodes.

A caterpillar is a tree that reduces to a path graph when pruning all leaf nodes (p2=0).

Parameters:

n : int

The expected number of nodes in the backbone

p1 : float

Probability of adding an edge to the backbone

p2 : float

Probability of adding an edge one level beyond backbone

create_using : graph, optional (default Graph)

The graph instance used to build the graph.

seed : int, optional

Seed for random number generator (default=None).