Docs β’ Overview of the Benchmark β’ Installation β’ Quick Start β’ References
OpenGU is an open-source benchmark platform for Graph Unlearning (GU). It facilitates the evaluation and development of GU methodologies by providing standardized datasets, state-of-the-art GU algorithms, and versatile tools. OpenGU integrates 16 SOTA GU algorithms and 37 multi-domain datasets, supporting a variety of downstream tasks across 13 GNN backbones. This unified framework enables flexible unlearning requests and ensures comprehensive and fair evaluations of GU methods, addressing the unique challenges posed by complex relational data.
To advance Graph Unlearning (GU) research and establish a standardized evaluation framework, OpenGU provides the following key contributions:
- Comprehensive Benchmark: OpenGU integrates 16 SOTA GU algorithms and 37 multi-domain datasets, offering a unified framework to support flexible 3Γ3 combinations of unlearning requests and downstream tasks.
- Analytical Insights: Through extensive experiments, OpenGU evaluates GU methods across effectiveness, efficiency, and robustness, providing 8 key insights that highlight existing limitations and guide future research.
- Open-source Library: OpenGU is designed as an open-source benchmark library with a unified API, detailed documentation, and user-friendly interfaces, fostering collaboration and innovation in the GU community.
OpenGU offers a robust and standardized benchmark for evaluating Graph Unlearning methods. It ensures a fair comparison between different approaches by providing consistent datasets, evaluation metrics, and experimental setups. This benchmark is instrumental in advancing research in Graph Unlearning, promoting reproducibility, and accelerating innovation in the field.
Graph Unlearning (GU) scenarios are fundamentally data-driven, making the meticulous selection of datasets indispensable for evaluating the effectiveness of graph unlearning strategies. To assess the effectiveness, efficiency, and robustness of these methods for node and edge-related tasks, we have carefully selected 19 graph datasets. Additionally, for graph-level tasks in diverse application areas, we have selected 18 graph classification datasets.
- Citation Networks: Cora, Citeseer, PubMed, DBLP, ogbn-arxiv
- Co-author Networks: CS, Physics
- Co-purchasing Network: Photo, Computers, ogbn-products
- Rating Networks: Amazon-ratings
- Wiki-page Networks: Squirrel, Chameleon
- Actor Networks: Actor
- Game Synthetic Networks: Minesweeper
- Crowdsourcing Networks: Tolokers
- Article Syntax Networks: Roman-empire
- Social Networks: Questions
- Image Networks: Flickr
- Compounds Networks: MUTAG, PTC-MR, BZR, COX2, DHFR, AIDS, NCI1, ogbg-molhiv, ogbg-molpcba
- Protein Networks: ENZYMES, DD, PROTEINS, ogbg-ppa
- Movie Networks: IMDB-BINARY, IMDB-MULTI
- Collaboration Networks: COLLAB
- Point Cloud Networks: ShapeNet
- Super-pixel Networks: MNISTSuperPixels
For detailed statistics on the datasets used in our evaluation, see the following file:
OpenGU introduces flexible preprocessing capabilities to support diverse experimental needs:
-
Custom Dataset Splitting:
- Enables arbitrary dataset split ratios for tailored training and testing sets.
- Supports both balanced and random label distributions.
-
Inference Scenarios:
- Allows datasets to operate under both transductive and inductive inference settings, enabling comprehensive evaluations.
To evaluate the generalizability of GU algorithms, we incorporate three predominant paradigms of GNN models within our benchmark: Traditional GNNs, Sampling GNNs, and Decoupled GNNs. Each category encompasses a variety of state-of-the-art models, providing a comprehensive foundation for assessing Graph Unlearning methods. In total, OpenGU integrates 13 GNN backbones.
| Traditional GNNs | Sampling GNNs | Decoupled GNNs |
|---|---|---|
| πΉ GCN | πΈ GraphSAGE | πΉ SGC |
| πΉ GCNII | πΈ GraphSAINT | πΉ SSGC |
| πΉ LightGCN | πΈ ClusterGCN | πΉ SIGN |
| πΉ GAT | πΉ APPNP | |
| πΉ GATv2 | ||
| πΉ GIN |
Our framework encompasses 16 state-of-the-art GU algorithms, meticulously reproduced based on source code or detailed descriptions in relevant publications. These algorithms are categorized into Partition-based, IF-based (Influence Function-based), Learning-based, and Others, each leveraging distinct strategies for effective graph unlearning.
| Partition-based | IF-based | Learning-based | Others |
|---|---|---|---|
| πΈ GraphEraser | πΉ GIF | πΈ GNNDelete | πΉ UtU |
| πΈ GUIDE | πΉ CGU | πΈ MEGU | πΉ Projector |
| πΈ GraphRevoker | πΉ CEU | πΈ SGU | |
| πΉ GST | πΈ D2DGN | ||
| πΉ IDEA | πΈ GUKD | ||
| πΉ ScaleGUN |
OpenGU assesses Graph Unlearning (GU) algorithms across three key dimensions: Effectiveness, Robustness, and Efficiency.
Real-world scenarios often require simultaneous removal of nodes and edges. OpenGU supports cross-task evaluations, enabling a comprehensive assessment when multiple unlearning types interact in diverse tasks.
- Node Classification (Accuracy, Precision, F1): Ensures unlearning does not harm performance on retained nodes.
- Link Prediction (AUC-ROC): Checks that removing edges does not degrade predictive accuracy.
- Security Attacks:
- MIA (AUC-ROC ~ 0.5): Confirms minimal information leakage on whether a node was in training.
- Poisoning Attack: Improved link prediction after malicious edges are removed indicates successful unlearning.
We test GU algorithms under varying deletion intensities, noise, and sparsity. Robust solutions should exhibit minimal performance drop when more data is removed or degraded.
Evaluated on scalability, time complexity, and space complexity:
- Scalability: Performance consistency across different dataset sizes.
- Time Complexity: Computational cost analyzed both theoretically and empirically.
- Space Complexity: Memory usage and storage overhead during unlearning.
- Python: 3.8.0
To manage dependencies, it's recommended to use a virtual environment.
python -m venv venv
venv\Scripts\activate # Windows
# or
source venv/bin/activate # Unix/MacOSconda create -n myenv python=3.8
conda activate myenvYou can install OpenGU using one of the following methods:
To install OpenGU directly from PyPI:
pip install openguTo install OpenGU for local development, clone the GitHub repository and install it from the source:
-
Clone the Repository
git clone <REPO-URL> cd OpenGU
-
Install OpenGU in Editable Mode
pip install -e .
For GPU support, install the appropriate versions of PyTorch, CuPy, and related libraries that match your CUDA version.
Here is the updated version with the required versions added:
-
Install PyTorch and torchvision with CUDA Support
Example for CUDA 12.1 (PyTorch version 2.2.1 and torchvision version 0.17.1):
pip install torch==2.2.1 torchvision==0.17.1 torchaudio --index-url https://download.pytorch.org/whl/cu121
Please ensure you install the required versions:
torch==2.2.1andtorchvision==0.17.1. -
Install CuPy with CUDA Support
Example for CUDA 12.x:
pip install cupy-cuda12x
Ensure your system has the appropriate CUDA version installed. For more information, refer to the CuPy Installation Guide.
Before installing the general dependencies, please ensure you have installed the required versions of PyTorch and torchvision.
Install the general dependencies listed in the requirements.txt file:
pip install -r requirements.txtFor torch_scatter, torch_geometric, and torch_sparse, if you encounter compilation issues, it's recommended to install the prebuilt wheels directly from the official PyTorch Geometric website. Below are installation examples based on the CUDA version:
-
Visit the PyTorch Geometric Installation Guide to find the appropriate wheel links.
-
Example installation for CUDA 12.1:
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.2.1+cu121.html pip install torch-sparse -f https://data.pyg.org/whl/torch-2.2.1+cu121.html pip install torch-geometric
-
If using a different CUDA version, replace
cu121in the URL with your specific version (e.g.,cu118for CUDA 11.8).
Make sure to check the compatibility matrix on the official PyTorch Geometric website for the correct version of torch, torchvision, and other libraries.
If you are using the ScaleGUN unlearning method, you need to compile and install the dependencies manually. Navigate to the following directory:
cd OpenGU/GULib-master/unlearning/unlearning_methods/ScaleGUN/progation_pkgThen, run the following commands:
pip install cython
pip install eigency
python setup.py build_ext --inplaceThese steps will compile the necessary Cython extensions for the progation_pkg module.
After installation, verify that OpenGU is installed correctly by running:
python -c "import opengu; print(opengu.__version__)"Follow these steps to quickly get started with OpenGU:
git clone <REPO-URL>
cd OpenGUYou can install the general dependencies using pip:
pip install -r requirement.txtFor CUDA-specific dependencies, refer to the detailed instructions in the Installation section above.
After installing the dependencies, you can run the main script using the following command:
python GULib-master/main.py --cuda 0 --dataset_name <dataset_name> --base_model <base_model> --unlearning_methods <unlearning_methods> --unlearn_task <unlearn_task> --downstream_task <downstream_task> --num_epochs 100 --batch_size 64--cuda <cuda_device>: Specify which GPU to use. Replace<cuda_device>with the desired GPU number.--dataset_name <dataset_name>: The name of the graph dataset. Replace<dataset_name>with a dataset from the list:cora,citeseer,pubmed,CS,Physics,flickr,ppi,Photo,Computers,DBLP,ogbl,ogbn-arxiv,ogbn-products.--base_model <base_model>: The model architecture to use. Options includeGCN,GAT,GIN,SAGE,MLP, etc.--unlearning_methods <unlearning_methods>: The unlearning method to use. Choose fromGraphEraser,GUIDE,CEU, etc.--unlearn_task <unlearn_task>: The type of unlearning task. Options arefeature,node, andedge.--downstream_task <downstream_task>: The type of downstream task. Options arenodeandedge.--num_epochs <num_epochs>: Number of epochs to run.--batch_size <batch_size>: The batch size to use.
Note that the above list includes only a subset of the available parameters. For more parameters and their descriptions, please refer to the GULib-master/parameter_parser.py file.
To run the GCN model using GraphEraser for node-level unlearning and node-level downstream tasks, you can run the following command:
python GULib-master/main.py --cuda 0 --dataset_name cora --base_model GCN --unlearning_methods GraphEraser --unlearn_task node --downstream_task node --num_epochs 100 --batch_size 64This command will:
- Use the GCN model
- Apply GraphEraser as the unlearning method
- Perform node-level unlearning and node-level downstream tasks
- Use the cora dataset
- Train for 100 epochs with a batch size of 64
We welcome contributions from the community to enhance OpenGU. Whether it's adding new methods, datasets, or improving documentation, your input is valuable.
- Fork the Repository: Create a fork of the OpenGU repository on GitHub.
- Create a Branch: Develop your feature or fix on a separate branch.
- Submit a Pull Request: Once your changes are ready, submit a pull request for review.
- Report Issues: If you encounter any issues or have suggestions, feel free to open an issue on GitHub.
Please ensure that your contributions adhere to the project's coding standards and include appropriate tests.


