Skip to content

A simple PyTorch implementation of Graph Convolutional Networks based on the paper: https://arxiv.org/abs/1609.02907 (Kipf & Welling, ICLR 2017)

Notifications You must be signed in to change notification settings

ebrahimpichka/GCN-pt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PyTorch implementation of Graph Convolutional Networks

PyTorch implementation of Graph Convolutional Networks (GCNs) based on (Kipf & Welling, ICLR 2017)

Main Components

Graph Convolution Layer:

The Graph Convolution layer module is implemented in gc_layer.py file as GraphConvolution class. It follows the official PyTorch layer module interface.

This module computes the following expression as part of message passing mechanism:

graph convolution layer

where the D⁻¹/²ÃD⁻¹/² part is received as an input argument to the forward method in sparse matrix tensor format and the node features H is also recieved as an in*put argument to the forward method.


Graph Convolutional Network (GCN):

The main Graph Convolutional Network module is implemented in gcn.py file as GCN class. The forward method performs a full two-layer GCN operation on the given input features based on the paper as shown below:

graph convolution layer

The module requires the number of input features (nfeat), number of hidden features (nhid), number of output classes (nclass), dropout rate (dropout), and PyTorch device object (device) as input args for instantiation.


Tests:

The implemented GCN is tested on the KarateClub toy dataset from PyG in the test.ipynb notebook.