DGL cuda is_unibipartite differs from DGL cpu build

Dear DGL community,

I am experiencing weird behaviour when creating heterograph using dgl-cuda10.2. I created a graph that (if not mistaken) should not be unibipartite. Yet, DGL interprets the graph as unibipartite. The hassle is that the srctypes of the graph do not contain all the source nodes, preventing me from using multi_update_all.


G = dgl.heterograph(edges)
for nt in G.ntypes:
    print(nt, G.number_of_nodes(nt))
for et in G.canonical_etypes:
    print(et, G.number_of_edges(et))


a_id 310402
e_id 471745
e_type 3
e_year 253
i_id 24231
('e_id', 'involving', 'a_id') 3823709
('e_type', 'type_of', 'e_id') 471745
('e_year', 'year_of', 'e_id') 471745
('i_id', 'hosting', 'e_id') 471745
['e_type', 'e_year', 'i_id']
['a_id', 'e_id']

It seems to me that e_id should be listed among the srctypes.

Interestingly, when running the same code using the CPU build, DGL indicates the graph as not being unibipartite and all the nodes are among the srctypes.

Any suggestions?

Confirmed and will be fixed in https://github.com/dmlc/dgl/pull/2279.

Thank you for confirming the bug. I would like to ask whether there is any workaround you could suggest to avoid the error from multi_update_all (please see below)?

File “/home/ubuntu/anaconda3/envs/PyMGPU/lib/python3.7/site-packages/dgl/heterograph.py”, line 4585, in multi_update_all
g = self if etype is None else self[etype]
File “/home/ubuntu/anaconda3/envs/PyMGPU/lib/python3.7/site-packages/dgl/heterograph.py”, line 1973, in getitem
stid = self.get_ntype_id_from_src(srctype)
File “/home/ubuntu/anaconda3/envs/PyMGPU/lib/python3.7/site-packages/dgl/heterograph.py”, line 1102, in get_ntype_id_from_src
raise DGLError(‘SRC node type “{}” does not exist.’.format(ntype))
dgl._ffi.base.DGLError: SRC node type “e_id” does not exist.

You can try executing update_all for one edge type at a time, or install the nightly build if you are using Linux.