brainpy.connect.SmallWorld#

class brainpy.connect.SmallWorld(num_neighbor, prob, directed=False, include_self=False, seed=None)[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, seed=None)[source]#

Methods

__init__(num_neighbor, prob[, directed, ...])

build_conn()

build connections with certain data type.

build_coo()

Build a coo sparse connection data.

build_csr()

Build a csr sparse connection data.

build_mat()

Build a binary matrix connection data.

require(*structures)

Require all the connection data needed.

requires(*structures)

Require all the connection data needed.

Attributes

is_version2_style