Vectorizing Graph Neural Networks (2020)

The author discusses the use of graph convolutional neural networks (GNNs) and their appeal for analyzing graph data. They highlight that most deep learning libraries are not optimized for graph algorithms, which can be expressed as dense matrix multiplications, but are inefficient for sparse graphs. The author demonstrates how to use NumPy APIs to implement computationally effective GNNs for sparse graphs, using PageRank as an example. They provide three different implementations of PageRank in Python: a naive solution using an adjacency list, a dense solution using an adjacency matrix, and a sparse solution using a flattened adjacency list. The author compares the performance of these implementations and explores the use of JIT compilation with Numba, TensorFlow, and JAX to improve performance. They conclude that the flattened adjacency list representation with TensorFlow or JAX provides a good balance of performance and usability for GNN implementations.

To top