Graph Neural Networks: An Introduction

por Frank de Alcantara em 21/07/2026

This article is also available in Portuguese.

Graph Neural Networks: An Introduction

Artificial intelligence has learned to handle tabular, sequential, and grid data, but these three forms cover only a fraction of the structures that matter. Spreadsheets, text, and images are carefully regularized special cases of a more general object. The real world is relational. People connect to people, atoms bond to atoms, cities connect through roads, and neurons connect through synapses. These connections are not decorative metadata placed on top of the observations. They determine which observations can influence one another.

The mathematical object that formalizes “things connected to things” is the graph, and the architecture that learns from graphs is the GNN, or Graph Neural Network. Our plan is honest and linear. First, we define graphs with enough rigor for a computer to manipulate them. Then we show why an ordinary convolutional or recurrent network fails when faced with them, and which symmetry principle solves the problem. Next, we derive message passing and use it to obtain the GCN, or Graph Convolutional Network, symbol by symbol. We calculate an entire layer by hand on a four-vertex graph that reappears in the interactive labs and in the C++23 implementation. We then derive the GAT, or Graph Attention Network, and GraphSAGE, connect learned representations to training objectives, and separate four limitations that are too often blended together: over-smoothing, heterophily, over-squashing, and limited expressive power.

Each major conceptual section ends with five fully solved exercises. They are part of the exposition, not an answer key glued to its side. The first exercises verify definitions, the middle ones require a calculation, and the last ones ask us to diagnose a modeling or implementation choice. A reader who covers the solution and works before reading it will turn the article into a compact course.

1. Why graphs matter

A network is neither a collection of isolated numbers nor an ordered sequence. It has structure, context, and meaning, and all three live in the pattern of its connections. Consider a social network: each user is a vertex, and each friendship is an edge. The information needed to predict whether two users will become friends does not reside only in their individual profiles. It also lies in how many friends they share, how dense their shared neighborhood is, and how central each person is to the network. None of these signals appears if we treat every user as an isolated row in a spreadsheet.

Chemistry provides the most literal example. A molecule is, without metaphor, a graph: each atom is a vertex with its own identity and attributes, such as atomic number, charge, and hybridization, while each chemical bond is an edge with its own type, such as single, double, or aromatic. The topology of this network is not decorative. It helps determine the molecule’s three-dimensional shape, its pharmacological activity, and its role in biochemical reactions. Two compounds with exactly the same atoms but different connections are different substances. An architecture that ignores connection structure is literally throwing away the information that defines the molecule.

Exclusive Content
Want to keep reading?

The full article contains practical strategies and exclusive data reserved for our registered members.

Continue with Google Instant free access for registered readers

(Updated: )