Tensorflow and Pytorch implementation of a Graph Neural Network (GNN) model, referred to as GNN+ in this documentation.
The GNN+ model has versatile applications, including vertex clustering and graph classification. It excels in creating precise cluster assignments and can be a valuable tool for various graph-related tasks.
GNN+ comprises two essential components:
The GNNConv layer is a message-passing layer designed to minimize the
The CheegerCutPool is a graph pooling layer equipped with an internal MLP. It calculates cluster assignments and produces coarsened graphs for further processing.
GNN+ is suitable for both unsupervised vertex clustering and supervised graph classification. Its flexibility allows it to tackle a wide range of tasks in graph analysis.
In the unsupervised task of vertex clustering, GNN+ partitions vertices into clusters based on their features and graph topology. The model is trained using an unsupervised loss.
Graph classification is a supervised task aiming to predict the class of each graph. GNN+ alternates GNNConv layers with graph pooling layers to extract global label information from vertex representations.
This implementation is based on the Spektral library and follows the Select-Reduce-Connect API. To execute the code, first install the conda environment from tf_environment.yml
conda env create -f tf_environment.yml
The tensorflow/
folder includes:
- The implementation of the GNNConv layer
- The implementation of the CheegerCutPool layer
- An example script to perform the clustering task
- An example script to perform the classification task
This implementation is based on the Pytorch Geometric library. To execute the code, first install the conda environment from pytorch_environment.yml
conda env create -f pytorch_environment.yml
The pytorch/
folder includes:
- The implementation of the GNNConv layer
- The implementation of the CheegerCutPool layer
- An example script to perform the clustering task
- An example script to perform the classification task
GNN+ is now available on Spektral:
- GNNConv layer,
- CheegerCutPool layer,
- Example script to perform node clustering with GNN+.