Read a graph as a functor and its dynamics as a natural transformation, and a graph-neural-network layer becomes a morphism between such functors.
Fix a small category
The atom of a layer is an aggregator, a vector-multiset → vector map that collapses the unordered, repetition-carrying collection of neighbour features into one vector, followed by a node update. To separate non-isomorphic neighbourhoods the aggregator must be injective on multisets; GIN achieves this by relabelling each neighbour tuple and taking a plain vector sum
Two demands pull against each other. Discriminability wants distinct neighbourhoods sent to distinct vectors, that is injective aggregation up to the Weisfeiler–Leman ceiling. Proximity wants adjacent or similar nodes sent to nearby vectors, the smoothing that aids generalisation. Pushing proximity too far is oversmoothing. Stacking layers repeatedly averages features until every node collapses toward the graph mean, the fixed point of over-averaging, so depth trades identity for reach.
Remark. Naturality is weight sharing
That a layer is a map of functors rather than an arbitrary function is exactly the inductive bias of a GNN. The same update acts at every node and commutes with the incidence maps, so a permutation of the graph acts on inputs and outputs alike. Equivariance is naturality; the learnable content lives only in the multiset aggregator and the node update, shared across the whole graph.
References
- K. Xu, W. Hu, J. Leskovec, S. Jegelka, How Powerful are Graph Neural Networks? (ICLR 2019)