Understanding LinkNeighborLoader #6402
-
Hi everybody, I am trying to understand exactly how the LinkNeighborLoader works in practice with HeteroGraphs. I have this minimal example:
Here a graph contains 3 distinct types of nodes('A','B','C') and 2 types of edges ('edge_1','edge_2') that connect respectively 'A' to 'B' and 'A' to 'C'. However, the batches that the loader returns only contain the nodes 'A' and 'B':
Why does this happen? Furthermore, I noticed that if I reverse the direction of the second edge to make it point from 'C' to 'A' I am obviously misunderstanding something here. In my view, the LinkNeighborLoader should create a subgraph of the neighbours of both the root nodes of the sampled edge. Thank you in advance for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Ok, this makes perfect sense as the LinkNeighborLoader samples only neighbours from which the label node is reachable and not vice versa. I was looking at it wrong. :) |
Beta Was this translation helpful? Give feedback.
-
HI @GianlucaDeStefano , If i want a negative sampling only on ['A', 'edge_1', 'B'] edge , where as both edges should participate in message passing . I need to pass as edge_label_index = ['A', 'edge_1', 'B'] . right? |
Beta Was this translation helpful? Give feedback.
Ok, this makes perfect sense as the LinkNeighborLoader samples only neighbours from which the label node is reachable and not vice versa. I was looking at it wrong. :)