Specify message direction, normalization and nonlinear placement
Distinguish sums, means, GCN normalization and attention rather than treating them as interchangeable averages.
On this page
The question for today
What you’ll understand
- Compute incoming sum and mean under a declared matrix orientation.
- Account for self-loops and full versus sampled degrees.
- Explain why normalization and nonlinear placement change the operator.
Message passing is a family of operators rather than one equation hidden behind a graph library call. A model must define which edges deliver messages, which node or edge transformations run first, how messages are aggregated, and when the destination applies its update. Changing a sum to a mean or inserting a self-loop alters that computation even if tensor shapes and training code remain valid.
Receiving rows make the multiplication explicit
For this lesson use A[v,u]=1 when u→v, so a receiving destination occupies a matrix row. This is the transpose of the source-row convention in the storage lesson; name that change deliberately. Multiplying A by a node-feature matrix sums incoming source features. Dividing each nonempty row by its incoming degree yields a mean. For an empty neighborhood, choose an explicit convention such as a zero aggregate or a separate self transformation; division by zero is not an implementation detail to ignore.
A sum retains information about neighborhood multiplicity, while a mean removes a uniform scaling from duplicated identical neighbors. Neither is universally better. Edge weights, relation types and parallel edges can each change the aggregate. GraphSAGE’s mean variant with self concatenation differs from a single mean that includes the self feature. Verify the exact architecture rather than treating every mean-based layer as the same operator. A self contribution can be separately parameterized, included in normalization or absent altogether.
GCN normalization is not a destination-only mean
The familiar GCN operator for an undirected graph adds self-loops and uses symmetric normalization on both ends of each edge. Each message coefficient depends on the augmented degrees of the source and destination. A destination-only mean instead uses one row-degree divisor. They coincide only in special cases and should not be substituted casually. Directed graphs require a deliberate extension or another normalization rule; the standard undirected derivation does not uniquely choose the correct directed operator.
Graph attention layers compute learned coefficients and normalize them over a specified destination neighborhood, often including self-loops. Those coefficients depend on the current features, unlike fixed degree coefficients. Sampling a smaller neighborhood changes the attention softmax denominator and generally changes its value; reusing the full-graph formula without examining that denominator is not an unbiasedness proof. Likewise, degrees computed on a sampled subgraph differ from full-graph degrees, so normalization metadata must identify which graph and self-loop policy produced it.
Test arithmetic before testing model quality
Use a tiny asymmetric graph with different source features to test direction, and an irregular undirected graph to test normalization. Compare per-node messages before nonlinearities, then the destination update. Maintain an explicit edge map when graph transformations reorder records. A final accuracy metric can conceal swapped directions or duplicated self contributions, particularly on a dataset where node features alone are predictive. Record whether bias and activation are applied to each message or once to the accumulated destination value.
The network lab isolates that last distinction. Reset and set both x=1 and w=1; predict σ(0.5)≈0.62246 for the fixed bias -0.5. Separately Reset and set both x=2 and w=1; predict σ(1.5)≈0.81757. Applying this unit to two identical scalar messages then summing gives about 1.24492, different from summing the inputs first and applying it once. The lab is one sigmoid unit, not a graph layer, and does not calculate GCN degrees or attention weights.
Work it through
Compare three aggregations on an irregular star
An undirected three-leaf star has center feature 8 and leaf features 2,4,10. Use identity feature transformation and no activation. Compute the center’s neighbor sum, neighbor mean, self-inclusive mean and self-loop GCN-normalized value.
Ignoring self, the center receives 2+4+10=16. Its three-neighbor mean is 16/3≈5.3333. These two values differ because the sum keeps the neighbor-count factor.
Including the self feature in an ordinary mean gives (8+2+4+10)/4=6. This is not GraphSAGE’s separate concatenation of the center and its neighbor mean.
After adding one self-loop, the center degree is 4 and each leaf degree is 2. The GCN center value is 8/4+(2+4+10)/√(4×2)=2+16/√8≈7.6569, distinct from all the previous aggregates.
Sum, mean, self-inclusive mean and symmetric normalization implement different operators. The stated star, self-loop rule and identity transformation make those differences directly testable.
The living notebook
Explore the model
Interactive lab · network
Nonlinear placement changes aggregation
Reset → set x=1 and w=1 → predict σ(0.5)≈0.62246. Separately Reset → set x=2 and w=1 → predict σ(1.5)≈0.81757. Compare 2σ(0.5) with σ(1.5) on paper.
- Product · wx
- 1.2
- Logit · wx − 0.5
- 0.7
- Sigmoid output
- 0.6682
One inspectable sigmoid unit, σ(wx − 0.5). Playback traces the computation graph. There is no training, attention mechanism or hidden deep network. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe fixed-bias scalar unit illustrates nonlinear placement; it contains no graph adjacency, degree normalization or learned attention.
Pause & reason
Check your understanding
Your turn
Try it yourself
A directed destination receives scalar features 1 and 7 and has self feature 10. Compute its incoming sum, incoming mean and a self-inclusive mean. Why is the undirected GCN formula not automatically the uniquely correct directed normalization?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The first two operators use two incoming messages; the self-inclusive mean uses three values. Directionality does not supply a symmetric degree convention by itself.
Compare with the solution
The incoming sum is 8 and mean is 4. Adding self produces an ordinary mean of (1+7+10)/3=6. A directed graph has different in- and out-degree structure, so adopting an undirected symmetric normalization requires an explicitly chosen directed extension. These three results already show that the operator cannot be inferred merely from the word aggregation.
Keep the idea
Take it with you
- Define adjacency orientation and zero-neighbor behavior explicitly.
- Self handling and source/destination normalization change the operator.
- Nonlinear placement and sampled attention denominators require their own semantics.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.