dgl.to_networkx

dgl.to_networkx(g, node_attrs=None, edge_attrs=None)[source]

Convert to networkx graph.

The edge id will be saved as the ‘id’ edge attribute.

Parameters:
  • g (DGLGraph or DGLHeteroGraph) – For DGLHeteroGraphs, we currently only support the case of one node type and one edge type.
  • node_attrs (iterable of str, optional) – The node attributes to be copied. (Default: None)
  • edge_attrs (iterable of str, optional) – The edge attributes to be copied. (Default: None)
Returns:

The nx graph

Return type:

networkx.DiGraph