Abstract
Graph classification has gained significant attention due to its applications in chemistry, social networks, and bioinformatics. While Graph Neural Networks (GNNs) effectively capture local structural patterns, they often overlook global topological features that are critical for robust representation learning. In this work, we propose GraphTCL, a dual-view contrastive learning framework that integrates structural embeddings from GNNs with topological embeddings derived from persistent homology. By aligning these complementary views through a cross-view contrastive loss, our method enhances representation quality and improves classification performance. Extensive experiments on benchmark datasets, including TU and OGB molecular graphs, demonstrate that GraphTCL consistently outperforms state-of-the-art baselines. This study highlights the importance of topology-aware contrastive learning for advancing graph representation methods.
Introduction
Most modern Graph Neural Networks rely on "message passing," where nodes aggregate information from their immediate neighbors. While this is highly effective for capturing local patterns, it has a fundamental flaw: it is "nearsighted." GNNs often struggle to perceive the "big picture"—global topological structures like large cycles, connectivity patterns, or voids that define the overall shape of a graph. This limitation is theoretically linked to the 1-Weisfeiler-Lehman (1-WL) test, which serves as a ceiling on how well a GNN can distinguish different graph structures.
Previous attempts to address this usually involve injecting topological features, such as those from Persistent Homology (PH), directly into the GNN as auxiliary inputs. However, this approach often blurs the distinction between local features and global topology, potentially leading to inconsistent representations where the GNN and the topological features conflict in the latent space.
The GraphTCL Framework
The proposed GraphTCL framework introduces a dual-view contrastive learning approach. Instead of forcing topology into the GNN, it treats structural and topological information as two complementary perspectives of the same graph.
Dual-View Architecture
- The Structural View: A standard GNN backbone (such as GIN or GCN) processes node features and local edges to generate a structural embedding. This captures the immediate neighborhood motifs.
- The Topological View: The model utilizes Persistent Homology (PH) to extract a "topological fingerprint." By using a filtration function like the Heat Kernel Signature (HKS), the model "scans" the graph at different scales to identify which loops and components persist. These features are vectorized and processed through a lightweight Multi-Layer Perceptron (MLP).
Cross-View Contrastive Alignment
The core innovation of GraphTCL is the interaction between these views. The framework employs a bidirectional InfoNCE loss to force the structural and topological embeddings of the same graph to be close in a shared latent space, while pushing embeddings of different graphs apart. This alignment ensures that the GNN learns to be aware of global connectivity, acting as a powerful regularizer. Finally, these aligned views are concatenated for the final classification task.
Experimental Results
GraphTCL was evaluated on two major benchmark collections:
- TU Benchmark Collection: Across seven datasets (including MUTAG, BZR, and IMDB-BINARY), GraphTCL achieved the best performance on six. Notably, on the PTC and BZR datasets, it outperformed previous state-of-the-art methods like TopoGCL by up to 6%.
- Open Graph Benchmark (OGB): On five large-scale molecular datasets, adding the GraphTCL framework to standard GCN and GIN backbones provided an average improvement of 3.7% to 3.8%.
Key Insights
- Alignment vs. Fusion: Ablation studies confirmed that contrastive alignment—forcing the two views to agree—consistently outperforms "naive fusion" (simple concatenation without contrastive loss).
- Complementary Strengths: GNNs excel when local motifs dominate, while TDA excels when global connectivity is the key differentiator. GraphTCL allows the model to leverage both strengths dynamically.
- Efficiency: Despite the inclusion of TDA, the topological branch remains lightweight due to the use of an MLP, making it suitable for large-scale tasks.
Conclusion and Future Work
GraphTCL demonstrates that topology-aware contrastive learning can significantly enhance graph representations by bridging the gap between local message passing and global structural awareness. While currently focused on graph-level classification, future work may extend this cross-view logic to node-level tasks or explore "learnable" filtration functions to further increase the expressive power of the topological view.
Summary updated