1

I am currently training a model which is a mix of graph neural networks and LSTM. However that means for each of my training sample, I need to pass in a list of graphs. The current batch class in torch_geometric supports batching with torch_geometric.data.Batch.from_data_list() but this only allows one graph for each data point. How else can I go about batching the graphs?

Sparky05
  • 4,692
  • 1
  • 10
  • 27
tangolin
  • 434
  • 5
  • 15
  • Did you find a proper way to do this? I am running into the same issue where I want to put N graphs into one big super graph. But I have no clue how to start even with the top rated answer. Any help is appreciated. – PEREZje Jun 06 '22 at 10:00

1 Answers1

0

Use diagonal batching:

https://pytorch-geometric.readthedocs.io/en/latest/notes/batching.html

Simply, you will put all the graphs as subgraphs into one big graph. All the subgraphs will be isolated.

See the example from TUDataset: https://colab.research.google.com/drive/1I8a0DfQ3fI7Njc62__mVXUlcAleUclnb?usp=sharing

BraveDistribution
  • 445
  • 1
  • 4
  • 18