Skip to content

malikhizar/DyH2GNet

Repository files navigation

DyH2GNet

Self-supervised Time-aware Heterogeneous Hypergraph Learning for Dynamic Graph-level Classification

DyH2GNet is a novel algorithm for learning high-order temporal patterns in dynamic graphs. It constructs heterogeneous hypergraphs by combining structural and semantic interactions and employs a self-supervised learning (SSL) mechanism to enhance graph-level classification. This repository provides the code implementation as described in the paper.


Framework Overview

The framework processes dynamic graphs through consecutive snapshots. It constructs heterogeneous hypergraphs using $k$-hop neighborhoods for structural interactions and node correlation for behavioral interactions. DyH2GNet employs time-aware graph augmentations, intra/inter-snapshot attentions, and contrastive loss to generate embeddings that capture temporal dynamics effectively.

See Algorithm 1 in our paper for a step-by-step explanation of the process.

DyH<sub>2</sub>GNet Framework

Code Structure

Core Files:

  • dataset_loader.py: Loads and preprocesses datasets.
  • kMatrix.py: Generates $k$-specific matrices for structural interactions.
  • sMatrix.py: Generates correlation-based matrices for behavioral interactions.
  • hypergraphGen.py: Constructs the heterogeneous hypergraph from structural and behavioral matrices.
  • models/: Contains modules for:
    • Intra- and inter-snapshot node and hyperedge attention mechanisms.
    • Temporal attention, contrastive loss, and pooling layers.
  • train_dyh2gnet.py: Implements the training process for DyH2GNet.
  • analysis/: Evaluation scripts for:
    • Graph Similarity Ranking
    • Anomaly Detection
    • Trend Analysis
    • Ablation Analysis

Prerequisites

  • Python 3.8 or above
  • PyTorch Geometric 2.4.0
  • NumPy 1.26.0
  • SciPy 1.11.0
  • NetworkX 3.1
  • Matplotlib 3.7.2
  • tqdm 4.65.0

Datasets

This implementation supports dynamic graph datasets. Example datasets include:

  • Enron (communication network)
  • Facebook (social interactions)
  • Reddit GOT (user discussions)
  • Formula1 (sports events)

Place dataset files (e.g., .pkl format) in the data/ folder for training and evaluation.


Usage

  1. Clone the repository: git clone https://github.com/YOUR_USERNAME/DyH2GNet.git, then cd DyH2GNet
  2. pip install -r requirements.txt
  3. Place the dataset files in the data/ folder
  4. Train the model python train_dyh2gnet.py
  5. Evaluate the model:
  • python analysis/graph_similarity_ranking.py
  • python analysis/anomaly_detection.py
  • python analysis/trend_analysis.py
  • python analysis/ablation_analysis.py

Contribution

Pull requests are welcome. For major changes or any issues, please open an issue first for discussion. For further inquiries, contact the first author at malik.khizar@hdr.mq.edu.au or khizerhayat92@gmail.com.

License

MIT

Citation

If you use this work, please cite the following:

@inproceedings{Hayat2025DyH2GNet,
  author    = {Malik Khizar Hayat and Shan Xue and Jia Wu and Bilal Khan and Jian Yang},
  title     = {Self-supervised Time-aware Heterogeneous Hypergraph Learning for Dynamic Graph-level Classification},
  booktitle = {Proceedings of the ACM International Conference on Web Search and Data Mining (WSDM)},
  year      = {2025}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages