liveBook · Manning

Graph neural network

As explained in Knowledge Graphs and LLMs in Action

A graph neural network is a neural network architecture that learns representations by propagating information among nodes and edges of a graph.

A graph neural network (GNN) learns node, edge, or graph representations by repeatedly aggregating information from neighboring nodes and transforming it with trainable parameters. Unlike fixed-size neural-network inputs, message passing handles varying numbers of neighbors while capturing structural patterns and node properties. section 11.0 section 11.5 section 11.5.3

A practical GNN workflow follows an encoder–decoder pipeline:

  • Represent domain objects as nodes and their interactions as edges, producing a graph from semistructured data. section 12.0
  • Encode each node by aggregating representations from its neighbors, applying trainable self and neighborhood transformations, and repeating the process across layers. section 11.5 section 11.5.3
  • Decode the learned embeddings for a downstream task such as node classification or link prediction, using a task-specific objective. section 12.0 section 12.3
  • Evaluate predictions with task-appropriate measures, including precision, recall, F1-score, confusion matrices, or metric-trend visualizations. section 12.0 section 12.1

Two applied patterns

For anti-money-laundering analysis, model accounts or entities as nodes and transactions as edges; a homogeneous GNN learns embeddings and classifies nodes as licit or illicit. For recommendations, represent users and movies in a heterogeneous graph; a heterogeneous GNN learns embeddings and predicts user–movie links. section 12.1 section 12.2

Figure 12.1 End-to-end framework to develop a GNN-based system that can be adopted for multiple tasks and application domains. The input data is usually a collection of semistructured sources describing different objects and interactions between them. The goal is to process the data and produce a graph that becomes the input for an encoder–decoder architecture. In our scenarios, the encoder uses a GNN model, and the decoder is based on a function that allows us to optimize the model for a specific downstream task. The output of this framework is a trained model that can be adopted for the inference phase.
figure

Use the end-to-end framework to trace graph construction, GNN encoding, task-specific decoding, optimization, and inference. section 12.0

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains message passing, trainable update rules, embeddings, and encoder–decoder workflows, without deriving advanced architectures.
Examples
Uses financial transaction graphs for AML classification and user–movie interaction graphs for recommendation link prediction.
What it assumes
Assumes familiarity with graphs and machine-learning tasks while developing graph embeddings and message passing from foundational concepts.
What you can do after
Apply it via PyTorch Geometric to build and evaluate node-classification or link-prediction systems.
How it connects
Connects graph representation learning, message passing, node classification, link prediction, knowledge graphs, and large language models.

Also explained in

Compare how 8 books explain graph neural network →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.