Graph neural networks, and the problems that are actually graphs
Road networks, utility grids, molecules and social ties are not grids or sequences. Forcing them into one loses the structure that mattered.
Convolutions assume a grid: every pixel has the same number of neighbours in the same relative positions. Transformers assume a sequence. A road network is neither. Junctions have wildly varying degree, there is no canonical ordering, and relabelling the nodes must not change the answer.
Graph neural networks are what you get when you take convolution's core idea — a local operation applied everywhere with shared weights — and drop the requirement that the neighbourhood be regular.
Message passing
Each layer does three things. Compute a message from each neighbour, aggregate those messages, and combine the result with the node's current state to produce a new one. The aggregation must be permutation invariant — sum, mean or max — because a node's neighbours have no inherent order and the model must not invent one.
Stack k layers and each node's representation depends on everything within k hops. This is the receptive field again, defined by graph distance rather than pixel distance.
Two failure modes worth knowing before you build one
Over-squashing is the other. Information from an exponentially growing k-hop neighbourhood has to be compressed into one fixed-size vector. On graphs with bottlenecks — and road networks are full of them — distant but relevant information is crushed on the way through.
Where this pays off in civic infrastructure
The useful property is that a graph model reasons about a segment in the context of its neighbours. Drainage complaints on three connected streets are not three independent incidents, and a model that treats each report as an isolated row cannot represent that. One that passes messages along the network can.
- Node-level tasks: classify each junction or segment — which stretches of road are due for resurfacing.
- Edge-level tasks: predict a property of a connection — traffic on a link, or whether two reports concern the same fault.
- Graph-level tasks: one answer for the whole structure, which is how molecular property prediction works.
Being honest about when not to
Graph networks are harder to train, harder to batch and harder to debug than the alternatives. If the relational structure is weak — if a gradient-boosted tree on tabular features with a few hand-built neighbourhood aggregates does nearly as well — then it will do nearly as well, and it will be far easier to operate.
Reach for a graph model when the connections carry the signal. If the rows are nearly independent, they are rows.