Spike GNN — Graph Neural Networks with Spike Messages¶
Graph neural networks where messages are spike trains instead of float vectors. Nodes are spiking neuron populations. Aggregation via normalized neighborhood summation, followed by LIF integration.
Architecture¶
Each SpikeGraphConv layer performs:
- Message passing:
h_agg = (A @ X) / deg— aggregate neighbor features - Linear projection:
h_proj = h_agg @ W^T— learned weight transform - LIF integration: Over T timesteps, rate-coded input drives LIF neurons. Output = spike counts per node.
SpikeGNNLayer stacks multiple SpikeGraphConv layers with inter-layer spike count normalization.
Components¶
SpikeGraphConv— Single spike-based graph convolution layer.
| Parameter | Default | Meaning |
|---|---|---|
in_features |
(required) | Input dimension per node |
out_features |
(required) | Output dimension per node |
threshold |
1.0 | LIF spike threshold |
tau_mem |
10.0 | Membrane time constant |
SpikeGNNLayer— Multi-layer spike GNN for graph classification.
| Parameter | Default | Meaning |
|---|---|---|
layer_dims |
(required) | [in, hidden, ..., out] dimensions |
threshold |
1.0 | LIF threshold for all layers |
T |
8 | Simulation timesteps per layer |
Methods: forward(node_features, adjacency), graph_classify(node_features, adjacency).
Usage¶
from sc_neurocore.spike_gnn.spike_gnn import SpikeGraphConv, SpikeGNNLayer
import numpy as np
# Single layer
conv = SpikeGraphConv(in_features=16, out_features=8)
adj = np.array([[0, 1, 1], [1, 0, 0], [1, 0, 0]])
features = np.random.rand(3, 16)
output = conv.forward(features, adj, T=8) # (3, 8) spike counts
# Multi-layer graph classifier
gnn = SpikeGNNLayer(layer_dims=[16, 8, 4], threshold=1.0, T=8)
label = gnn.graph_classify(features, adj)
print(f"Predicted class: {label}")
Reference: SGNNBench (2025) — 9 SGNN architectures benchmarked.
sc_neurocore.spike_gnn
¶
Spike-based GNN: message passing with spike trains instead of float vectors.
SpikeGNNLayer
dataclass
¶
Multi-layer spike GNN for graph classification/regression.
Parameters¶
layer_dims : list of int [in_features, hidden1, ..., out_features] threshold : float T : int Simulation timesteps per layer.
Source code in src/sc_neurocore/spike_gnn/spike_gnn.py
| Python | |
|---|---|
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
forward(node_features, adjacency)
¶
Forward pass through all layers.
Parameters¶
node_features : ndarray of shape (N_nodes, in_features) adjacency : ndarray of shape (N_nodes, N_nodes)
Returns¶
ndarray of shape (N_nodes, out_features)
Source code in src/sc_neurocore/spike_gnn/spike_gnn.py
| Python | |
|---|---|
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
graph_classify(node_features, adjacency)
¶
Classify a graph by global readout (sum pooling + argmax).
Source code in src/sc_neurocore/spike_gnn/spike_gnn.py
| Python | |
|---|---|
159 160 161 162 163 | |
SpikeGraphConv
¶
Spike-based graph convolution layer.
Message passing: each node aggregates spike trains from neighbors, applies a learned weight transform via LIF integration.
Parameters¶
in_features : int Input feature dimension per node. out_features : int Output feature dimension per node. threshold : float tau_mem : float
Source code in src/sc_neurocore/spike_gnn/spike_gnn.py
| Python | |
|---|---|
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
forward(node_features, adjacency, T=8)
¶
Spike-based graph convolution.
Parameters¶
node_features : ndarray of shape (N_nodes, in_features) Node features in [0, 1] (spike rates or encoded features). adjacency : ndarray of shape (N_nodes, N_nodes) Binary adjacency matrix (1 = edge, 0 = no edge). T : int Number of simulation timesteps.
Returns¶
ndarray of shape (N_nodes, out_features) Output spike counts per node per feature.
Source code in src/sc_neurocore/spike_gnn/spike_gnn.py
| Python | |
|---|---|
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |