How to add nodes/edges to heterograph

Hi,

I got an error of ‘DGLError: Mutation is not supported in heterograph.’ when I try to add nodes/edges to a dgl.graph object. What I did was using the homograph API add_nodes/add_edge on a dgl.graph object.
Here is my code:
g = dgl.graph([])
g.add_nodes(3)
g.add_edge(1,2)
Is these API not supported for heterograph? Or is there any other methods to add nodes/edges to a dgl.graph in a loop instead of adding at the instantiation of a dgl.graph?

Hi, currently we only support add_nodes and add_edge for homogeneous graph. For heterogeneous graphs, you cannot modify their topology once they are constructed. Is it possible for you to perform these operations before constructing them, e.g. modifying an edge list ?

Thanks. I have tried this way to construct graph. Do you have plans to support these APIs for heterograph in the future?

Yes, we plan to support this in v0.5.

Hi do you currently support it in the latest nightly version?

Yes. For example, you can find add_nodes here. Meanwhile, it is subject to change before the formal release.