How to make a heterograph type into a normal graph type?

Is there a way of converting a Heterograph to a normal graph?
I was running an old GraphSAGE tutorial script I had that worked prior to the recent update, but now when I try to run I get the error Expected type graph.Graph but get graph.HeteroGraph.

I tried something naive like g = dgl.graph(g.edges()) but this still returns a Heterograph. Is there an easy way to switch between the two?

Can you provide instructions to reproduce the error?

the code is exactly the same in this tutorial – the only bits that I have changed are dgl.DGLGraph() calls to dgl.graph(). The error occurs when you try and run loss = model(train_g, features, neg_sample_size) (NB I have commented out the first half of the tutorial so this relates to the unsupervised link prediction section).

1 Like

I think that tutorial is outdated. You can probably get it to work with previous versions of DGL, say 0.4.3post2. For link prediction with DGL 0.5.0+, you can refer to our user guide 5.3 Link Prediction.

1 Like