I am trying to implement a graph classification experiment using Graph Convolutional Networks (GCN) in DGL. I have read the GCN example in DGL but that example uses the Citation-Graph dataset (Cora, PubMed, …) which only has a single large graph.
I have implemented my own dataset class, which loads a list of DGL graphs (self.dgl_graphs
) and list of associated labels (self.labels
) and contains the following methods:
-
__len__(self)
: returns the number of graphslen(self.dgl_graphs)
. -
__getitem__(self, i)
: returns a pair(self.dgl_graphs[i], self.labels[i])
.
This is a binary-classification problem so the labels for each sample graph is either 0
or 1
. Each sample graph has tens of nodes/edges and each node has an associated tensor.
Can someone help me by providing the minimal code to train and evaluate this task using the built-in GCN module in DGL (dgl.nn.pytorch.conv.GraphConv
)?
If GCN is not suitable for this task, please provide a minimal code based on another preferred built-in NN module in DGL.