Various number of nodes in input data

Dear all,

I want to some supervised node classification. I want to ask if I can set the various input nodes number in the Graph? Due to some reasons, the nodes’ numbers differ from each input. For example, sample 1 in the batch has 5 nodes and sample 2 has 7 nodes. Is it possible to train such a graph?


Sounds like you can do something as follows.

import dgl

g1 = dgl.graph(..., num_nodes=5)
g2 = dgl.graph(..., num_nodes=7)
bg = dgl.batch([g1, g2])
1 Like

Thank you for the reply!

Is it possible if I train a graph with 7 nodes, and want to do node classification on a graph with 5 nodes?
I want to do Human Object Interaction detection, therefore the number of objects in the scene can differ.

Many thanks.

Yes, it’s possible. This is typically called inductive learning.

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