AttributeError: 'DGLHeteroGraph' object has no attribute 'adj_sparse'

Hi all,

I am trying to read the OAG dataset:
https://s3.us-west-2.amazonaws.com/dgl-data/dataset/OAG/oag_max_paper.dgl

I want to extract the CSR format tensors using this:
https://docs.dgl.ai/generated/dgl.DGLGraph.adj_sparse.html

I have added the following code at line 517 in https://github.com/jadadong/GNS/blob/main/GNS_sampling_prob.py:

csr_g = graph.adj_sparse(‘csr’)

and I got this error:
AttributeError: ‘DGLHeteroGraph’ object has no attribute ‘adj_sparse’

Any idea how to fix it?

Thanks!

which dgl version are you using?

I use the latest version, I guess: conda install -c dglteam dgl-cuda11.5

I have figured it out to use this instead:

csr_g = graph.adj(scipy_fmt=‘csr’)

This solves my problem.

Thanks!