Berlin Tech Meetup: The Future of Relational Foundation Models, Systems, and Real-World Applications

Register now:
PyG/Guide7 min read

Spectral vs Spatial Graph Convolution: Frequency Domain vs Neighborhood Operations

Two ways to define convolution on graphs: spectral methods work in the eigenspace of the graph Laplacian (the frequency domain). Spatial methods work directly on node neighborhoods. Modern GNNs are derived from spectral theory but implemented as spatial operations.

PyTorch Geometric

TL;DR

  • 1Spectral convolution: define graph convolution in the frequency domain using the graph Laplacian's eigenvectors. Multiply signal coefficients by learnable filter weights. Mathematically elegant but expensive (eigendecomposition is O(N^3)) and graph-specific.
  • 2Spatial convolution: define graph convolution as neighborhood aggregation. Collect neighbor features, aggregate (sum/mean/max), transform. Simple, scalable, and transferable across graphs.
  • 3GCN bridges both: it is a first-order spectral approximation that reduces to spatial neighbor aggregation. Derived from spectral theory, implemented as a spatial operation.
  • 4Spatial methods dominate in practice: they scale to large graphs, transfer across graph structures, support heterogeneous graphs and edge features, and enable mini-batch training.
  • 5Spectral theory still matters for understanding GNN expressiveness, designing positional encodings (Laplacian eigenvectors), and analyzing over-smoothing (signal diffusion in the frequency domain).

Graph convolution can be defined in two ways: in the spectral domain (using the graph Laplacian's eigenvectors) or in the spatial domain (using direct neighborhood operations). Spectral methods are mathematically rigorous, drawing on graph signal processing theory. Spatial methods are practical, scalable, and the basis of all modern GNN architectures. The two are connected: GCN is a spectral method that simplifies to a spatial operation.

Spectral approach: graph Fourier transform

The graph Laplacian L = D - A (degree matrix minus adjacency matrix) is a positive semi-definite matrix with eigenvectors that form a basis for signals on the graph. Just as the Fourier transform decomposes a time-domain signal into frequency components, the graph Fourier transform decomposes a graph signal (node features) into components along the Laplacian eigenvectors.

  • Low-frequency eigenvectors: smooth signals that vary slowly across the graph (nearby nodes have similar values)
  • High-frequency eigenvectors: sharp signals that vary rapidly (neighboring nodes have different values)

Spectral convolution applies a learnable filter in this eigenspace: multiply each frequency component by a learned coefficient, then inverse-transform back to node space. This is analogous to frequency-domain filtering in signal processing.

Limitations of spectral methods

  • Expensive: eigendecomposition costs O(N^3). Infeasible for graphs with more than ~10K nodes.
  • Graph-specific: eigenvectors are unique to each graph. A filter learned on graph A cannot be applied to graph B (different eigenvectors).
  • Full-graph required: the Laplacian is defined for the entire graph. No mini-batching or sampling.

Spatial approach: neighborhood aggregation

Spatial convolution is message passing: each node aggregates features from its local neighborhood, applies a shared transformation, and updates its representation. No eigendecomposition, no frequency domain, no graph-specific filters.

  • Scalable: computation scales with edges O(|E|), not nodes cubed
  • Inductive: the same weights work on any graph (shared transformation, not graph-specific filter)
  • Mini-batch friendly: can sample subgraphs and train on mini-batches
  • Heterogeneous: naturally supports multiple node and edge types

Why spatial methods won

The shift from spectral to spatial happened because of four practical advantages:

  1. Scale: real-world graphs have millions of nodes. Eigendecomposition is impossible. Neighborhood aggregation is trivially parallelizable.
  2. Transfer: enterprise applications need models that work on new data. A recommendation model trained on user-item graph A should work on graph B. Spatial methods transfer; spectral methods do not.
  3. Mini-batching: spatial methods support neighbor sampling (GraphSAGE) and subgraph batching. Spectral methods require the full graph.
  4. Flexibility: spatial methods naturally incorporate edge features, directed edges, heterogeneous types, and temporal filtering. Spectral methods would need substantial modifications for each.

Where spectral theory still matters

Spectral graph theory remains important even though implementation is spatial:

  • Positional encodings: Laplacian eigenvectors provide structural positional information for graph transformers (analogous to positional encodings in language transformers)
  • Over-smoothing analysis: spectral theory explains over-smoothing as low-pass filtering that eliminates high-frequency (discriminative) components
  • Expressiveness theory: spectral properties of the graph (eigenvalue distribution) determine what GNNs can and cannot distinguish
  • Graph wavelets: multi-scale spectral analysis provides richer structural features than simple neighborhood aggregation

Frequently asked questions

What is spectral graph convolution?

Spectral graph convolution defines convolution on graphs using the graph Laplacian's eigenvectors as a Fourier basis. Just as image convolution can be computed in the frequency domain (multiply Fourier coefficients), graph convolution multiplies graph signal coefficients in the eigenvector basis. The filter is a function of eigenvalues (frequencies). This is mathematically rigorous but requires computing eigenvectors (expensive) and is graph-specific (filters do not transfer across graphs).

What is spatial graph convolution?

Spatial graph convolution defines convolution directly in the node domain: aggregate features from neighbors, apply a shared transformation. This is the message passing approach used by GCN, GAT, GraphSAGE, and GIN. It operates on the graph directly without computing eigenvectors, scales to large graphs, transfers across graphs, and is the dominant approach in modern GNNs.

What is the connection between spectral and spatial methods?

GCN (Kipf & Welling, 2017) showed that a first-order approximation of spectral graph convolution (Chebyshev polynomials of the Laplacian) reduces to simple neighborhood aggregation, which is a spatial operation. This bridges the two: GCN is both a spectral method (derived from graph Fourier theory) and a spatial method (implemented as neighbor aggregation). Most modern GNNs are justified spectrally but implemented spatially.

Why do spatial methods dominate in practice?

Four reasons: (1) Scalability: spectral methods require eigendecomposition (O(N^3)), spatial methods scale with edges (O(|E|)). (2) Inductive learning: spectral filters are graph-specific (tied to eigenvectors), spatial operations transfer across graphs. (3) Simplicity: spatial = aggregate from neighbors + transform. Easy to implement and debug. (4) Flexibility: spatial methods naturally support heterogeneous graphs, edge features, and sampling-based mini-batching.

Learn more about graph ML

PyTorch Geometric is the open-source foundation for graph neural networks. Explore more layers, concepts, and production patterns.