Implementing HeteroRGCN

Hi, apologies, this is a rookie question. I am trying to implement the HeteroRGCN from the tutorial for a node classification problem and I need some clarification on how to associate the nodes in my hetero-graph with their labels.
referring to this code snippet in the tutorial:
pvc = data['PvsC'].tocsr()
# find all papers published in KDD, ICML, VLDB
c_selected = [0, 11, 13] # KDD, ICML, VLDB
p_selected = pvc[:, c_selected].tocoo()
# generate labels
labels = pvc.indices
labels[labels == 11] = 1
labels[labels == 13] = 2
labels = torch.tensor(labels).long()
Do the label indices for a particular node type have to be sorted in ascending order corresponding to the nodes for that type in the heterograph or? Given that all the nodes in the heterograph are numbered together irrespective of node type.

What’s the tutorial you are talking about?

This one: https://docs.dgl.ai/en/0.4.x/tutorials/hetero/1_basics.html

Which part of sorting are you referring to?

Sorry for the late reply and the bother. I get it now, I misconstrued how the IDs for the different types are assigned and confused myself. Quick question: Is there a way to retrieve the Node IDs for a node type from the heterograph directly from the DGL API?

Could you elaborate your question? E.g. were you converting between a homogeneous graph and a heterogeneous graph?

Hi, I instantiated the heterograph in DGL using edge tuples. I am asking if I can get the node IDs for a particular node type (say Paper) using DGL? I have them but just wondering if the DGL api can do this?

DGL naturally assigns node with consecutive integer identifiers starting from 0.

1 Like