GLASS: GNN with Labeling Tricks for Subgraph Representation Learning

GLASS: GNN with Labeling Tricks for Subgraph Representation Learning

This repository is the official implementation of the model in the following paper:

Xiyuan Wang, Muhan Zhang. GLASS: GNN with Labeling Tricks for Subgraph Representation Learning. ICLR 2022.

@inproceedings{
glass,
title={GLASS: GNN with Labeling Tricks for Subgraph Representation Learning},
author={Xiyuan Wang and Muhan Zhang},
booktitle={International Conference on Learning Representations},
year={2022},
url={https://openreview.net/forum?id=XLxhEjKNbXj}
}

Requirements

Tested combination: Python 3.9.6 + PyTorch 1.9.0 + PyTorch_Geometric 1.7.2

Other required python libraries include: numpy, scikit-learn, pyyaml etc.

Prepare Data

You can download the realworld datasets here or from our mirror. Please download, unzip, and put them in ./dataset/. We follow the code provide by SubGNN to produce synthetic datasets. And we also provide the synthetic dataset we use in ./dataset_/.

The location of each dataset should be

CODE
├── dataset
│   ├── em_user
│   ├── hpo_metab
│   ├── ppi_bp
│   └── hpo_neuro
└── dataset_
    ├── density
    ├── coreness
    ├── component
    └── cut_ratio

Reproduce GLASS

To reproduce our results on synthetic datasets:

python GLASSTest.py --use_one --use_seed --use_maxzeroone --repeat 10 --device $gpu_id --dataset $dataset

where $dataset should be replace with the dataset you want to test, like density, component, coreness, and cut_ratio. $gpu_id should replace with the gpu you want to use. Set $gpu_id to -1 if you use cpu.

To reproduce our results on real-world datasets:

We have provided our SSL embeddings in ./Emb/. You can also reproduce them by

python GNNEmb.py --use_nodeid --device $gpu_id --dataset $dataset --name $dataset

Then

python GLASSTest.py --use_nodeid --use_seed --use_maxzeroone --repeat 10 --device $gpu_id --dataset $dataset

where $dataset can be selected from em_user, ppi_bp, hpo_metab, and hpo_neuro.

To reproduce GNN-seg

python GNNSeg.py --test  --repeat 10 --device $gpu_id --dataset $dataset

Use Your Own Dataset

Please add a branch in the load_dataset function in datasets.py to load your dataset and create a configuration file in ./config to describe the hyperparameters for the GLASS model.

Download Source Code

Download ZIP
Aug 3, 2022