Visual explainer
Graph Neural Networks
Trace node features through neighbor aggregation and two-hop message passing. See what mean aggregation preserves, loses and smooths away.
Graph neural networks use relationships as well as node features to compute representations. A and E start with the same two-coordinate feature , but A has neighbors B and C while E is isolated. A feature-only function receives identical inputs for A and E; a graph-aware function can distinguish their contexts. Links are observed input structure, not proof that neighbors cause a label or improve a prediction.
Gather The Old States
A receives B's and C's . Arrows show messages entering A, while the earlier unarrowed edges showed topology. All messages in a layer use the previous layer's states. Updating one node and immediately using its new value for another would be a different computation.
GraphSAGE develops neighborhood aggregation with shared learned functions. To make a complete step checkable, our synthetic specialization is
Here is the old feature vector, its neighbors and their coordinatewise mean. Self and neighbor weights are identity matrices; there is no final normalization. An isolated node has by our chosen convention. This is an illustrative message-passing update, not the exact normalized GraphSAGE or GCN algorithm.
Add The Neighbor Mean
The axes are feature coordinates, with 70 drawing units per coordinate unit. The square marks the mean , because . Own marks A's . Translating the mean vector to Own reaches New at :
The shared direction and length of the two slanted segments show the same neighbor contribution. The picture represents feature-space arithmetic; its coordinates are not physical node positions.
Follow A Second Hop
Reveal D, an additional neighbor of B, with initial feature . The full undirected path is D–B–A–C. The highlighted arrows trace a dependency across layers: D's initial state contributes to B's layer-one state, which contributes to A's layer-two state. Labels beneath B and A refer to those different layers, not one simultaneous graph snapshot.
From the original states, and . Thus
A cannot receive D's initial feature directly in one local layer. As a fresh check, changing only D's first coordinate from 4 to 6 leaves A's first update unchanged but increases A's second first-coordinate value from 6.5 to 7.
Compare Contextual States
Return to A and isolated E after one layer. Their initial features match, but A becomes while E remains . Bars use 70 drawing units per feature unit; numbered rows identify coordinates 1 and 2. The point in E's second-coordinate row denotes zero. The graph has made their representations distinct under this rule. No classification accuracy follows without a trained task head, labels and held-out evaluation.
Choose Reach With Depth
The two rows show the same path and node locations. The solid enclosure contains A and its one-hop neighbors B and C; the dashed enclosure adds D at two hops. These are receptive-field sets, not distances in feature space. Extra local layers can incorporate more remote information, but useful depth depends on the graph, update function and task. Validate depth rather than prescribing two layers universally.
Isolate The Smoothing Effect
Now explicitly change both the graph and update rule to isolate averaging. There are two connected nodes with scalar states , updated synchronously by
One step gives . Both rows use the same scalar axis: drawing units for state . Circles track A and squares track B. The gap shrinks from 2 to 1. The earlier additive rule need not contract; this separate fixture must not be mistaken for its continuation. GCN's depth discussion motivates examining depth-related degradation, but the numbers here are our exact two-node calculation.
Ignore Neighbor Order
Return to B and C's original two-coordinate vectors. Whether their collection arrives as B,C or C,B, its mean is . The two input lanes merge into matching output chips. Mean aggregation is permutation invariant: changing neighbor order does not change the result. Node identifiers name inputs; they are not numeric features. This invariance suits an unordered neighborhood, though not every sequence-based aggregator automatically has it.
See What The Mean Loses
Two neighbors with vectors and have mean . A different neighborhood containing just one vector has exactly the same mean. Both output chips match although the input counts differ. If a node's own state is also equal, our update cannot distinguish these neighborhoods. A sum would distinguish this particular pair, giving versus ; no single illustration proves a general expressiveness guarantee.
Where It Breaks
Return to the separate two-node scalar averaging rule from frame 7. Rows show step 0, step 1, step 4 and the limit, all on the same axis. The mean stays 1, while the difference is
At step 4, states are , still distinct. Only in the limit do both reach 1; the deliberately overlapping circle and square show that loss of distinction. A head receiving identical limiting features cannot identify which node had the original low value. This is a concrete oversmoothing mechanism under the stated rule. Learned transforms, residual paths, normalization and graph structure can change the behavior; arbitrary GNNs need not converge to this mean.
The Quick Version
- Equal feature rows can have different graph neighborhoods.
- A layer gathers messages from previous-layer states.
- Neighbor means contribute a checkable feature update.
- Two local layers can carry two-hop information.
- Context can distinguish equal starting features.
- Depth changes reach without guaranteeing better predictions.
- Repeated averaging can contract feature differences.
- Mean aggregation ignores neighbor order.
- Different neighborhoods can share a mean.
- Contracting differences can eventually erase task-relevant distinctions.