In the paper, Discrete Diffusion-Based Model-Level Explanation of Heterogeneous GNNs with Node Features, we explain GNNs on a model-level by synthetically generating explanation graphs with node features from the underlying heterogeneous data.
The specifications of the machine used to run the code:
- OS:
Ubuntu 22.04.2 LTS - CPU:
AMD Ryzen 9 5900HX - GPU:
NVIDIA GeForce RTX 3070
-
For jupyter notebooks, create a conda environment using the environment.yml
conda env create --name DiGNNExplainer --file environment.ymlOr
-
Create a conda environment using the following commands:
conda create -n DiGNNExplainer python=3.10.6conda activate DiGNNExplainerconda install pytorch==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia -
Run
pip install package-namefor the following packages:notebooktorch-geometric==2.4.0matplotlib==3.5.3pandas==1.5.3python-louvain==0.16seaborn==0.12.2dgl==1.1.3import-ipynblittleballoffur==2.3.1rdkitpyemd==1.0.0easydict==1.13
- For
diffusion_graph_genandDiTabDDPMcreate a conda enviroment by following the installation steps of DiGress.
- To run experiments in evaluation Table 1 (in main paper),
-
Activate conda environment:
conda activate DiGNNExplainer -
Navigate to
evaluation/main-paper/realistic_graphs/MMDfolder and run the following command for each of the datasets -dblp,imdb,mutag,BA_shapes,Tree_Cycle,Tree_Grids,ba3. ForDBLPrunpython3 MMD_evaluation.py --dataset dblp
- To run all jupyter notebooks, for evaluation Tables 2 and 3 in main paper (
evaluation/main-paper), and experiments in supplementary material (evaluation/supplementary),
-
Activate conda environment:
conda activate DiGNNExplainer -
Run jupyter notebook:
jupyter notebook -
As an initial setup download the IMDB node features from here to
graph generator/diffusion models/sampled_features_diffusion/no_dependence/tabddpm/imdb.
- For graph generation and node feature generation,
-
To run
diffusion_graph_gen:-
Specify dataset in
graph generator/diffusion models/diffusion_graph_gen/configs/general/general_default.yaml:dataset_name: 'dblp' -
Navigate to
diffusion_graph_genfolder and runpython3 main.py
-
-
To generate the graphs for
baseline_vaerefer togvae.pyof GraphVAE implementation. -
To run
DiTabDDPMfor DBLP Author class:-
Specify dataset in
configs/config.yaml, and node class, node feature size ingraph generator/diffusion models/DiTabDDPM/configs/dataset/dblp.yaml:dataset: dblp node_class: 0 node_feature_size: 4 -
Navigate to
DiTabDDPMfolder and runpython3 main.py
-
-
To run original
TabDDPMfor DBLP Author class 0:-
Refer to TabDDPM for data preparation, and sample node features by running
pipeline.pywith the parameters:--config exp/author0/ddpm_cb_best/config.toml --train --sample
-
- To run code in
baseline_explainers,
- For
xgnn, refer to XGNN code. - For
gnninterpreter, refer to GNNInterpreter code and another GNNInterpreter implementation. - For
d4explainer, follow the installation steps of D4Explainer code.
- DBLP : https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.datasets.DBLP.html
- IMDB : https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.datasets.IMDB.html
- MUTAG : https://pytorch-geometric.readthedocs.io/en/2.6.0/generated/torch_geometric.datasets.TUDataset.html
- BA-Shapes : https://www.dgl.ai/dgl_docs/generated/dgl.data.BAShapeDataset.html
- Tree-Cycle : https://www.dgl.ai/dgl_docs/generated/dgl.data.TreeCycleDataset.html
- Tree-Grids : https://www.dgl.ai/dgl_docs/generated/dgl.data.TreeGridDataset.html
- BA-3Motif : https://github.com/Wuyxin/ReFine/tree/main/data/BA3/raw
@article{Das2025Discrete,
author = {Pallabee Das and
Stefan Heindorf},
title = {Discrete Diffusion-Based Model-Level Explanation of Heterogeneous GNNs with
Node Features},
journal = {CoRR},
volume = {abs/2508.08458},
year = {2025}
}