NetworkX

Previous topic

networkx.generators.random_graphs.watts_strogatz_graph

Next topic

networkx.generators.random_graphs.random_regular_graph

networkx.generators.random_graphs.connected_watts_strogatz_graph

networkx.generators.random_graphs.connected_watts_strogatz_graph(n, k, p, tries=100, create_using=None, seed=None)

Return a connected Watts-Strogatz small-world graph.

Attempt to generate a connected realization by repeated generation of Watts-Strogatz small-world graphs. An exception is raised if the maximum number of tries is exceeded.

Parameters :

n : int

The number of nodes

k : int

Each node is connected to k nearest neighbors in ring topology

p : float

The probability of rewiring each edge

tries : int

Number of attempts to generate a connected graph.

create_using : graph, optional (default Graph)

The graph instance used to build the graph.

seed : int, optional

The seed for random number generator.