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.
The framework processes dynamic graphs through consecutive snapshots. It constructs heterogeneous hypergraphs using
See Algorithm 1 in our paper for a step-by-step explanation of the process.
- 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
- 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
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.
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/DyH2GNet.git
, thencd DyH2GNet
- pip install -r requirements.txt
- Place the dataset files in the
data/
folder - Train the model
python train_dyh2gnet.py
- Evaluate the model:
python analysis/graph_similarity_ranking.py
python analysis/anomaly_detection.py
python analysis/trend_analysis.py
python analysis/ablation_analysis.py
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.
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}
}