How do I modify graph classification model to take a pair of graphs as input rather than just one graph?

I have pairs of graphs and each pair has a class. I am trying to follow along the tutorial to take input of 2 graphs and their label rather than a single graph? How do I do this? I’m really stuck

You could have a dataset that returns two graphs and their label at a time and use GraphDataLoader to load it:

class PairGraphDataset(object):
    def __init__(self, ...):
    def __getitem__(self, i):
        return self.graph1[i], self.graph2[i], self.label[i]

dataloader = dgl.dataloading.GraphDataLoader(PairGraphDataset(...), ...)

Thanks! I have actually implemented this part already, however where I am stuck comes down to calculating the graph embeddings… Do I just calculate them one at a time?

Yes you could. That serves as a sensible baseline.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.