How to add/delete nodes/edges in blocks?


Is there an efficient way to add/delete nodes/edges in a sampled block, e.g. blocks returned by sampler.sample_blocks()? I tried to convert blocks to a subgraph and used DGLGraph.remove_nodes() or DGLGraph.remove_edges() to manipulate it. After this, I converted the subgraph back to the blocks by using the full neighborhood sampler with the destination node ids (mapped in this subgraph). However, it seems to be inefficient so is there a better way to do this in DGL?

P.S. I used blocks because I need the NodeDataLoader, which returns blocks.

Could you instead add or remove edges in the neighbor sampler? You can take a look at the example here

Sorry for the late reply! Thank you, this tutorial is helpful for me to address the problem! :smiley: