Revisiting Modularity Maximization for Graph Clustering: A Contrastive Learning Perspective

Yunfei Liu, Jintang Li, Yuehe Chen, Ruofan Wu, Ericbk Wang, Jing Zhou, Sheng Tian, Shuheng Shen, Xing Fu, Changhua Meng, Weiqiang Wang, Liang Chen · OpenReview

TL;DR

This paper bridges the gap between two powerful graph clustering techniques: modularity maximization and graph contrastive learning (GCL). They propose MAGI, a novel GCL framework that uses modularity maximization as a "community-aware" pretext task. MAGI achieves state-of-the-art performance and impressive scalability, even on graphs with 100 million nodes, by avoiding common GCL pitfalls like semantic drift and data augmentation.

What Problem Does This Paper Address?

Graph clustering, the task of grouping nodes in a graph into meaningful communities, is crucial for understanding complex networks. While Graph Contrastive Learning (GCL) has become a dominant approach, it often relies on graph augmentations that can lead to "semantic drift" (where the learned representations lose their original meaning) and scalability issues. Modularity maximization, a classic metric for community detection, is known to capture community structure well but its underlying mechanism for representation learning is not fully understood. This paper aims to reconcile these two approaches, leveraging the strengths of modularity maximization to improve GCL's performance and scalability.

Methods

The core of MAGI lies in reframing modularity maximization as a contrastive learning problem. Instead of relying on artificial graph augmentations, MAGI uses the inherent community structure of the graph to define positive and negative sample pairs.

  1. Modularity Maximization as Contrastive Learning: The authors show that the modularity maximization objective can be interpreted as a contrastive task where nodes within the same community are considered positive pairs, and nodes in different communities are negative pairs. This connection is established by reformulating the modularity objective.
  2. Community-Aware Pretext Task: MAGI employs a two-stage random walk process to generate mini-batches for training. This process effectively captures "high-order proximity" (relationships beyond direct neighbors) and helps construct a modularity matrix for the mini-batch. This avoids the need for full graph augmentation and addresses scalability concerns.
  3. GNN Encoder and SimCLR Loss: A Graph Neural Network (GNN) encoder is used to learn node representations. These representations are then optimized using the SimCLR contrastive loss, which is known for its effectiveness in controlling representation uniformity and separation.

Datasets

The paper evaluates MAGI on a diverse set of datasets:

  • Small-scale: Cora, CiteSeer, Photo, Computers
  • Large-scale: ogbn-arxiv, Reddit, ogbn-products
  • Extra-large scale: ogbn-papers100M (111 million nodes, 1.6 billion edges)

These datasets cover various sizes and characteristics, allowing for a comprehensive evaluation of MAGI's performance and scalability.

Key Insights and Ideas

  • Modularity Maximization is Implicit Contrastive Learning: The paper's central insight is that modularity maximization inherently defines positive and negative sample pairs based on community structure, making it a natural fit for contrastive learning. This bridges a conceptual gap between traditional community detection and modern representation learning.
  • Community Structure as a Semantic Anchor: By using modularity maximization, MAGI leverages the graph's intrinsic community structure to guide representation learning. This helps prevent "semantic drift," a common issue in GCL where learned representations can become detached from their original meaning.
  • Scalability through Random Walks: The novel two-stage random walk sampling method is key to MAGI's scalability. It allows for efficient computation of the modularity matrix on mini-batches, making it feasible to train on massive graphs without requiring excessive memory or computation.
  • High-Order Proximity Matters: The random walk approach effectively captures high-order proximity, which is crucial for accurately identifying communities, especially in complex networks.

Key Results

  • State-of-the-Art Performance: MAGI consistently outperforms or matches state-of-the-art baselines across various datasets and metrics (Accuracy, NMI, ARI, F1).
  • Exceptional Scalability: MAGI successfully scales to an industrial-scale graph with 100 million nodes (ogbn-papers100M), demonstrating significant performance improvements over baselines that struggle with such large graphs. For instance, on ogbn-papers100M, MAGI shows an approximate ~14.4% improvement in accuracy over K-means and ~11.3% over Node2vec.
  • Robustness to Semantic Drift: Experimental results (Figure 3) show that MAGI generates higher-quality pseudo-labels compared to other augmentation-free GCL methods, indicating its effectiveness in mitigating semantic drift.
  • Efficiency: MAGI exhibits competitive or superior time and space complexity compared to other methods, especially those that leverage both graph and feature information.

Limitations and Future Work

  • Hyperparameter Sensitivity: While MAGI is generally stable, its performance can be sensitive to hyperparameters like temperature (τ) and the number/depth of random walks, as shown in the ablation studies (Figures 4 and 5).
  • Future Work: The authors suggest that their work serves as a reminder to re-evaluate simpler, overlooked alternatives in graph clustering. The straightforward nature of MAGI could inspire further research into leveraging intrinsic graph properties for representation learning. The paper also hints at exploring the benefits of high-order proximity further through experimental investigation.

Summary updated

BibTeX
@inproceedings{liu2024revisiting,
  author = {Yunfei Liu and Jintang Li and Yuehe Chen and Ruofan Wu and Ericbk Wang and Jing Zhou and Sheng Tian and Shuheng Shen and Xing Fu and Changhua Meng and Weiqiang Wang and Liang Chen},
  title = {{Revisiting Modularity Maximization for Graph Clustering: A Contrastive Learning Perspective}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
  url = {https://openreview.net/forum?id=b2WIkJRG2E},
}
Figure