This is a niche corner case, but hopefully one with an easy-ish solution. If I create a DGL heterograph with no edges, trying to convert it with to_homogeneous raises an error from having no edges.
TypeError Traceback (most recent call last)
Cell In[24], line 1
----> 1 dgl.to_homogeneous(heterograph)
File dgl/convert.py:1026, in to_homogeneous(G, ndata, edata, store_type, return_count)
1022 edata = []
1023 comb_nf = combine_frames(
1024 G._node_frames, range(len(G.ntypes)), col_names=ndata
1025 )
-> 1026 comb_ef = combine_frames(
1027 G._edge_frames, range(len(G.etypes)), col_names=edata
1028 )
1029 if comb_nf is not None:
1030 retg.ndata.update(comb_nf)
File dgl/heterograph.py:6579, in combine_frames(frames, ids, col_names)
6576 else:
6577 del schemes[key]
-> 6579 if len(schemes) == 0:
6580 return None
6582 # concatenate the columns
TypeError: object of type 'NoneType' has no len()
Expected behavior
I was hoping DGL would simply be able to batch this through with all the other normal graphs. I think the error is due to this initial definition of schemes as None, and then skipping over each frame as they have 0 rows.
🐛 Bug
To Reproduce
This is a niche corner case, but hopefully one with an easy-ish solution. If I create a DGL heterograph with no edges, trying to convert it with
to_homogeneous
raises an error from having no edges.raises the error:
Expected behavior
I was hoping DGL would simply be able to batch this through with all the other normal graphs. I think the error is due to this initial definition of
schemes
as None, and then skipping over each frame as they have 0 rows.https://github.com/dmlc/dgl/blob/d92c98d927d6ef0c0bcb7475194495f6f417e091/python/dgl/heterograph.py#L6581
Would it be possible to incorporate a check for None for
schemes
?Environment
conda
,pip
, source):Additional context