Need help with HGP-SL?

Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

151 Stars 21 Forks 21 Commits 2 Opened issues

Hierarchical Graph Pooling with Structure Learning

Readme

Hierarchical Graph Pooling with Structure Learning (Preprint version is available on arXiv).

This is a PyTorch implementation of the HGP-SL algorithm, which learns a low-dimensional representation for the entire graph. Specifically, the graph pooling operation utilizes node features and graph structure information to perform down-sampling on graphs. Then, a structure learning layer is stacked on the pooling operation, which aims to learn a refined graph structure that can best preserve the essential topological information.

- python3.6
- pytorch==1.5.0
- torch-scatter==2.0.4
- torch-sparse==0.6.4
- torch-cluster==1.5.4
- torch-geometric==1.5.0

Note: This code repository is heavily built on pytorch_geometric, which is a Geometric Deep Learning Extension Library for PyTorch. Please refer here for how to install and utilize the library.

Graph classification benchmarks are publicly available at here.

This folder contains the following comma separated text files (replace DS by the name of the dataset):

**n = total number of nodes**

**m = total number of edges**

**N = number of graphs**

**(1) DS_A.txt (m lines)**

*sparse (block diagonal) adjacency matrix for all graphs, each line corresponds to (row, col) resp. (node id, nodeid)*

**(2) DS graphindicator.txt (n lines)**

*column vector of graph identifiers for all nodes of all graphs, the value in the i-th line is the graph id of the node with nodeid i*

**(3) DS graphlabels.txt (N lines)**

*class labels for all graphs in the dataset, the value in the i-th line is the class label of the graph with graph_id i*

**(4) DS nodelabels.txt (n lines)**

*column vector of node labels, the value in the i-th line corresponds to the node with node_id i*

There are OPTIONAL files if the respective information is available:

**(5) DS edgelabels.txt (m lines; same size as DSAsparse.txt)**

*labels for the edges in DS Asparse.txt*

**(6) DS edgeattributes.txt (m lines; same size as DS_A.txt)**

*attributes for the edges in DS_A.txt*

**(7) DS nodeattributes.txt (n lines)**

*matrix of node attributes, the comma seperated values in the i-th line is the attribute vector of the node with node_id i*

**(8) DS graphattributes.txt (N lines)**

*regression values for all graphs in the dataset, the value in the i-th line is the attribute of the graph with graph_id i*

To run HGP-SL, just execute the following command for graph classification task:

python main.py

| Datasets | lr | weight*decay | batch*size | pool*ratio | dropout | net*layers |
| ------------- | --------- | -------------- | -------- | -------- | -------- | ---------- |
| PROTEINS | 0.001 | 0.001 | 512 | 0.5 | 0.0 | 3 |
| Mutagenicity | 0.001 | 0.001 | 512 | 0.8 | 0.0 | 3 |
| NCI109 | 0.001 | 0.001 | 512 | 0.8 | 0.0 | 3 |
| NCI1 | 0.001 | 0.001 | 512 | 0.8 | 0.0 | 3 |
| DD | 0.0001 | 0.001 | 64 | 0.3 | 0.5 | 2 |
| ENZYMES | 0.001 | 0.001 | 128 | 0.8 | 0.0 | 2 |

If you find HGP-SL useful for your research, please consider citing the following paper:

@article{zhang2019hierarchical, title={Hierarchical Graph Pooling with Structure Learning}, author={Zhang, Zhen and Bu, Jiajun and Ester, Martin and Zhang, Jianfeng and Yao, Chengwei and Yu, Zhi and Wang, Can}, journal={arXiv preprint arXiv:1911.05954}, year={2019} }