Line graph contrastive learning for link prediction

Zehua Zhang, Shilin Sun, Guixiang Ma, Caiming ZhongPattern Recognition 2022

Abstract

Link prediction tasks focus on predicting possible future connections. Most existing researches measure the likelihood of links by different similarity scores on node pairs and predict links between nodes. However, the similarity-based approaches have some challenges in information loss on nodes and generalization ability on similarity indexes. To address the above issues, we propose a Line Graph Contrastive Learning (LGCL) method to obtain rich information with multiple perspectives. LGCL obtains a subgraph view by h-hop subgraph sampling with target node pairs. After transforming the sampled subgraph into a line graph, the link prediction task is converted into a node classification task, which graph convolution progress can learn edge embeddings from graphs more effectively. Then we design a novel cross-scale contrastive learning framework on the line graph and the subgraph to maximize the mutual information of them, so that fuses the structure and feature information. The experimental results demonstrate that the proposed LGCL outperforms the state-of-the-art methods and has better performance on generalization and robustness.

Introduction

Link prediction—the task of forecasting future or missing connections between nodes in a network—is a cornerstone of network science with applications ranging from social network recommendations to biological interaction discovery. Traditionally, this task relied on similarity-based heuristics, such as common neighbors or Jaccard coefficients. However, as illustrated in Figure 1, these methods often suffer from information loss and inconsistency when different similarity measures (e.g., structural vs. attribute-based) yield conflicting results.

Figure 1: Challenges in link prediction where different similarity measurements lead to prediction inconsistency.

To address these limitations, recent research has pivoted toward Graph Neural Networks (GNNs). While methods like SEAL treat link prediction as a subgraph classification task, they often lose granular edge-level details during pooling. Conversely, line graph transformations capture edge features but can introduce significant noise in dense networks. This paper introduces Line Graph Contrastive Learning (LGCL), a framework that bridges these perspectives by aligning global subgraph structures with local edge-centric views through contrastive learning.

Methodology

The LGCL framework operates in three primary stages to capture a holistic view of network connectivity:

  1. Dual-View Generation: For any target node pair, an $h$-hop subgraph is extracted. This subgraph is then transformed into a "line graph," where every edge in the original subgraph becomes a node in the new representation. This transformation allows standard GNN operations (like GCN) to learn edge embeddings directly, treating edges as first-class citizens.
  2. Cross-Scale Contrastive Learning: To fuse structural and feature information, LGCL employs two separate encoders for the subgraph and the line graph. A contrastive loss function is used to maximize the Mutual Information (MI) between these two views. This forces the model to find a representation that is consistent across both the global structural view (subgraph) and the local connectivity view (line graph), effectively filtering out noise.
  3. Hybrid Optimization: The model is trained using a multi-task loss function that combines supervised signals from both subgraph classification and line graph node classification, weighted alongside the self-supervised contrastive loss.

Experimental Evaluation

The authors evaluated LGCL on six public datasets spanning various domains to ensure robustness: Power (power grid), HPD, Fdataset, and ChCh-Miner (biological networks), ADV (social network), and SMG (co-authorship network). These datasets vary significantly in density (from 0.054% to 4.236%), providing a rigorous test for the model's ability to handle both sparse and dense graphs.

Key Results

LGCL consistently outperformed established baselines like SEAL and LGLP:

  • Accuracy: On the ChCh-Miner dataset, LGCL achieved an AUC of 97.67%, surpassing previous state-of-the-art results.
  • Robustness to Sparsity: In experiments where only 30% of the network edges were known, LGCL maintained significantly higher performance than similarity-based methods (like Katz or PageRank), which plummeted as data became scarcer.
  • Generalization: The model showed stable performance across all six datasets, suggesting it is not overfit to a specific type of network topology.

Conclusion

LGCL advances link prediction by leveraging the "dual perspective" of subgraphs and line graphs. By using contrastive learning as a regularizer, the model successfully balances global topology with local interaction details. While the computational complexity of line graph construction remains a consideration for massive networks, the improved accuracy and robustness make LGCL a powerful tool for complex network analysis.

Summary updated

BibTeX
@article{zhang2022line,
  author = {Zehua Zhang and Shilin Sun and Guixiang Ma and Caiming Zhong},
  title = {{Line graph contrastive learning for link prediction}},
  journal = {Pattern Recognition},
  year = {2022},
  url = {https://openreview.net/forum?id=YMZ2WpVoBR},
}
Figure