Drop Edges in Computation Graph

I am working on a custom GraphConv or GraphSage model for stochastic training. I want to drop particular edges (assuming I have the edge IDs for these edges) in each block. One way to do this is to drop these in each MFG manually. However, this process makes an extremely slow model. Is there a way I can mask or drop specific edges in a certain block of the computation graph?

How about applying a 0-1 mask on the edges and treat them as edge weights? SAGEConv supports an edge_weights argument, which essentially multiplies the passed message. So a 0 edge weight means that the message will not pass along that edge.

1 Like

Since DGL2.0, GraphBolt is the recommended way for data loading and sampling. Could you try with exclude_edges in https://github.com/dmlc/dgl/blob/00f33224038924c40229bb9c6f8dbe6d0b083960/python/dgl/graphbolt/sampled_subgraph.py#L115. Before look deep into it, you may go through the tutorial for GraphBolt first. 🆕 Stochastic Training of GNNs with GraphBolt — DGL 2.0.0 documentation