A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Graph Neural Networks

Research Depth 92 in the knowledge graph ☐ I know this ☆ Set as goal
28topics build on this
647prerequisites beneath it
See this on the map →
Neural Network FundamentalsGraph Representations: Adjacency List vs. Adjacency Matrix+2 more→→Convolutional Neural NetworksRecurrent Neural Networks
graph-neural-network gnn node-classification

Core Idea

Graph neural networks extend deep learning to graph-structured data by propagating information across edges. GNNs learn node representations by iteratively aggregating neighbor information. Variants include GCNs (convolutional), GraphSAGE (sampling), and GATs (attention). Applications span social networks, molecules, knowledge graphs, and recommendations.

Explainer

Standard neural networks assume their input has a fixed, regular structure — images are grids of pixels, text is a sequence of tokens. But many real-world datasets are naturally represented as graphs: social networks (users connected by friendships), molecules (atoms connected by bonds), citation networks (papers connected by references), and knowledge graphs (entities connected by relations). You can't simply flatten a graph into a vector and feed it into a regular neural network because graphs have variable size, no canonical node ordering, and complex connectivity patterns. Graph neural networks (GNNs) solve this by designing neural network operations that respect and exploit graph structure directly.

The fundamental operation in a GNN is neighborhood aggregation (also called message passing). For each node in the graph, the network collects feature information from its neighbors, combines it (through summation, averaging, or a learned function), and uses the result to update the node's own representation. One round of aggregation lets each node "see" its immediate neighbors; stacking multiple layers lets information propagate further — after k layers, each node's representation encodes information from its k-hop neighborhood. If you're familiar with the adjacency matrix representation of graphs, you can think of one GNN layer as multiplying the feature matrix by the (normalized) adjacency matrix and then applying a nonlinear transformation — similar in spirit to a standard neural network layer, but with the adjacency matrix defining which nodes communicate.

The major GNN variants differ in how they aggregate neighbor information. Graph Convolutional Networks (GCNs) use a fixed aggregation scheme based on the normalized adjacency matrix — every neighbor contributes equally, scaled by degree. GraphSAGE samples a fixed number of neighbors and applies a learnable aggregation function (mean, LSTM, or max-pool), making it scalable to large graphs where examining all neighbors is expensive. Graph Attention Networks (GATs) borrow the attention mechanism from transformers: they learn to assign different importance weights to different neighbors, so the network can focus on the most relevant connections. The choice of variant depends on the application — GCNs are simple and effective for many benchmarks, GraphSAGE scales to graphs with millions of nodes, and GATs excel when the importance of neighbors varies.

GNNs can be applied at three levels of granularity. Node-level tasks predict properties of individual nodes (e.g., classifying users in a social network or predicting the function of proteins). Edge-level tasks predict relationships between pairs of nodes (e.g., link prediction in knowledge graphs or recommending connections). Graph-level tasks predict properties of entire graphs (e.g., predicting whether a molecular graph represents a toxic compound), typically by adding a readout or pooling layer that aggregates all node representations into a single graph-level vector. The key insight across all these applications is that GNNs learn representations that capture both the features of individual entities and the structure of their relationships — something that no amount of feature engineering on flat tabular data can easily achieve.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Linear Regression in Machine Learning → Neural Network Fundamentals → Graph Neural Networks

Longest path: 93 steps · 647 total prerequisite topics

Prerequisites (4)

Leads To (2)