CorePeripheryRandom#

class braintools.conn.CorePeripheryRandom(core_size, core_core_prob=0.5, core_periphery_prob=0.2, periphery_core_prob=0.2, periphery_periphery_prob=0.05, weight=None, delay=None, **kwargs)#

Core-periphery network with densely connected core and sparse periphery.

This class creates a network with a core-periphery structure [1] where a subset of nodes (the core) are densely interconnected, while the remaining nodes (the periphery) are sparsely connected to each other but maintain connections to the core. This architecture is common in brain networks [2], social networks, and infrastructure systems.

Core-periphery organization enables efficient information integration through the densely connected core while maintaining specialized processing in the periphery. The core acts as a hub for global communication and coordination, while peripheral nodes maintain local specialization.

Parameters:
  • core_size (int | float) – Size of the core. If int, specifies the exact number of core neurons. If float in (0, 1), specifies the proportion of neurons in the core. Core neurons are the first core_size neurons in the population.

  • core_core_prob (float) – Connection probability within the core (core→core). Higher values create a more densely connected core, which is characteristic of core-periphery networks.

  • core_periphery_prob (float) – Connection probability from core to periphery (core→periphery). This parameter controls how strongly core neurons project to periphery.

  • periphery_core_prob (float) – Connection probability from periphery to core (periphery→core). This parameter controls how periphery neurons feed back to core.

  • periphery_periphery_prob (float) – Connection probability within the periphery (periphery→periphery). Typically much lower than core_core_prob, creating sparse peripheral connectivity.

  • 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)

  • Core neurons are selected from the first core_size neurons (indices 0 to core_size-1)

  • Self-connections are automatically excluded

  • Core-periphery structure can be quantified using correlation measures

  • Typical parameter regime: core_core_prob >> core_periphery_prob ≈ periphery_core_prob > periphery_periphery_prob

  • Unlike the previous bidirectional parameter, now core→periphery and periphery→core probabilities are controlled independently for more flexibility

  • Core-periphery models follow [1]; the rich club of the connectome is described in [2].

  • Generation runs on the host with NumPy and cannot be traced by jax.jit, jax.vmap or jax.grad.

Changed in version 0.4.0: Each block of neuron pairs is sampled by drawing a binomial edge count and then that many distinct pairs, without a dense pre_size x post_size matrix, so time and memory grow with the number of edges. The edge set for a given seed differs from 0.3 (same distribution); edges are sorted by pre, then post index. Probabilities outside [0, 1] now raise ValueError (0.3 treated them as 0 or 1).

References

Examples

Create a core-periphery network with 20% core:

>>> import brainunit as u
>>> from braintools.conn import CorePeripheryRandom
>>> cp = CorePeripheryRandom(
...     core_size=0.2,
...     core_core_prob=0.5,
...     periphery_periphery_prob=0.05,
...     seed=0,
... )
>>> result = cp(pre_size=1000, post_size=1000)
>>> result.n_connections
115661

Create a network with fixed core size and asymmetric core-periphery connections:

>>> cp = CorePeripheryRandom(
...     core_size=100,
...     core_core_prob=0.6,
...     core_periphery_prob=0.25,      # Strong core→periphery
...     periphery_core_prob=0.15,      # Weaker periphery→core
...     periphery_periphery_prob=0.03,
...     weight=1.0 * u.nS,
...     delay=2.0 * u.ms
... )
>>> result = cp(pre_size=1000, post_size=1000)

Create a network with strong feedback from periphery to core:

>>> cp = CorePeripheryRandom(
...     core_size=0.15,
...     core_core_prob=0.7,
...     core_periphery_prob=0.2,
...     periphery_core_prob=0.3,       # Strong feedback
...     periphery_periphery_prob=0.02
... )
>>> result = cp(pre_size=800, post_size=800)

Use with custom weight initializer:

>>> from braintools.init import Normal
>>> cp = CorePeripheryRandom(
...     core_size=200,
...     core_core_prob=0.5,
...     weight=Normal(mean=1.0, std=0.2)
... )
>>> result = cp(pre_size=1000, post_size=1000)
generate(pre_size, post_size, pre_positions=None, post_positions=None, **kwargs)[source]#

Generate core-periphery network.

Return type:

ConnectionResult