Expand description
§synaptic-wiring
The connectivity layer of a spiking neural network: which neuron connects to which, how strongly, and how long the spike takes to arrive. You bring the neuron model and the simulation loop; this crate wires the network and delivers each spike to the right target on the right tick.
Reach for it to generate biologically plausible topologies, give synapses
axonal delays, respect Dale’s law, or store a large sparse weight matrix
compactly — all deterministically, with serde and sha2 as the only
runtime dependencies.
§Where to start
topology::generate_small_world(orgenerate_random,generate_scale_free,generate_layered) to build aSynapticGraph, orSynapticGraph::from_descriptorsto specify every synapse yourself.SynapticMesh::newto wrap it, thenSynapticMesh::propagateonce per tick — its docs state the full delivery contract (destination, sign, magnitude, tick). Reuse a caller-owned buffer withSynapticMesh::propagate_intoandSynapticMesh::propagate_graded_intowhen a fixed-rate loop must avoid allocating every tick.topology::assign_delaysto rewrite a descriptor list’s delays from neuron positions, andtopology::apply_dale_polarityto compute a per-neuron excitatory/inhibitory split — both work on the inputs toSynapticGraph::from_descriptors, not on an already-built graph.SynapticGraph::topology_digest(orSynapticMesh::topology_digest) for a printable, versioned identifier of the logical graph, usable in manifests and cross-runtime comparisons.sparse::SparseSynapticMaporSynapticMesh::to_gpu_arrayswhen you need the weights as flat CSR arrays.router::ChannelRouteronly if you also want a sparse channel classifier; it is independent of the mesh and safe to ignore.
§Modules
| Module | Purpose |
|---|---|
topology | Network graph construction — CSR adjacency with delay & polarity metadata, deterministic generators (Erdős–Rényi, Watts–Strogatz, Barabási–Albert, layered), and a versioned TopologyDigest |
delay | Temporal delay infrastructure — ring-buffer spike queues for tick-aligned delivery with configurable axonal propagation delays |
mesh | SynapticMesh orchestrator — the top-level struct owning topology + delays, provides propagate() / propagate_into() for spike → current conversion |
sparse | Compressed Sparse Row (CSR) synaptic maps for GPU-optimized weight matrices |
router | Optional multi-channel classifier built on NeuromodNeuron, a router-internal integration primitive |
§Crate boundary
This crate owns connectivity and timing. Neuron models (LIF, Izhikevich,
Hodgkin-Huxley, …), learning rules, and training loops are deliberately
out of scope — pair it with whatever integrator you already use, or with a
dedicated crate such as neuromod, on which synaptic-wiring takes no
dependency so the two can evolve independently.
NeuromodNeuron is the one neuron-like type here: an integration
primitive internal to router::ChannelRouter, not a general-purpose
neuron model.
§Quick start
use synaptic_wiring::topology::generate_small_world;
use synaptic_wiring::mesh::SynapticMesh;
// Build a 256-neuron small-world network with delays up to 5 ticks
let graph = generate_small_world(256, 6, 0.2, 5, 0.2).unwrap();
let mut mesh = SynapticMesh::new(graph);
// Each tick: provide spike vector → receive delayed synaptic currents
let mut spikes = vec![false; 256];
spikes[0] = true; // neuron 0 fires
let currents = mesh.propagate(&spikes).unwrap();
// currents[i] = total incoming synaptic current at neuron i this tick§Architecture
┌──────────────────────────────────────────────────┐
│ Source spike vector [bool; N] │
└────────────────┬─────────────────────────────────┘
│
┌─────────▼─────────┐
│ SynapticGraph │ CSR adjacency + delays + polarities
│ (topology) │ Generators: random, small-world,
│ │ scale-free, layered
└─────────┬─────────┘
│ per-synapse: (target, weight, delay)
┌─────────▼─────────┐
│ SpikeDelayBuffer │ Ring-buffer delay queue
│ (delay) │ inject() → advance() → drain()
└─────────┬─────────┘
│ tick-aligned delivery
┌─────────▼─────────┐
│ Synaptic current │ Vec<f32> of length N
│ per target neuron│
└───────────────────┘§References
- Lapicque, L. (1907). Recherches quantitatives sur l’excitation électrique des nerfs traitée comme une polarisation. Journal de Physiologie et de Pathologie Générale, 9, 620–635.
- Stein, R. B. (1967). Some models of neuronal variability. Biophysical Journal, 7(1), 37–68.
Dale’s law:
- Dale, H. H. (1935). Pharmacology and Nerve-endings. Proceedings of the Royal Society of Medicine, 28(3), 319–332.
Network topology:
- Watts, D. J. & Strogatz, S. H. (1998). Collective dynamics of ‘small-world’ networks. Nature, 393, 440–442.
- Barabási, A.-L. & Albert, R. (1999). Emergence of scaling in random networks. Science, 286, 509–512.
STDP / Hebbian plasticity:
- Hebb, D. O. (1949). The Organization of Behavior. Wiley.
- Bi, G. Q., & Poo, M. M. (1998). Synaptic modifications in cultured hippocampal neurons: dependence on spike timing, synaptic strength, and postsynaptic cell type. Journal of Neuroscience, 18(24), 10464–10472.
Winner-take-all lateral inhibition:
- Maass, W. (2000). On the computational power of winner-take-all. Neural Computation, 12(11), 2519–2535.
Re-exports§
pub use delay::SpikeDelayBuffer;pub use error::MeshError;pub use error::Result;pub use mesh::SynapticMesh;pub use topology::SynapticGraph;pub use topology::TOPOLOGY_DIGEST_ALGORITHM;pub use topology::TOPOLOGY_DIGEST_DOMAIN;pub use topology::TOPOLOGY_DIGEST_SCHEMA_VERSION;pub use topology::TopologyDigest;pub use types::ConnectionModel;pub use types::DelayModel;pub use types::DelayTicks;pub use types::NeuronId;pub use types::Polarity;pub use types::SynapseDescriptor;pub use types::TopologyConfig;pub use router::ChannelRouter;pub use router::MAX_ROUTER_CHANNELS;pub use router::MAX_ROUTING_TIMESTEPS;pub use router::NeuromodNeuron;pub use router::NeuromodState;pub use router::RouterConfig;pub use router::RoutingDecision;pub use sparse::MAX_SPARSE_NEURONS;pub use sparse::NeuronStateSnapshot;pub use sparse::RoutingPolicy;pub use sparse::SparseSynapticMap;pub use sparse::SparseSynapticMapBuilder;pub use sparse::Synapse;
Modules§
- delay
- Delay module — temporal delay infrastructure for spike propagation.
- error
- Error types for
synaptic-wiring. - mesh
SynapticMesh— top-level orchestrator owning topology + delays.- router
- Generic multi-channel SNN router with neuromodulatory adaptation.
- sparse
- Compressed Sparse Row (CSR) synaptic map for GPU-optimized execution.
- topology
- Topology module — network graph construction and wiring.
- types
- Core types for
synaptic-wiring.