Graph Neural Networks (GNNs) are neural architectures that operate on graph-structured data by passing messages between connected nodes — learning node, edge, and graph-level representations through iterative neighborhood aggregation, enabling machine learning on non-Euclidean data structures such as social networks, molecular graphs, and knowledge graphs.
Message Passing Framework:
- Neighborhood Aggregation: each node collects feature vectors from its neighbors, aggregates them (sum, mean, max), and updates its own representation; after $K$ layers, each node's representation captures information from its K-hop neighborhood
- Message Function: computes messages from neighbor features; simplest form: $m_{ij} = W\cdot h_j$ (linear transform of neighbor j's features); more expressive variants include edge features: $m_{ij} = W\cdot [h_j \parallel e_{ij}]$ or attention-weighted messages
- Update Function: combines aggregated messages with the node's current features to produce the updated representation; GRU-style or MLP-based updates provide nonlinear combination: h_i' = σ(W_self·h_i + W_agg·AGG({m_ij : $j \in N(i)$}))
- Readout: for graph-level prediction, aggregate all node representations into a single graph vector using sum, mean, or attention pooling; hierarchical pooling (DiffPool, Top-K pooling) progressively coarsens the graph for multi-scale representation
Architecture Variants:
- GCN (Graph Convolutional Network): spectral-inspired convolution using normalized adjacency matrix; $h' = \sigma (D^{-½}\cdot Â\cdot D^{-½}\cdot H\cdot W)$ where  = A+I (self-loops), D is degree matrix; simple, efficient, widely used for semi-supervised node classification
- GAT (Graph Attention Network): learns attention coefficients between nodes; $\alpha_{ij} = \operatorname{softmax}(LeakyReLU(a^T\cdot [W\cdot h_i \parallel W\cdot h_j]))$; attention enables different importance weights for different neighbors — crucial for heterogeneous neighborhoods where not all neighbors are equally relevant
- GraphSAGE: samples fixed-size neighborhoods and aggregates using learnable functions (mean, LSTM, pooling); enables inductive learning on unseen nodes by learning aggregation functions rather than node-specific embeddings
- GIN (Graph Isomorphism Network): maximally powerful GNN under the message passing framework; provably as expressive as the Weisfeiler-Lehman graph isomorphism test; uses sum aggregation with injective update: $h' = \mathrm{MLP}((1+\epsilon )\cdot h_i + \Sigma h_j)$
Tasks and Applications:
- Node Classification: predict labels for individual nodes (user categorization in social networks, paper topic classification in citation graphs); semi-supervised setting uses few labeled nodes and many unlabeled
- Link Prediction: predict missing or future edges (recommendation systems, drug-target interaction, knowledge graph completion); encodes node pairs and scores edge likelihood
- Graph Classification: predict properties of entire graphs (molecular property prediction, protein function classification); requires effective graph-level pooling/readout to aggregate node features
- Molecular Graphs: atoms as nodes, bonds as edges; GNNs predict molecular properties (toxicity, solubility, binding affinity) achieving state-of-the-art on MoleculeNet benchmarks; SchNet, DimeNet add $3D$ spatial information
Challenges and Limitations:
- Over-Smoothing: deep GNNs (>5-10 layers) cause node representations to converge to similar vectors, losing discriminative power; mitigation: residual connections, jumping knowledge, dropping edges during training
- Over-Squashing: information from distant nodes is exponentially compressed through narrow graph bottlenecks; manifests as poor performance on tasks requiring long-range dependencies; graph rewiring and virtual nodes address this
- Scalability: $\text{full-batch} \mathrm{GCN}$ on large graphs (millions of nodes) requires materializing the dense multiplication; mini-batch training with neighborhood sampling (GraphSAGE) or cluster-based approaches (ClusterGCN) enable billion-edge graphs
- Expressivity: standard MPNNs cannot distinguish certain non-isomorphic graphs (limited by $1-\mathrm{WL}$ test); $\text{higher-order} \mathrm{GNN}s (\text{k-WL})$, subgraph GNNs, and positional encodings increase expressivity at computational cost
Graph neural networks are the essential deep learning framework for structured and relational data — enabling AI applications on the vast landscape of real-world data that naturally forms graphs, from molecular drug discovery to social network analysis to recommendation engines and beyond.