Hello everyone
i was wondering is it possible to use LSTM instead of mean_nodes, to do graph classification when input graphs have variable sizes (nodes/edges) ? so basically each node representation is a word, and each directed graph has a start/root node, so i guess to generate the node representation sequence i can use BFS, then give the sequence to LSTM, but i am not sure how to implement it with dgl.
if it is possible, is there any downside to this approach compared to averaging the node representations?
and if it is possible, can someone show me to right way to do it in pytorch? this is my forward() right now:
def forward(self, g , h):
for i, layer in enumerate(self.layers):
if i != 0:
h = self.dropout(h)
h = layer(g, h)
g.ndata['h'] = h
hg = dgl.mean_nodes(g, 'h')
return self.classify(hg)