Graph Instantiation Performance

I am using DGL for Reinforcement Learning with Graph Classification similar to https://docs.dgl.ai/guide/training-graph.html. Due to the nature of the task I have to instantiate a lot of small graphs which all have the same structure when sampling from the environment.

My graphs all have the same topology, but varying features/weights thus a deep-copy of a template graph and reassigning the features would be sufficient, but this is even slower than using dgl.graph(…) every time. The copy method of DGLGraph will not work since property references are then shared between instances. Is there another way to speed up this procedure?

Thanks for your help!

If the structure does not change, can you simply reuse it and only assign different features to it?

1 Like

Thanks, in the meantime I got to the same solution. Since I have varying batch-sizes this somehow did not come to my mind as fast as it should have.

1 Like

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