AI Wiki中文/EN

Graph convolutions: normalization changes the answer

图卷积

Calculate a GCN layer and derive the degree-dependent limit of repeated linear propagation.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Start with the problem

A node with many neighbors can receive a larger sum simply because it has more connections. A graph convolutional network can scale each incoming contribution using graph degrees. The scaling choice matters: symmetric normalization preserves symmetry, but its rows need not sum to one.

The Kipf–Welling GCN gives a compact layer that combines self connections, normalized neighborhood propagation and a learned feature transformation. We fix the transformation here so every number can be checked on a three-node chain and one isolated node.

Definitions and derivation

Use an undirected graph with nonnegative edge weights and no existing self loops. Add one unit self loop per node, then compute degrees from the augmented graph:

A~=A+I,d~i=∑jA~ij,S=D~−1/2A~D~−1/2,H′=ReLU⁡(SHW).\widetilde A=A+I,\quad \widetilde d_i=\sum_j\widetilde A_{ij},\quad S=\widetilde D^{-1/2}\widetilde A\widetilde D^{-1/2},\qquad H'=\operatorname{ReLU}(SHW).

Rows of H are node features. An edge from j to i carries coefficient 1/√(d̃ᵢd̃ⱼ) for a unit edge; the receiver and sender degrees both matter. Compute degrees after adding self loops, and add them exactly once under this input contract. The isolated node has augmented degree one, so its own features survive propagation before W and ReLU.

For the chain, augmented degrees are (2,3,2), and row sums of S are approximately (0.90825,1.14983,0.90825). Calling these rows probability distributions would be wrong. Row normalization P has a different invariant vector:

Sd~=d~,P=D~−1A~,P1=1,S=D~1/2PD~−1/2.S\sqrt{\widetilde d}=\sqrt{\widetilde d},\qquad P=\widetilde D^{-1}\widetilde A,\quad P\mathbf1=\mathbf1,\qquad S=\widetilde D^{1/2}P\widetilde D^{-1/2}.

The square root is entrywise. Multiplying S by √d̃ returns √d̃; multiplying P by the all-ones vector returns all ones. The similarity relation connects symmetric propagation to a random walk without making the two matrices identical.

This also explains repeated smoothing with fixed S and no nonlinearities or learned weights. Within each connected component Cᵢ, positive self loops make the associated random walk aperiodic. Its stationary weights are proportional to augmented degree. Therefore:

lim⁡t→∞(Sth)i=d~i ∑j∈Cid~j hj∑j∈Cid~j.\lim_{t\to\infty}(S^t h)_i=\sqrt{\widetilde d_i}\, \frac{\sum_{j\in C_i}\sqrt{\widetilde d_j}\,h_j}{\sum_{j\in C_i}\widetilde d_j}.

Raw node values generally do not become equal. Values divided by √d̃ become equal within each component. Separate components retain separate limits. With initial values (1,0,0,2), the limit is (2/7,√6/7,2/7,2). This theorem describes powers of this fixed linear operator, not every trained deep GCN.

The spectral route provides another perspective. Defferrard and colleagues construct localized filters using Chebyshev polynomials of a scaled graph Laplacian. A polynomial of degree K−1 only propagates information up to K−1 edges; the recurrence avoids explicit eigendecomposition. Kipf and Welling motivate their layer through a first-order approximation and a renormalization step. Replacing their pre-renormalization operator with S is a modeling choice, not an algebraic identity.

Run the calculation

This complete Python 3.12 / NumPy 1.26.4 example evaluates the layer and then runs a separate linear smoothing experiment.

import numpy as np


def normalized_adjacency(adjacency):
    a = np.asarray(adjacency,dtype=float)
    if a.ndim != 2 or a.shape[0] != a.shape[1] or not 1 <= len(a) <= 16 or not np.isfinite(a).all() or np.any(a<0) or not np.allclose(a,a.T) or not np.allclose(np.diag(a),0):
        raise ValueError('Use a small nonnegative symmetric adjacency with zero diagonal.')
    augmented = a+np.eye(len(a)); degree = augmented.sum(axis=1)
    normalized = augmented/np.sqrt(degree[:,None]*degree[None,:])
    return normalized,degree


def gcn(adjacency,features,weights):
    s,_ = normalized_adjacency(adjacency)
    h,w = np.asarray(features,dtype=float),np.asarray(weights,dtype=float)
    if h.ndim != 2 or len(h) != len(s) or w.ndim != 2 or h.shape[1] != w.shape[0] or not 1 <= h.shape[1] <= 8 or not 1 <= w.shape[1] <= 8 or not np.isfinite(h).all() or not np.isfinite(w).all():
        raise ValueError('Use matching finite feature and projection matrices.')
    return np.maximum(s@h@w,0)


def example_adjacency():
    return np.array([[0,1,0,0],[1,0,1,0],[0,1,0,0],[0,0,0,0]],dtype=float)


def smooth(steps=40):
    s,degree = normalized_adjacency(example_adjacency()); state = np.array([1.,0,0,2.])
    for _ in range(steps):state = s@state
    return state,degree


