Regular#
- class braintools.conn.Regular(degree, weight=None, delay=None, **kwargs)#
Regular network where all neurons have the same degree.
This class creates a regular random network where every node has exactly the same number of outgoing connections (out-degree). The targets for each node are chosen randomly without replacement, excluding self-connections. This topology is useful for creating homogeneous networks where all neurons have equal influence.
Regular networks provide a baseline for comparing other network topologies and are particularly useful in studies of network dynamics where uniform connectivity is desired. Unlike regular lattices (e.g., ring or grid), connections are random rather than following a spatial pattern.
- Parameters:
degree (
int) – Number of outgoing connections per neuron. Must be less than the network size (since self-connections are excluded). All neurons will have exactly this many outgoing connections, creating a perfectly regular out-degree distribution.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)
All nodes have the same out-degree (number of outgoing connections)
In-degree (incoming connections) may vary across nodes
Self-connections are automatically excluded
The total number of connections is exactly n * degree, where n is the network size
Targets are selected randomly without replacement for each source neuron
Examples
Create a regular network where each neuron connects to 10 others:
>>> import brainunit as u >>> from braintools.conn import Regular >>> reg = Regular(degree=10, weight=1.0 * u.nS) >>> result = reg(pre_size=1000, post_size=1000)
Create a regular network with delays:
>>> reg = Regular(degree=20, weight=0.8 * u.nS, delay=2.0 * u.ms) >>> result = reg(pre_size=500, post_size=500)
Use with a custom weight initializer:
>>> from braintools.init import Normal >>> reg = Regular(degree=15, weight=Normal(mean=1.0, std=0.2)) >>> result = reg(pre_size=1000, post_size=1000)