An efficient loop and clique coarsening algorithm for graph classification

Xiaorui Qi, Qijie Bai, Yanlong Wen, Haiwei Zhang, Xiaojie Yuan

Abstract

Graph Transformers (GTs) have made remarkable achievements in graph-level tasks. However, most existing works regard graph structures as a form of guidance or bias for enhancing node representations, which focuses on node-central perspectives and lacks explicit representations of edges and structures. One natural question arises as to whether we can leverage a hypernode to represent some structures. Through experimental analysis, we explore the feasibility of this assumption. Based on our findings, we propose an efficient Loop and Clique Coarsening algorithm with linear complexity for Graph Classification (LCC4GC) on GT architecture. Specifically, we build three unique views, original, coarsening, and conversion, to learn a thorough structural representation. We compress loops and cliques via hierarchical heuristic graph coarsening and restrict them with well-designed constraints, which builds the coarsening view to learn high-level interactions between structures. We also introduce line graphs for edge embeddings and switch to edge-central perspective to alleviate the impact of coarsening reduction. Experiments on eight real-world datasets demonstrate the improvements of LCC4GC over 31 baselines from various architectures.

Introduction

Graph Transformers (GTs) have revolutionized how we handle graph-structured data, but they have a lingering "node-centric" bias. Most models treat the graph's edges and motifs merely as auxiliary guidance to improve node embeddings. However, in many domains, such as chemistry or social network analysis, high-level structures like benzene rings or social cliques carry distinct semantic meaning that is often lost when treated only as relational bias.

Motivation: The Feasibility of Structural Coarsening

To address the limitations of node-centric models, researchers investigated whether high-level structures can be explicitly represented as "hypernodes." A key challenge in graph coarsening—merging nodes into a single entity—is the potential for information loss. If merging nodes makes distinct graphs look identical, the model's discriminative power decreases.

Comparison of graph structures (A-D) and their metrics across original and coarsened views.

As shown in the experimental analysis above, the study compared different graph pairs (A-B, A-C, etc.) and their coarsened counterparts. While coarsening simplifies the graph, it can lead to a "distribution shift" where the Euclidean distance and Cosine similarity between graphs change significantly. This finding motivated the multi-view approach of LCC4GC, which uses a line graph view to preserve the fine-grained connectivity lost during coarsening.

Methodology: The LCC4GC Framework

The proposed LCC4GC framework employs a three-pronged, multi-view approach to learn a thorough structural representation:

  1. Loop and Clique Coarsening (LCC): Instead of an exhaustive search, which is NP-hard for cliques, the authors use a heuristic algorithm with "hard constraints." They search for cliques within a specific hierarchy depth and loops up to a maximum length (typically 6). This keeps the search complexity linear—$O(V+E)$—making it feasible for large-scale graphs. These structures are then collapsed into hypernodes.
  2. Line Graph Conversion (LGC): To mitigate information loss from coarsening, the framework introduces a line graph view. In a line graph, the original edges become nodes. This forces the model to take an "edge-central" perspective, preserving the relative positional relationships that coarsening might otherwise obscure.
  3. Multi-View Fusion: The model processes three versions of the graph in parallel: the Original (node-centric), the Coarsened (structure-centric), and the Line Graph (edge-centric). Each view is processed by a Universal Graph Transformer (U2GNN) backbone, and the resulting embeddings are concatenated for final classification.

Experimental Results

The model was evaluated on eight real-world datasets from the TUDataset benchmark, covering social networks (COLLAB, IMDB), bioinformatics (D&D, PROTEINS), and molecules (NCI1). LCC4GC was compared against 31 baselines, including GNNs and other Graph Transformers.

  • Superior Accuracy: LCC4GC outperformed all baselines on most datasets, achieving an Average Ranking (A.R.) of 3.25, compared to 4.67 for the next best category of Graph Transformers.
  • Social Network Performance: The improvements were most dramatic in social networks. On the COLLAB dataset, LCC4GC reached 98.18% accuracy, a significant jump over the U2GNN backbone's 77.84%.
  • Efficiency: Despite the multi-view architecture, the algorithm remains highly efficient. For most datasets, computation time was under 2 seconds, confirming that the linear complexity $O(V+E)$ holds up in practice.

Conclusion

LCC4GC demonstrates that explicitly modeling high-level structures as hypernodes significantly improves graph classification performance. By balancing coarsening with an edge-centric line graph view, the model captures both global topology and local connectivity efficiently. Future work will explore extending this structural coarsening to dynamic graphs and incorporating a wider variety of graph motifs beyond loops and cliques.

Summary updated

BibTeX
@article{qi2024efficient,
  author = {Xiaorui Qi and Qijie Bai and Yanlong Wen and Haiwei Zhang and Xiaojie Yuan},
  title = {{An efficient loop and clique coarsening algorithm for graph classification}},
  journal = {Pattern Recognition},
  year = {2024},
}
Figure