Link prediction is the machine learning task of inferring the existence, likelihood, or type of a connection (edge) between two nodes in a graph. It operates on network-structured data, where nodes represent entities and edges represent relationships. The goal is to predict unobserved or future links based on the graph's observed structure, node attributes, and existing edge patterns. It serves as a fundamental benchmark for evaluating graph representation learning and the quality of generative graph models.
Glossary
Link Prediction

What is Link Prediction?
Link prediction is a core task in graph machine learning focused on inferring missing or future connections within a network.
Common approaches use graph neural networks (GNNs) like Graph Convolutional Networks (GCNs) or GraphSAGE to learn node embeddings that encode topological and feature-based information. These embeddings are then scored by a function (e.g., a dot product or a neural network) to predict link likelihood. It is intrinsically related to graph generation, as a high-quality generative model must accurately capture the underlying distribution of edges. Applications include recommending social connections, predicting protein interactions, and forecasting financial transactions in temporal graphs.
Key Technical Approaches to Link Prediction
Link prediction is a core task in graph machine learning, approached through a spectrum of methods from simple heuristics to deep generative models. These techniques infer the likelihood of a missing or future connection between two nodes.
Heuristic & Similarity-Based Methods
These are non-learning, rule-based approaches that calculate a score for a potential edge based on local graph structure. They are computationally efficient and serve as strong baselines.
- Common Neighbors: Scores a link by the number of neighbors two nodes share.
- Jaccard Coefficient: Normalizes the common neighbors count by the total union of neighbors.
- Adamic-Adar: Weighs common neighbors by their inverse degree, giving less weight to high-degree hub nodes.
- Preferential Attachment: Assumes a node's probability of forming new links is proportional to its current degree.
These methods are fast and interpretable but are limited to capturing only immediate, local topology.
Matrix Factorization & Latent Space Models
This approach embeds nodes into a low-dimensional latent space where link probability is a function of the distance between node vectors. It models the graph's adjacency matrix as being generated by latent node features.
- Factorization: Decomposes a node-node similarity matrix (e.g., Katz index, Laplacian) into low-rank matrices representing node embeddings.
- Assumption: Nodes that are 'close' in the latent space are likely to be connected.
- Example: The dot product of two node embedding vectors predicts the likelihood of an edge.
While powerful for static graphs, these methods typically lack the ability to incorporate node features or model complex, non-linear relationships directly.
Graph Neural Network (GNN) Encoders
The dominant deep learning approach, where a GNN (e.g., GCN, GAT, GraphSAGE) learns node embeddings by aggregating information from a node's local neighborhood. Link prediction is then performed on the learned embeddings.
- Encoder: A GNN transforms node features and graph structure into dense vector representations.
- Decoder: A simple function (e.g., dot product, MLP) takes the embeddings of two nodes and outputs a link score.
- Training: Models are trained on existing edges (positive examples) and randomly sampled non-edges (negative examples).
This approach excels at leveraging both node attributes and graph structure, leading to state-of-the-art performance on many benchmarks.
Graph Autoencoder Frameworks
These are self-supervised models that learn to reconstruct the graph's adjacency matrix from a compressed latent representation. Link prediction is a direct output of the reconstruction.
- Encoder: Maps the graph to a latent node embedding matrix
Z(often using a GNN). - Decoder: Reconstructs the adjacency matrix from
Z, e.g., viasigmoid(Z * Z^T). - Training: The model is trained to minimize the difference between the original and reconstructed adjacency matrix.
Variants like the Graph Variational Autoencoder (Graph VAE) introduce a probabilistic latent space, enabling the generation of new graph structures and uncertainty estimation for predictions.
Subgraph & Local Structure Models
Instead of predicting links based on full-graph node embeddings, these methods extract and reason over local subgraphs surrounding the candidate node pair.
- Subgraph Extraction: For nodes
uandv, a enclosing subgraph (e.g.,k-hop neighbors) is extracted. - Relational Reasoning: A neural network (often a GNN) processes this subgraph to predict the link, explicitly considering the local relational structure.
- Advantage: Highly inductive and can generalize to unseen graph structures, as predictions are based on local patterns rather than global node IDs.
This approach is particularly effective for inductive link prediction, where the model must make predictions for nodes not seen during training.
Temporal & Dynamic Graph Models
These methods specialize in predicting future links in evolving graphs, where the network structure changes over time. They incorporate temporal sequences of graph snapshots.
- Temporal Graph Neural Networks (TGNNs): Models like EvolveGCN or TGN use RNNs or attention mechanisms to update node embeddings over time as new interactions occur.
- Dynamic Representation: Node embeddings are functions of time, capturing how a node's role and connectivity evolve.
- Application: Essential for predicting next interactions in social networks, financial transaction networks, or recommendation systems.
These models move beyond static assumptions, capturing the continuous or discrete-time dynamics that drive link formation.
How is Link Prediction Evaluated?
Link prediction is evaluated using standardized metrics that quantify a model's ability to rank potential missing edges above non-existent ones, providing a rigorous benchmark for graph representation learning.
Link prediction is evaluated by splitting a graph's edges into training, validation, and test sets, then measuring a model's ranking performance on held-out positive edges against a set of negative samples. Core metrics include the Area Under the Receiver Operating Characteristic Curve (AUC-ROC), which measures the model's ability to distinguish real from fake edges across all thresholds, and the Average Precision (AP), which summarizes the precision-recall curve, giving more weight to correct high-confidence predictions. These metrics assess the quality of the predicted likelihood scores for node pairs.
Additional standard metrics are precision@k and the hit rate, which evaluate the model's accuracy within a shortlist of top-ranked predictions. Evaluation requires careful negative sampling, typically by generating a set of non-edges not present in the graph. The choice of evaluation protocol—such as transductive (within a single graph) or inductive (generalizing to unseen nodes)—directly impacts the reported scores and must be clearly stated to ensure fair comparison between models.
Frequently Asked Questions
Link prediction is a core task in graph machine learning focused on inferring missing or future connections. These questions address its fundamental mechanisms, applications, and relationship to synthetic data generation.
Link prediction is the machine learning task of inferring the likelihood or existence of a connection (edge) between two nodes in a graph, based on the observed structure and node/edge features. It works by learning a scoring function, often from a Graph Neural Network (GNN) like a Graph Convolutional Network (GCN) or Graph Attention Network (GAT), that computes a probability for a potential edge (u, v). The model is trained on a partially observed graph, learning patterns like homophily (connected nodes are similar), transitivity (friends of friends become friends), and local neighborhood structures to score unseen node pairs.
Common technical approaches include:
- Heuristic Methods: Using simple metrics like Common Neighbors, Jaccard Coefficient, or Adamic-Adar.
- Embedding-Based Methods: Generating graph embeddings for nodes (e.g., via Node2Vec, DeepWalk) and predicting links based on vector similarity (e.g., dot product).
- GNN-Based Methods: Using message passing to create node representations that are then fed into a decoder (e.g., a multilayer perceptron or bilinear layer) to predict edge existence.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Link prediction is a core task within graph machine learning. These related concepts define the models, metrics, and frameworks used to infer and generate connections in network-structured data.
Graph Neural Network (GNN)
A Graph Neural Network (GNN) is a class of neural networks designed to operate directly on graph-structured data. It uses a message-passing mechanism where nodes iteratively aggregate feature information from their local neighborhoods to learn powerful node, edge, or graph-level representations. GNNs are the foundational architecture for most modern link prediction models.
- Core Mechanism: Neighbor feature aggregation and update functions.
- Primary Use: Learning embeddings that encode topological and feature information, which are then used for tasks like node classification and link prediction.
Graph Embedding
Graph embedding is the technique of mapping nodes, edges, or entire graphs to low-dimensional, continuous vector representations (embeddings). These embeddings aim to preserve the structural properties—like connectivity and community membership—of the original graph. For link prediction, node embeddings are often compared (e.g., via dot product) to score the likelihood of a missing edge.
- Key Methods: Include shallow models like Node2Vec and DeepWalk, as well as embeddings learned by GNNs.
- Link Scoring: The similarity (cosine, Euclidean) between two node embeddings is a direct heuristic for link existence.
Generative Graph Model
A generative graph model is a probabilistic or deep learning model designed to learn the underlying distribution of a graph dataset (P(G)). It can then synthesize new, realistic graph instances. Link prediction can be framed as a generative task: predicting the probability of an edge (a micro-generation event) given the observed partial graph.
- Model Families: Include Stochastic Block Models (SBM), Graph Variational Autoencoders (Graph VAE), and Graph Generative Adversarial Networks (GraphGAN).
- Objective: Capture complex dependencies like transitivity (friends of friends are likely friends) and community structure.
Message Passing
Message passing is the fundamental, iterative computational mechanism at the heart of Graph Neural Networks. In each layer, nodes create "messages" (typically a function of their current state) and send them to neighboring nodes. Each node then aggregates incoming messages and updates its own representation. This process allows information to propagate across the graph.
- Role in Link Prediction: Enables nodes to build representations that are informed by multi-hop network context, which is critical for assessing the potential for a connection.
- Aggregation Functions: Common choices include sum, mean, max, or attention-weighted sum.
Graph Convolutional Network (GCN)
A Graph Convolutional Network (GCN) is a specific, widely-used type of GNN that performs a localized, spectral-based convolution. It updates a node's feature vector by taking a normalized weighted sum of its own features and the features of its immediate neighbors. The GCN layer provides an efficient and effective baseline for many graph tasks.
- Link Prediction Application: GCNs generate node embeddings that encode local graph structure. A downstream decoder (e.g., a bilinear layer) then operates on pairs of node embeddings to predict link scores.
- Characteristic: Uses a symmetric normalization of the adjacency matrix to stabilize learning.
Stochastic Block Model (SBM)
The Stochastic Block Model (SBM) is a classical generative statistical model for random graphs. It defines a community structure where nodes are partitioned into blocks (communities). The probability of an edge existing between two nodes depends solely on their block memberships. It serves as a fundamental benchmark and theoretical model for link prediction.
- Mechanism: Defined by a block-assignment vector and a matrix of inter-block connection probabilities.
- Use Case: Modeling homophily (nodes in the same block connect more frequently) and providing a simple, interpretable baseline for link likelihood.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us