This chapter introduces graph neural networks (GNNs) — architectures built for data that lives on irregular, connected structures rather than grids or sequences — and applies the core ideas to a small, well-known benchmark graph.
Nodes, edges, and graph types; the GNN design pipeline; GCN, GAT, and GraphSAGE architectures; and where GNNs show up across the sciences.
NetworkX fundamentals and graph statistics (degree, clustering, PageRank, closeness centrality) on Zachary’s karate club network, then representing that graph in PyTorch Geometric, training a node-embedding model from scratch, and building a 3-layer GCN to classify its communities.
Resources¶
Textbooks and tutorials this chapter’s exercises adapt¶
Kipf, T. N., & Welling, M. “Semi-Supervised Classification with Graph Convolutional Networks.” International Conference on Learning Representations (2017) — the source of the Graph Convolutional Network (GCN) architecture used in 8.2. (8.1, 8.2)
PyTorch Geometric’s “Introduction: Hands-on Graph Neural Networks” tutorial by Matthias Fey — the direct source of 8.2’s PyG data-handling and GCN sections. (8.2)
jdwittenauer’s NetworkX tutorial — the source of 8.2’s NetworkX basics section. (8.2)
Stanford CS224W (Machine Learning with Graphs) — the source of 8.2’s graph-statistics exercises (average degree, clustering coefficient, PageRank, closeness centrality) and node-embedding exercise. (8.2)
PyTorch Geometric and NetworkX¶
PyTorch Geometric documentation — datasets,
GCNConv, and other graph neural network layers. (8.2)NetworkX documentation — graph creation, manipulation, and analysis in Python. (8.2)
Datasets¶
Zachary’s karate club network — a 34-member social network with 4 known communities, the standard toy benchmark for GNNs. (8.2)