Subgraph sampling

I’m trying to manually implement a subgraph sampler fro link prediction. Samples selecte N random edge indexes, and builds a subgraph from the original graph just with those edge. It this approach valid or by omiting those edges am I losing some neighbor information in the message passing?

Thanks.

Depends on how connected your edges are. I remember the original RGCN paper uses this approach, but ensures that the edges are connected. If every single sampled edge is isolated as a single disconnected component then I’m pretty sure that the GNN would not work.

1 Like

Thanks. Then, is there any fast way to check if there is a path in the subgraph?

I meant when you sample edges and construct a subgraph only from the edges, you need to ensure that the edges are connected. For instance, you could run a random walk and get the edges you have traversed. So you don’t actually have to check whether the graph is disconnected or not.

Yes, I understood. I meant how could I run that random walk, id there is a defined method or something like that or I need to hard code it.

Try dgl.sampling.random_walk.

1 Like

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