Home

Awesome

Revisiting and Benchmarking Graph Autoencoders: A Contrastive Learning Perspective

<p align="center"> <img src="./imgs/comparison.png" /> <p align="center"><em>Fig. 1. Comparison of different GAEs from contrastive learning perspective.</em></p>

We introduce the lrGAE (left-rigt GAE) benchmark --- graph autoencoders as contrastive learning architectures. lrGAE provides a new contrastive learning perspective of designing powerful GAEs from five dimensions:

The contrastive views is the key to design different yet advanced GAEs, which invovels three components: graph views, receptive fields, and node pairs.

Therefore, we have $2^3=8$ variants of lrGAE in terms of the contrastive views, shown below:

<p align="center"> <img src="./imgs/cases_table.png" /> <p align="center"><em>Table 1. Illustration of all possible cases of GAEs falling within the lrGAE frmework</em></p>

[!NOTE] Actually, we got 7 variants since lrGAE-1 is not applicable as a contrastive method. There are more than 7 variants of lrGAE, you can design more powerful GAEs by exploring different combinations of augmentation strategies, encoder/decoder networks, contrastive views, contrastive losses and even the negative sampling tricks.

💫 Environment Setup

Before you begin, please make sure that you have Anaconda or Miniconda installed on your system. This guide assumes that you have a CUDA-enabled GPU.

# Create and activate a new Conda environment named 'lrGAE'
conda create -n lrGAE python==3.12 -c conda-forge -y
conda activate lrGAE

# Install Pytorch 2.3.1 with CUDA 12.1 support
# If your use a different CUDA version, please refer to the PyTorch website for the appropriate versions.
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121

# Install PyG
pip install torch_geometric
# Install additional dependencies of PyG
pip install pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.3.0+cu121.html

Additional dependences of PyG can be found at https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html

🚀 Installation

Please make sure you have installed PyTorch and PyTorch Geometric (PyG).

# Coming soon
pip install -U lrgae

or

# Recommended
git clone https://github.com/EdisonLeeeee/lrGAE.git && cd lrGAE
pip install -e . --verbose

where -e means "editable" mode so you don't have to reinstall every time you make changes.

📍 Reproduction

Five graph-based learning tasks are supported:

👀 Implementations

<p align="center"> <img src="./imgs/cases.png" /> <p align="center"><em>Fig. 2. Illustration of seven possible cases of lrGAE.</em></p>