Abstract
Link prediction is a fundamental task on graphs. Inspired by traditional path-based methods, we propose a general and flexible representation learning framework based on paths for link prediction. We define the representation of a pair of nodes as the generalized sum of all path representations, with each path representation as the generalized product of the edge representations in the path. Motivated by the Bellman-Ford algorithm, we show that this path formulation can be efficiently solved by a generalized Bellman-Ford algorithm. We propose the Neural Bellman-Ford Network (NBFNet), which parameterizes this algorithm with three neural components: INDICATOR, MESSAGE, and AGGREGATE. NBFNet is general, covering many traditional path-based methods, and applies to both homogeneous and multi-relational graphs in transductive and inductive settings. Experiments show NBFNet outperforms existing methods by a large margin, achieving new state-of-the-art results.
Introduction
Link prediction—predicting whether a connection exists between two nodes—is a cornerstone of graph machine learning, powering applications from friend recommendations to drug discovery. Historically, researchers have relied on two main approaches: path-based heuristics and modern Graph Neural Networks (GNNs). Path-based methods like the Katz Index or Personalized PageRank are interpretable and inductive but rely on handcrafted formulas that may fail to capture complex patterns. Conversely, GNNs learn powerful representations but often struggle with inductive settings (generalizing to unseen graphs) or computational scalability when analyzing local subgraphs for every node pair.
The Neural Bellman-Ford Network (NBFNet) bridges this gap by "neuralizing" the classic Bellman-Ford algorithm. It offers the high capacity of GNNs with the scalability and inductive strengths of path-based algorithms.
The NBFNet Framework
The core innovation of NBFNet is the realization that most traditional path-based metrics can be expressed as a "generalized sum" of "generalized products" along paths. This formulation is efficiently solvable using a generalized Bellman-Ford algorithm. Instead of fixed mathematical operators, NBFNet utilizes learnable neural components:
- INDICATOR: Defines the boundary condition, starting traversal from a specific source node.
- MESSAGE: Replaces the multiplication operator, learning how to transform information across edges to model relational logic.
- AGGREGATE: Replaces the summation operator, combining information from multiple paths arriving at the same node.
By iterating these components $T$ times, the model explores all paths up to length $T$ in parallel. This allows it to compute the relationship between a source node and all other nodes simultaneously, making it significantly faster than methods that extract subgraphs for every individual pair. Furthermore, since the model is built on path summation, it offers interpretability; the authors use Taylor expansions to identify which specific paths contributed most to a prediction.
Experimental Evaluation
NBFNet was evaluated across several diverse benchmarks, including Knowledge Graphs (FB15k-237, WN18RR), Homogeneous Graphs (Cora, CiteSeer, PubMed), and large-scale OGB datasets.
Performance and Efficiency
NBFNet achieved significant performance gains over previous state-of-the-art (SOTA) methods. In Knowledge Graph completion, it outperformed the best previous path-based method (DRUM) by an average of 18% on the HITS@1 metric. In inductive settings, it outperformed GraIL by 22% on HITS@10.
Beyond performance, NBFNet is remarkably efficient. While subgraph-based methods like GraIL can take nearly a month for full test set inference, NBFNet completes the same task in just 4 minutes. It is also parameter-efficient, using only 3M parameters on FB15k-237 compared to 30M for classic embedding models like TransE.
Inductive Generalization
Because NBFNet learns how to traverse (the operators) rather than learning specific node IDs (embeddings), it is inductive by design. It can be trained on one graph and immediately applied to a completely different graph with new entities, a critical requirement for real-world evolving graphs.
Conclusion
NBFNet provides a powerful, interpretable, and efficient framework for link prediction. By parameterizing the Bellman-Ford algorithm, it combines the structural guarantees of path-based methods with the flexibility of deep learning. Future work includes extending the framework to complex logical queries and integrating richer node features into the message-passing process.
Summary updated