# Rethinking Causal Relationships Learning in Graph Neural Networks

# CRCG

## Installation
- Main packages: PyTorch >= 1.5.0, Pytorch Geometric >= 1.7.0.

## Dataset
Graph-SST5 and Graph-Twitter can be downloaded at https://github.com/divelab/DIG/tree/main/dig/xgraph/datasets
- Spurious-Motif: this dataset can be generated via `spmotif_gen/spmotif.ipynb`. 
- CRCG: this dataset can be generated via `spmotif_gen/CRCG-MTOIF.ipynb` or`spmotif_gen/CRCG-NODE.ipynb`

`spmotif_gen/CRCG-MTOIF.ipynb` corresponds to the scene under different confounder magnitudes, which are adjusted according to probability.

`spmotif_gen/test3.ipynb`  corresponds to the scene under different cofounder magnitudes, which are adjusted according to size.

`spmotif_gen/CRCG-NODE.ipynb` corresponds to the scene under different confounder magnitudes, which are adjusted according to the complexity of the relationship between the confounder and the causal factor.
## Requirements
pip -r requirements.txt

## Run
The hyper-parameters used to train the models are set as default in the argparse.ArgumentParser in the training files.

ERM+R-CAM: python CRCG_dir_legnn+RCAM.py

DIR+R-CAM: python CRCG_dir+RCAM.py
