liveBook · Manning

Link prediction

As explained in Knowledge Graphs and LLMs in Action

Link prediction is a graph-learning technique that forecasts missing, future, or otherwise unobserved connections between nodes, optionally assigning scores or probabilities to candidate links.

Link prediction forecasts missing, future, or unobserved connections between nodes. It can estimate whether a link exists, assign an existence probability, or predict a relationship type. section 9.2.2 section 10.2

Graphs are often incomplete because existing connections go unrecorded or hidden, while evolving networks continually create new edges. Predictions support recommendations, knowledge graph completion, drug-side-effect prediction, and interaction discovery. section 9.2.2

A practical link-prediction pipeline typically follows these stages:

  • Represent entities and interactions as a graph, preserving dependencies that independent-data assumptions would ignore. section 9.1
  • Featurize nodes or candidate node pairs with structural features or learned embeddings; reuse the same featurization during training and prediction. section 9.3.1 section 9.4
  • Train a classifier or encoder-decoder model to distinguish existing from absent links, optionally predicting among relationship types. section 10.2 section 12.0
  • Score candidate node pairs and validate predictions with metrics such as precision, recall, and F1-score. section 12.0 section 9.2.2

Movie recommendations

A heterogeneous graph represents users, movies, and user–movie ratings. A heterogeneous GNN learns user and movie embeddings, then a dot product scores candidate interactions; binary cross-entropy trains the link decoder. section 12.2 section 12.2.4

Drug repurposing

Treat drugs and diseases as nodes and potential therapeutic relationships as candidate links. Relationship features can support binary prediction of whether a treatment relationship exists. section 10.2

Figure 9.3 Typical link prediction flow. It has two phases. During the training phase, the graph is used as input, and the model is trained to determine whether a link exists. During the prediction phase, the model provides an output for each pair of nodes representing the target relationship to predict. It provides an existence probability for each.
figure

Follow the two-phase flow from graph-based training to existence probabilities for candidate node pairs. section 9.2.2

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Builds the task from graph representation through featurization, classifiers, GNN encoders, decoders, scoring, and evaluation.
Examples
Demonstrates co-authorship forecasting, drug repurposing, and MovieLens user–movie recommendation using structural features, Node2Vec, and heterogeneous GNNs.
What it assumes
Assumes graph representation and basic machine learning, while teaching embeddings, pair features, classification framing, and encoder-decoder construction.
What you can do after
Build it from scratch as a graph-learning pipeline that featurizes nodes or pairs, trains a scorer, predicts links, and evaluates results.
How it connects
Connects graph machine learning with node embeddings, node classification, graph neural networks, heterogeneous graphs, recommendation systems, and knowledge graph completion.

Also explained in

Compare how 3 books explain link prediction →

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.