PowerLaw#
- class brainpy.connect.PowerLaw(m, p, directed=False, seed=None, **kwargs)[source]#
Holme and Kim algorithm for growing graphs with powerlaw degree distribution and approximate average clustering.
- Parameters:
Notes
The average clustering has a hard time getting above a certain cutoff that depends on \(m\). This cutoff is often quite low. The transitivity (fraction of triangles to possible triangles) seems to decrease with network size.
It is essentially the Barabási–Albert (BA) growth model with an extra step that each random edge is followed by a chance of making an edge to one of its neighbors too (and thus a triangle).
This algorithm improves on BA in the sense that it enables a higher average clustering to be attained if desired.
It seems possible to have a disconnected graph with this algorithm since the initial \(m\) nodes may not be all linked to a new node on the first iteration like the BA model.
- Raises:
ConnectorError – If \(m\) does not satisfy \(1 <= m <= n\) or \(p\) does not satisfy \(0 <= p <= 1\).
References
- build_mat(isOptimized=True)[source]#
Build a binary matrix connection data.
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.build_conn()
: deprecated.
- Returns:
conn – A binary matrix with the shape
(num_pre, num_post)
.- Return type: