ScaleFree#
- class braintools.conn.ScaleFree(m=3, weight=None, delay=None, **kwargs)#
Barabási-Albert scale-free network with preferential attachment.
This class implements the Barabási-Albert model for generating scale-free networks, which exhibit a power-law degree distribution where P(k) ~ k^(-γ). The algorithm uses preferential attachment: new nodes preferentially connect to existing nodes with higher degree, following the principle of “rich get richer”.
Scale-free networks are ubiquitous in real-world systems including the Internet, social networks, protein interaction networks, and neural connectivity patterns in the brain. These networks are characterized by the presence of highly connected “hub” nodes and are remarkably robust to random failures but vulnerable to targeted attacks on hubs.
- Parameters:
m (
int) – Number of edges to attach from each new node to existing nodes. This parameter controls the minimum degree of nodes and affects the network density. Must be at least 1 and at most equal to the initial complete graph size. Higher values create denser networks with more connections.weight (
Initialization|float|int|ndarray|Array|Quantity|None) – Weight initialization for each connection. Can be a scalar value, array, or an Initializer instance for more complex initialization patterns. If None, no weights are generated.delay (
Initialization|float|int|ndarray|Array|Quantity|None) – Delay initialization for each connection. Can be a scalar value, array, or an Initializer instance for more complex initialization patterns. If None, no delays are generated.**kwargs – Additional keyword arguments passed to the parent PointConnectivity class, such as ‘seed’ for random number generation.
Notes
This connectivity pattern requires pre_size == post_size (recurrent connectivity)
The algorithm starts with a complete graph of max(m, 2) nodes
Connections are bidirectional (undirected network)
The resulting degree distribution follows approximately P(k) ~ k^(-3)
Average degree increases logarithmically with network size
The algorithm complexity is O(n*m) where n is the network size
References
Examples
Create a scale-free network with default parameters:
>>> import brainunit as u >>> from braintools.conn import ScaleFree >>> sf = ScaleFree(m=3, weight=1.0 * u.nS) >>> result = sf(pre_size=1000, post_size=1000)
Create a denser scale-free network with more attachments:
>>> sf = ScaleFree(m=5, weight=0.5 * u.nS, delay=1.5 * u.ms) >>> result = sf(pre_size=500, post_size=500)
Use with a custom weight initializer:
>>> from braintools.init import Uniform >>> sf = ScaleFree(m=4, weight=Uniform(min=0.5, max=2.0)) >>> result = sf(pre_size=1000, post_size=1000)