Question about the sub_graph

I have some graphs, and one of them has many nodes. So I want to get some sub_graph. At the same time, I don’t want to change the small graph. But when I get the sub_graph, the return graph is like this.


The sub_graph is different from the original graph. The sub_graph has ‘_ID: Scheme’, and the original graph doesn’t have this parameter. So when I concat the sub_graph and the small graph in one list and put them into the network, the program will show they have different types.
How should I solve this problem? Elsewhere, I’ve seen someone say they copy the graph again to make the sub_graph become a new graph, and I don’t know how to do this copy. Did DGL have some API?

Thank you for your reply.

By saying “concat the sub_graph and the small graph”, do you mean batching with dgl.batch? You could specify which features to concatenate with the ndata and edata argument in dgl.batch:

new_g = dgl.batch([g, new_g1], ndata=['feats'])