NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Fused Gromov-Wasserstein Approach to Subgraph Contrastive Learning

Amadou S. Sangare, Nicolas Dunou, Jhony H. Giraldo, Fragkiskos D. Malliaros

Abstract

Self-supervised learning (SSL) has become a key method for training deep learning models when labeled data is scarce or unavailable. While graph machine learning holds great promise across various domains, the design of effective pretext tasks for self-supervised graph representation learning remains challenging. Contrastive learning, a popular approach in graph self-supervised learning, leverages positive and negative pairs to compute a contrastive loss function. However, current graph contrastive learning methods often struggle to fully use structural patterns and node similarities. To address these issues, we present a new method called Fused Gromov Wasserstein Subgraph Contrastive Learning (FOSSIL). Our model integrates node-level and subgraph-level contrastive learning, seamlessly combining a standard node-level contrastive loss with the Fused Gromov-Wasserstein distance. This combination helps our method capture both node features and graph structure together. Importantly, our approach works well with both homophilic and heterophilic graphs and can dynamically create views for generating positive and negative pairs. Through extensive experiments on benchmark graph datasets, we show that FOSSIL outperforms or achieves competitive performance compared to current state-of-the-art methods.

Introduction

Graph Neural Networks (GNNs) have revolutionized the way we process relational data, yet their performance often depends on large amounts of labeled data. Self-supervised learning (SSL), particularly contrastive learning, has emerged as a powerful alternative. By learning to distinguish between augmented "views" of the same data point, models can capture meaningful representations without human intervention.

However, graph contrastive learning faces unique challenges. Most existing methods treat node features and graph topology as separate entities, failing to capture the complex interplay between a node's identity and its structural context. Furthermore, many models rely on the assumption of "homophily"—that connected nodes are similar—which fails in "heterophilic" environments like fraud detection or protein-protein interactions. Finally, the common practice of using random edge dropping or feature masking to create views can inadvertently destroy critical structural information.

To overcome these limitations, we introduce FOSSIL (Fused Gromov-Wasserstein Subgraph Contrastive Learning), a framework designed to jointly optimize feature and structural alignment while remaining robust to varying graph types.

The FOSSIL Framework

Fused Gromov-Wasserstein (FGWD) Distance

The core innovation of FOSSIL is the use of the Fused Gromov-Wasserstein distance as a metric for subgraph comparison. While standard Optimal Transport (Wasserstein distance) compares sets of features and the Gromov-Wasserstein distance compares relational structures, FGWD combines both. By utilizing a trade-off parameter ($\alpha$), FOSSIL can align both node features and graph topology simultaneously, ensuring that the learned representations are sensitive to both "who" a node is and "where" it is located.

Decoupled Encoder and Adaptive Fusion

To address the "heterophily trap," FOSSIL employs a dual-path decoupled encoder. One path consists of a Multi-Layer Perceptron (MLP) that focuses strictly on raw node features, while the other is a standard GNN that captures structural dependencies. An adaptive fusion layer learns to weight these paths based on the graph's characteristics. In heterophilic graphs, where neighbors are dissimilar, the model can learn to rely more heavily on the MLP path, preventing the "smoothing" effect that often degrades performance in such settings.

Learnable View Generation

Rather than relying on stochastic perturbations like random edge dropping, FOSSIL utilizes a Graph Attention Network (GAT) as a learnable generator. This generator is trained to create adaptive views of the graph, producing more informative positive and negative pairs for the contrastive loss. This ensures that the structural patterns essential for the downstream task are preserved rather than destroyed by random noise.

Scalability via Subgraph Sampling

A significant hurdle for Optimal Transport methods is computational complexity, typically $O(N^3)$. FOSSIL maintains efficiency by shifting the contrastive task from the global graph level to the subgraph level. By sampling small subgraphs of a fixed size $k$, the complexity of the FGWD calculation becomes constant relative to the total graph size $N$. This allows the model to scale to massive datasets while still capturing rich local contexts.

Experimental Results

We evaluated FOSSIL across a diverse set of benchmarks, including homophilic citation networks (Cora, CiteSeer, PubMed) and heterophilic datasets (Actor, Chameleon, Squirrel).

Performance on Heterophily

FOSSIL demonstrated significant gains on heterophilic datasets, where traditional GNNs often struggle. For instance, on the Chameleon dataset, FOSSIL achieved an accuracy of 53.14%, surpassing the previous state-of-the-art method, MUSE (52.11%). This success is attributed to the decoupled encoder and the FGWD metric's ability to balance feature and structural information.

The Role of Alpha ($\alpha$)

Ablation studies revealed a clear intuition regarding the $\alpha$ parameter in the FGWD metric. In homophilic graphs, the best performance occurred at $\alpha \approx 0.5$, indicating that features and structure are equally informative. Conversely, in heterophilic graphs, performance peaked as $\alpha$ approached 1.0, effectively prioritizing node features when the surrounding graph structure was noisy or misleading.

Large-Scale Scalability

Using the "FOSSILv2" variant, we tested the framework on large-scale benchmarks like OGBN-Arxiv and OGBN-Proteins. By restricting the contrastive loss to sampled subgraphs, the model achieved $O((|S|k)^2 D)$ memory complexity, proving its viability for industrial-scale graph applications.

Conclusion

FOSSIL represents a significant step forward in self-supervised graph representation learning. By integrating the Fused Gromov-Wasserstein distance with a decoupled architecture and learnable perturbations, it provides a robust solution for both homophilic and heterophilic graphs. While the current approach uses breadth-first search for subgraph sampling, future work may explore more sophisticated, data-driven sampling strategies to further refine the quality of contrastive pairs and extend the framework to tasks like link prediction and whole-graph classification.

Summary updated

BibTeX
@article{sangare2024fused,
  author = {Amadou S. Sangare and Nicolas Dunou and Jhony H. Giraldo and Fragkiskos D. Malliaros},
  title = {{A Fused Gromov-Wasserstein Approach to Subgraph Contrastive Learning}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2024},
  url = {https://openreview.net/forum?id=J7cY9Jr9WM},
}
Figure