Convert Networkx graphs to DGL data

Hello,

I want to use DGL to do learning on graphs. My graphs are in networkx data structure. They are heterogeneous. I mean that each graph has some nodes with different types and different attributes. The edge type is also different between different nodes. They are all implemented in networkx. Now, I want to know if I can convert these graphs in networkx directly to DGL data using from_networkx() or if I need to do some extra operations?

dgl.from_networkx only works for homogeneous graphs. For heterogeneous graphs, either use dgl.heterograph or it might be possible to create a homogeneous graph with node/edge types stored as node/edge features first and then use dgl.to_heterogeneous.