# brainpy.connect.SmallWorld#

class brainpy.connect.SmallWorld(num_neighbor, prob, directed=False, include_self=False)[source]#

Build a Watts–Strogatz small-world graph.

Parameters
• num_neighbor (int) – Each node is joined with its k nearest neighbors in a ring topology.

• prob (float) – The probability of rewiring each edge

• directed (bool) – Whether the graph is a directed graph.

• include_self (bool) – Whether include the node self.

Notes

First create a ring over $$num\_node$$ nodes 1. Then each node in the ring is joined to its $$num\_neighbor$$ nearest neighbors (or $$num\_neighbor - 1$$ neighbors if $$num\_neighbor$$ is odd). Then shortcuts are created by replacing some edges as follows: for each edge $$(u, v)$$ in the underlying “$$num\_node$$-ring with $$num\_neighbor$$ nearest neighbors” with probability $$prob$$ replace it with a new edge $$(u, w)$$ with uniformly random choice of existing node $$w$$.

References

1

Duncan J. Watts and Steven H. Strogatz, Collective dynamics of small-world networks, Nature, 393, pp. 440–442, 1998.

__init__(num_neighbor, prob, directed=False, include_self=False)[source]#

Methods

 __init__(num_neighbor, prob[, directed, ...]) build_conn() build connections with certain data type. check(structures) make_returns(structures, conn_data[, csr, ...]) Make the desired synaptic structures and return them. require(*structures) requires(*structures)