jaxley.connect.sparse_connect#
- sparse_connect(pre_cell_view, post_cell_view, synapse_type, p, random_post_comp=False)[source]#
Sparsely (densely) connect cells of a network with synapses.
Connections are from branch 0 location 0 of the pre-synaptic cell to branch 0 location 0 of the post-synaptic cell unless random_post_comp=True.
NOTE: This function does not generate sparse random connectivity with random graph generation methodology, cells may be connected multiple times and p=1.0 does not fully connect.
- Parameters:
Example usage#
The following example insert approximately 6 synapses (3 x 4 = 12 possible synapses, with connection probability 0.5).
from jaxley.connect import sparse_connect from jaxley.synapses import IonotropicSynapse net = jx.Network([cell for _ in range(10)]) sparse_connect( net.cell([0, 1, 2]), net.cell([3, 4, 5, 6]), IonotropicSynapse(), p=0.5, ) print(net.edges)