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 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. If the nodes in v are not indexed by consecutive integers starting from 0, one may internalize the original node and edge indices as propertymaps by setting node_indices and/or edge_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) of v, False or True. If False, create no propertymaps. If True, create propertymaps for every column in v. If str or array_like, must be column name(s) of v 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) of e, False or True. If False, create no propertymaps (all edges in e.index are transferred, regardless of dropna). If True, create propertymaps 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 internalize (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.
  • 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 and t 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.