deepgraph.deepgraph.DeepGraph.return_nx_multigraph¶
-
DeepGraph.
return_nx_multigraph
(features=False, relations=False, dropna=True)[source]¶ Return a
networkx.MultiDiGraph
representation.Create a
networkx.MultiDiGraph
representation of the graph given byv
ande
. As opposed toreturn_nx_graph
, where every row ofe
is treated as one edge, this method treats every cell ofe
as one edge. The input argumentfeatures
indicates which node properties to transfer.relations
indicates which edges to transfer. Whether to drop edges with NA values can be controlled bydropna
.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 inv
. If str or array_like, must be column name(s) ofv
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) ofe
. If False (default), all cells ofe
are translated to edges, but their values are not transferred as edge attributes. If True, all cells ofe
are translated, and their values are transferred as edge attributes. If str or array_like, must be column name(s) ofe
, restricting the translation of cells to edges toe[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
- 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