Abstract
Advanced graph neural networks (GNNs) have shown significant potential in graph classification tasks. Unlike node classification, graph classification requires hierarchical accumulation of topological information to generate discriminative graph-level embeddings. However, effectively exploring graph structures and formulating robust classification pipelines remains a challenge. This paper proposes SupCosine, a novel GNN framework based on supervised contrastive learning with structure inference. We introduce a data-driven graph augmentation strategy using diffusion cascades to recover hidden connections with high node similarity. Furthermore, we extend contrastive learning to a supervised "many-vs-many" setting using label information, pulling embeddings of the same class closer. Experimental results across benchmark datasets demonstrate that SupCosine achieves state-of-the-art performance by effectively exploring topological patterns.
Introduction
Graph classification is a fundamental task in domains like bioinformatics, social network analysis, and chemistry. While GNNs excel at local neighbor aggregation, they often struggle to capture global structural nuances necessary for distinguishing complex graphs. Recent trends have moved toward contrastive learning to improve feature extraction. However, standard contrastive methods often rely on naive augmentations (e.g., random edge dropping) that may destroy critical structural information and typically operate in a self-supervised manner, ignoring valuable class labels.
The SupCosine Framework
The proposed SupCosine framework addresses these limitations through three core components: structure inference, supervised contrastive learning, and a hierarchical GNN architecture.
Structure Inference via Diffusion Cascades
Rather than stochastic pruning, SupCosine employs a constructive augmentation strategy. By simulating information spread from root nodes using diffusion cascades, the model identifies nodes that exhibit high functional similarity despite a lack of direct connectivity. This process recovers a "salient" structure, enhancing the graph's edge set with inferred connections to provide a more informative view for contrastive tasks.
Supervised Contrastive Learning (SupGCon)
Traditional contrastive learning uses a "one-vs-many" approach, comparing a single positive pair against multiple negatives. SupCosine leverages ground-truth labels to implement a "many-vs-many" contrastive loss. This pulls all graph embeddings belonging to the same class closer together in the latent space while pushing different classes apart, significantly increasing the discriminative power of the learned representations.
Hierarchical GNN Architecture
The backbone of SupCosine is a hierarchical GNN designed to capture multi-level topological patterns. It utilizes Breadth-First Search (BFS) for sub-graph initialization, multiple Graph Isomorphism Network (GIN) layers for aggregation, and a ranking-based global pooling strategy to synthesize node features into a final graph-level vector.
Experimental Evaluation
The model was evaluated on four benchmark datasets: MUTAG, PTC, PROTEINS, and IMDB-BINARY.
Performance and Ablation Study
SupCosine achieved state-of-the-art (SOTA) results across all tested datasets. Notably, on the PTC dataset, it achieved an accuracy of 87.8%, representing a 10.3% improvement over previous benchmarks.
Ablation studies were conducted to verify the contribution of each component. As shown in the results, the combination of supervised contrastive loss (+SupGCon) and structure inference (+StruInf) consistently outperformed the base GNN model and individual components.
Conclusion
SupCosine demonstrates that data-driven augmentation and label-aware contrastive learning can significantly enhance graph classification. By inferring hidden structures and leveraging class information during the contrastive phase, the model produces more robust and discriminative embeddings. While the method introduces some computational overhead and hyper-parameter sensitivity, its superior performance and increased training stability mark a significant advancement in graph representation learning.
Summary updated