deepgraph.deepgraph.DeepGraph.return_gt_graph¶
-
DeepGraph.
return_gt_graph
(features=False, relations=False, dropna='none', node_indices=False, edge_indices=False)[source]¶ Return a
graph_tool.Graph
representation.Create a
graph_tool.Graph
(directed) representation of the graph given byv
ande
. Node and edge properties to transfer can be indicated by thefeatures
andrelations
input arguments. Whether to drop edges with NA values in the subset of types of relations given byrelations
can be controlled bydropna
. If the nodes inv
are not indexed by consecutive integers starting from 0, one may internalize the original node and edge indices as propertymaps by settingnode_indices
and/oredge_indices
to True.Parameters: - features (bool, str, or array_like, optional (default=False)) – Indicates which types of features to internalize as
graph_tool.PropertyMap
. Can be column name(s) ofv
, False or True. If False, create no propertymaps. If True, create propertymaps for every column inv
. If str or array_like, must be column name(s) ofv
indicating which types of features to internalize. - relations (bool, str, or array_like, optional (default=False)) – Indicates which types of relations to internalize as
graph_tool.PropertyMap
. Can be column name(s) ofe
, False or True. If False, create no propertymaps (all edges ine.index
are transferred, regardless ofdropna
). If True, create propertymaps for every column ine
(all edges ine.index
are transferred, regardless ofdropna
). If str or array_like, must be column name(s) ofe
indicating which types of relations to internalize (which edges are transferred can be controlled bydropna
). - 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) ine[relations]
where any NA values are present. If ‘all’, drop all edges (rows) ine[relations]
where all values are NA. Only has an effect ifrelations
is str or array_like. - node_indices (bool, optional (default=False)) – If True, internalize a vertex propertymap
i
with the original node indices. - edge_indices (bool, optional (default=False)) – If True, internalize edge propertymaps
s
andt
with the original source and target node indices of the edges, respectively.
Returns: gt_g
Return type: graph_tool.Graph
Notes
If the index of
v
is not pd.RangeIndex(start=0,stop=len(v
), step=1), the indices will be enumerated, which is expensive for large graphs.- features (bool, str, or array_like, optional (default=False)) – Indicates which types of features to internalize as