- class brainpy.connect.SmallWorld(num_neighbor, prob, directed=False, include_self=False, seed=None, **kwargs)#
Build a Watts–Strogatz small-world graph.
First create a ring over \(num\_node\) nodes . 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\).
build connections with certain data type.
If users want to customize their connections, please provide one of the following functions:
build_mat(): build a matrix binary connection matrix.
build_csr(): build a csr sparse connection data.
build_coo(): build a coo sparse connection data.