deepgraph.deepgraph.DeepGraph.return_nx_multigraph

DeepGraph.return_nx_multigraph(features=False, relations=False, dropna=True)

Return a networkx.MultiDiGraph representation.

Create a networkx.MultiDiGraph representation of the graph given by v and e. As opposed to return_nx_graph, where every row of e is treated as one edge, this method treats every cell of e as one edge. The input argument features indicates which node properties to transfer. relations indicates which edges to transfer. Whether to drop edges with NA values can be controlled by dropna.

Needs pandas >= 0.17.0.

Parameters:
  • features (bool, str, or array_like, optional (default=False)) – Indicates which types of features to transfer as node attributes. Can be column name(s) of v, False or True. If False, create no node attributes. If True, create node attributes for every column in v. If str or array_like, must be column name(s) of v indicating which types of features to transfer.
  • relations (bool, str, or array_like, optional (default=False)) – Indicates which cells of e to transfer as edges. Can be False, True, or a (list of) column name(s) of e. If False (default), all cells of e are translated to edges, but their values are not transferred as edge attributes. If True, all cells of e are translated, and their values are transferred as edge attributes. If str or array_like, must be column name(s) of e, restricting the translation of cells to edges to e[relations] (values are transferred as edge attributes).
  • dropna (bool, optional (default=True)) – Whether to drop edges with NA values. Cells in e with NA values are not translated to edges.
Returns:

nx_g

Return type:

networkx.MultiDiGraph

See also

return_nx_graph(), return_cs_graph(), return_gt_graph(), return_sparse_tensor()