deepgraph.deepgraph.DeepGraph.return_nx_graph

DeepGraph.return_nx_graph(features=False, relations=False, dropna='none')

Return a networkx.DiGraph representation.

Create a networkx.DiGraph representation of the graph given by v and e. Node and edge properties to transfer can be indicated by the features and relations input arguments. Whether to drop edges with NA values in the subset of types of relations given by relations 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 types of relations to transfer as edge attributes. Can be column name(s) of e, False or True. If False, create no edge attributes (all edges in e.index are transferred, regardless of dropna). If True, create edge attributes for every column in e (all edges in e.index are transferred, regardless of dropna). If str or array_like, must be column name(s) of e indicating which types of relations to transfer (which edges are transferred can be controlled by dropna).
  • dropna (str, optional (default='none')) – One of {‘none’,’any’,’all’}. If ‘none’, all edges in e.index are transferred. If ‘any’, drop all edges (rows) in e[relations] where any NA values are present. If ‘all’, drop all edges (rows) in e[relations] where all values are NA. Only has an effect if relations is str or array_like.
Returns:

nx_g

Return type:

networkx.DiGraph

See also

return_nx_multigraph(), return_cs_graph(), return_gt_graph(), return_sparse_tensor()