from graphgallery.data import Graph
# Load the adjacency matrix A, attribute matrix X and labels vector y
# A - scipy.sparse.csr_matrix of shape [num_nodes, num_nodes]
# X - scipy.sparse.csr_matrix or np.ndarray of shape [num_nodes, num_attrs]
# y - np.ndarray of shape [num_nodes]
mydataset = Graph(adj_matrix=A, node_attr=X, node_label=y)
# save dataset
mydataset.to_npz('path/to/mydataset.npz')
# load dataset
mydataset = Graph.from_npz('path/to/mydataset.npz')
⭐ Road Map
Add PyTorch trainers support
Add other frameworks (PyG and DGL) support
set tensorflow as optional dependency when using graphgallery
Add more GNN trainers (TF and Torch backend)
Support for more tasks, e.g., graph Classification and link prediction
Support for more types of graphs, e.g., Heterogeneous graph
Add Docstrings and Documentation (Building)
Comprehensive tutorials
❓ FAQ
Please fell free to contact me if you have any troubles.
Please cite our paper (and the respective papers of the methods used) if you use this code in your own work:
@inproceedings{li2021graphgallery,
author = {Jintang Li and Kun Xu and Liang Chen and Zibin Zheng and Xiao Liu},
booktitle = {2021 IEEE/ACM 43rd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion)},
title = {GraphGallery: A Platform for Fast Benchmarking and Easy Development of Graph Neural Networks Based Intelligent Software},
year = {2021},
pages = {13-16},
publisher = {IEEE Computer Society},
address = {Los Alamitos, CA, USA},
}
TensorFlow or PyTorch, both!
GraphGallery
GraphGallery is a gallery for benchmarking Graph Neural Networks (GNNs) and Graph Adversarial Learning with TensorFlow 2.x and PyTorch backend. Besides, Pytorch Geometric (PyG) backend and Deep Graph Library (DGL) backend now are available in GraphGallery.
💨 NEWS
🚀 Installation
Please make sure you have installed PyTorch. Also, TensorFlow, Pytorch Geometric (PyG) and Deep Graph Library (DGL) are alternative choices.
or
where
-e
means “editable” mode so you don’t have to reinstall every time you make changes.🤖 Implementations
In detail, the following methods are currently implemented:
Node Classification
Defense models (for Graph Adversarial Learning)
Robust Optimization
Graph Purification
The graph purification methods are universal for all models, just specify:
so, here we only give the examples of
GCN
with purification methods, other models should work.LinkPrediction
Node Embedding
The following methods are framework-agnostic.
⚡ Quick Start on GNNs
Datasets
more details please refer to GraphData.
Example of GCN (Node Classification Task)
It takes just a few lines of code.
Other models in the gallery are the same.
If you have any troubles, you can simply run
trainer.help()
for more messages.Other Backends
But your codes don’t even need to change.
❓ How to add your datasets
This is motivated by gnn-benchmark
⭐ Road Map
graph Classification
andlink prediction
❓ FAQ
Please fell free to contact me if you have any troubles.
😘 Acknowledgement
This project is motivated by Pytorch Geometric, Tensorflow Geometric, Stellargraph and DGL, etc., and the original implementations of the authors, thanks for their excellent works!
Cite
Please cite our paper (and the respective papers of the methods used) if you use this code in your own work: