This is a TensorFlow implementation of Stealing links from Graph Neural Networks, as described in our paper:
Xinlei He, Jinyuan Jia, Michael Backes, Neil Zhenqiang Gong, Yang Zhang, Stealing Links from Graph Neural Networks (Usenix Security 2021)
We follows the instruction on https://github.com/tkipf/gcn to install gcn.
We provide the datasets used in our paper:
["AIDS", "COX2", "DHFR", "ENZYMES", "PROTEINS_full", "citeseer", "cora", "pubmed"]
Train GCN and MLP for all datasets.
Train GCN:
python3 train.py --dataset cora --model gcn
Train MLP:
python3 train.py --dataset cora --model dense
Split train / test for all datasets.
python3 partial_graph_generation.py --dataset cora
Note that all attacks rely on the partial graphs generated by Step 2.
python3 attack_0.py --dataset cora
Shadow dataset: dataset1; target dataset: dataset2
python3 attack_1.py --dataset1 citeseer --dataset2 cora
python3 attack_2.py --dataset cora
python3 attack_3.py --dataset cora
python3 attack_4.py --dataset1 citeseer --dataset2 cora
python3 attack_5.py --dataset1 citeseer --dataset2 cora
python3 attack_6.py --dataset cora
python3 attack_7.py --dataset1 citeseer --dataset2 cora
Note that in the code we use standard scaler to fit the training data and testing data separately as we assume that the adversary may acquire the whole testing data at the beginning.
ss = StandardScaler()
x_train = ss.fit_transform(x_train)
x_test = ss.fit_transform(x_test)
but please feel free to modify it into:
ss = StandardScaler()
x_train = ss.fit_transform(x_train)
x_test = ss.transform(x_test)
Please cite our paper if you use this code in your own work:
@inproceedings{HJBGZ21,
author = {Xinlei He and Jinyuan Jia and Michael Backes and Neil Zhenqiang Gong and Yang Zhang},
title = {{Stealing Links from Graph Neural Networks}},
booktitle = {{USENIX Security Symposium (USENIX Security)}},
publisher = {USENIX},
year = {2021}
}