Add edges to blocks

Is there a way to add edges to blocks? I saw a 3-year-old post which suggested there isn’t any.
I wrote a custom node sampler that excludes specific edge IDs. This leads to the MFG blocks to have 0 in-degrees. I have tried adding a loop to the original graph, but it does not resolve the issue. If I can add the self-loops manually to the block, I might be able to resolve this issue.
Wondering if there is a way to achieve this now.

does block.add_edges() works? dgl.DGLGraph.add_edges — DGL 2.0.0 documentation

This doesn’t work. Throws an error regarding the types of nodes being more than 1.

could you share how you add and the direct error log?

Since DGL2.0, GraphBolt is introduced and it’s the recommended framework for data loading and sampling. In GraphBolt, you could add new edges directly into the SampledSubGraph as it’s in CSC format if no edge feature is required. If edge feature is required, you may generate new edge IDs that could be used for feature fetch from FeatureStore. You could refer to exclude_edges API in https://github.com/dmlc/dgl/blob/00f33224038924c40229bb9c6f8dbe6d0b083960/python/dgl/graphbolt/sampled_subgraph.py#L22.

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