Revisiting Graph Contrastive Learning on Anomaly Detection from a Structural Imbalance Perspective

July 16, 2025 ยท View on GitHub

Code structure

folderdescription
DataDatasets.
AD-GCLAD-GCL implementation code is provided.

Datasets

Dataset# Nodes# Edges# Attribute# Anomalies
Cora2,7085,4291,4335.5%
Citeseer3,3274,7323,7034.5%
Pubmed19,71744,3385003.0%
Bitcoinotc5,88135,5921285.1%
BITotc4,86328,4731286.2%
BITalpha3,21919,3641289.3%

Usage

# Cora
python ./AD-GCL/run.py --dataset 'cora' --lr 5e-3 --num_epoch 200 --threshold 7 --gpu_id 0

# Citeseer
python ./AD-GCL/run.py --dataset 'citeseer' --lr 3e-3 --num_epoch 200 --threshold 6 --gpu_id 0

# Pubmed
python ./AD-GCL/run.py --dataset 'pubmed' --lr 4e-3 --num_epoch 100 --threshold 8 --gpu_id 0

# Bitcoinotc
python ./AD-GCL/run.py --dataset 'bitcoinotc' --lr 4e-4 --num_epoch 100 --threshold 8 --gpu_id 0

# BITotc
python ./AD-GCL/run.py --dataset 'bitotc' --lr 5e-4 --num_epoch 100 --threshold 7 --gpu_id 0

# BITalpha
python ./AD-GCL/run.py --dataset 'bitalpha' --lr 5e-3 --num_epoch 100 --threshold 8 --gpu_id 0

Dependencies

  • Python 3.8.13
  • PyTorch 1.12.1
  • dgl 0.4.3.post1
  • Scipy 1.9.1
  • Tqdm 4.64.1

Reference

If you find this repository useful in your research, please consider citing the following paper:

@inproceedings{xu2025revisiting,
  title={Revisiting Graph Contrastive Learning on Anomaly Detection: A Structural Imbalance Perspective},
  author={Xu, Yiming and Peng, Zhen and Shi, Bin and Hua, Xu and Dong, Bo and Wang, Song and Chen, Chen},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={39},
  number={12},
  pages={12972--12980},
  year={2025}
}