if __name__ == '__main__':
    a = example_adjacency(); s,degree = normalized_adjacency(a)
    h = np.array([[1,0],[0,1],[1,1],[2,-1]],dtype=float); w = np.array([[1,-.5],[-.5,1]])
    print('degrees with self loops',degree.tolist(),'normalized row sums',s.sum(axis=1).round(9).tolist())
    print('GCN output',gcn(a,h,w).round(9).tolist())
    state,_ = smooth(); print('40 propagation steps',state.round(9).tolist(),'degree-rescaled values',(state/np.sqrt(degree)).round(9).tolist())
    print('connected-component limit',[2/7,float(np.sqrt(6)/7),2/7,2.])

Actual output:

degrees with self loops [2.0, 3.0, 2.0, 1.0] normalized row sums [0.90824829, 1.149829914, 0.90824829, 1.0]
GCN output [[0.295875855, 0.15824829], [0.445705769, 0.333333333], [0.045875855, 0.65824829], [2.5, 0.0]]
40 propagation steps [0.285714286, 0.349927106, 0.285714286, 2.0] degree-rescaled values [0.202030509, 0.202030509, 0.202030509, 2.0]
connected-component limit [0.2857142857142857, 0.34992710611188255, 0.2857142857142857, 2.0]

For node 0, the first output coordinate before ReLU is 1/2−1/(2√6); the second is −1/4+1/√6. Both are positive. The isolated node produces (2.5,0) after projection and ReLU. Forty propagation steps closely match the derived limit; the isolated value stays two in the separate smoothing experiment.

A sparse implementation first forms HW in O(N Fᵢₙ Fₒᵤₜ), then propagates in O((E+N)Fₒᵤₜ). This reference stores a dense N×N matrix and pays quadratic storage and propagation costs. The small size bound prevents mistaking it for a scalable graph system.

When the method fails

Sharing labels or behavior across neighbors helps only when the graph supports that assumption. Neighbors with systematically different labels can require other message rules or features. Repeated smoothing may erase useful distinctions, but the linear limit alone does not predict the accuracy of an optimized nonlinear model.

Directed graphs require an explicit normalization convention; silently symmetrizing them can erase direction. Existing self loops, signed edges and edge types likewise need deliberate handling. Our validator rejects negative weights, asymmetry and preexisting diagonal entries. For node classification, keep held-out labels out of feature construction and distinguish transductive access to graph structure from access to test targets.

Exercises with answers

  1. Why add self loops before computing degrees?

Answer 1: Their weight belongs to both the propagation operator and its normalization; using old degrees defines a different operator.

  1. Must each row of symmetric S sum to one?

Answer 2: No. In the example the middle row sums to about 1.14983. Row-normalized P, not S, has unit row sums.

  1. Which values converge to a common value on the chain?

Answer 3: Values divided by the square root of augmented degree; raw values retain a square-root-degree factor.

  1. Does the fixed-operator limit prove every trained GCN fails at depth?

Answer 4: No. Learned transformations, nonlinearities, residual paths and changing operators are outside this calculation.

Sources and next steps

Kipf–Welling physical page 3 gives the renormalization construction and layer equations. Defferrard physical page 3 gives polynomial localization and the Chebyshev recurrence. Our four-node calculation and connected-component limit make the normalization assumptions inspectable. Compare graph attention, which assigns feature-dependent neighborhood weights, and graph neural networks for message-passing symmetry.

Make a prediction, then check

Which vector does symmetric normalized propagation preserve?

Choose one answer

Learning objectives

  • Calculate self-loop and degree normalization without treating it as a probability distribution.
  • Derive the scoped limit of linear graph smoothing.

Prerequisites & connections

Explore related knowledge →

References

  1. Semi-Supervised Classification with Graph Convolutional Networks — arXiv v4
    Thomas N. Kipf; Max Welling · 2017
  2. Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering — arXiv v3
    Michaël Defferrard; Xavier Bresson; Pierre Vandergheynst · 2016

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-06 · Codex single-AI-author technical check: primary-source scope, explicit assumptions, original calculations, independent mathematical references and bilingual tests; not independent human or second-agent review.

  • Single-AI-author technical check: bounded primary-source reading, explicit assumptions, original calculations, runnable examples and matching bilingual equations, code and exercises. Not an independent human or second-agent review.
  • Four focused CPython 3.12.4 tests passed per chapter, including independent finite differences, literal calculations, recurrence and convolution comparisons, permutation symmetry, closed-form limits and expressive counterexamples. All eight programs use NumPy 1.26.4. CPU teaching calculations, not framework or GPU benchmarks.
  • Promoted the full prose, equations, code and exercises. Tests read formal MDX only; removed temporary fallbacks/draft skips and updated review assertion to checked. Algorithm and independent references are unchanged; final record binds both locale hashes.
  • Publication navigation points published topics to complete articles and removes corresponding pending wording, retaining directory entries for unwritten targets. Principles, equations, programs and exercises are unchanged; final article SHA values rebound.

Source locations checked:

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.