class_docstr: The core class of DeepGraph (dg).
  
  This class encapsulates the graph representation as ``pandas.DataFrame``
  objects in its attributes ``v`` and ``e``. It can be initialized with a
  node table ``v``, whose rows represent the nodes of the graph, as well
  as an edge table ``e``, whose rows represent edges between the nodes.
  
  Given a node table ``v``, it provides methods to iteratively compute
  pairwise relations between the nodes using arbitrary, user-defined
  functions. These methods provide arguments to parallelize the
  computation and control memory consumption (see ``create_edges`` and
  ``create_edges_ft``).
  
  Also provides methods to partition nodes, edges or an entire graph by
  the graph's properties and labels, and to create common network
  representations and graph objects of popular Python network packages.
  
  Furthermore, it provides methods to visualize graphs and their
  properties and to benchmark the graph construction parameters.
  
  Optionally, the convenience parameter ``supernode_labels_by`` can be
  passed, creating supernode labels by enumerating all distinct (tuples
  of) values of a (multiple) column(s) of ``v`` . Superedge labels can be
  created analogously, by passing the parameter ``superedge_labels_by``.
  
  Parameters
  ----------
  v : pandas.DataFrame or pandas.HDFStore, optional (default=None)
      The node table, a table representation of the nodes of a graph. The
      index of ``v`` must be unique and represents the node indices. The
      column names of ``v`` represent the types of features of the nodes,
      and each cell represents a feature of a node. Only a reference to
      the input DataFrame is created, not a copy. May also be a
      ``pandas.HDFStore``, but only ``create_edges`` and
      ``create_edges_ft`` may then be used (so far).
  
  e : pandas.DataFrame, optional (default=None)
      The edge table, a table representation of the edges between the
      nodes given by ``v``. Its index has to be a
      ``pandas.core.index.MultiIndex``, whose first level contains the
      indices of the source nodes, and the second level contains the
      indices of the target nodes. Each row of ``e`` represents an edge,
      column names of ``e`` represent the types of relations of the edges,
      and each cell in ``e`` represents a relation of an edge. Only a
      reference to the input DataFrame is created, not a copy.
  
  supernode_labels_by : dict, optional (default=None)
      A dictionary whose keys are strings and their values are (lists of)
      column names of ``v``. Appends a column to ``v`` for each key, whose
      values correspond to supernode labels, enumerating all distinct
      (tuples of) values of the column(s) given by the dict's value.
  
  superedge_labels_by : dict, optional (default=None)
      A dictionary whose keys are strings and their values are (lists of)
      column names of ``e``. Appends a column to ``e`` for each key, whose
      values correspond to superedge labels enumerating all distinct
      (tuples of) values of the column(s) given by the dict's value.
  
  Attributes
  ----------
  v : pandas.DataFrame
      See Parameters.
  
  e : pandas.DataFrame
      See Parameters.
  
  n : int
      Property: Number of nodes.
  
  m : int
      Property: Number of edges.
  
  f : pd.DataFrame
      Property: types of features and number of features of corresponding
      type.
  
  r : pd.DataFrame
      Property: types of relations and number of relations of
      corresponding type.
class_docstr_tok: ["The","core","class","of","DeepGraph","(","dg",")",".","This","class","encapsulates","the","graph","representation","as","``","pandas.DataFrame","``","objects","in","its","attributes","``","v","``","and","``","e","``",".","It","can","be","initialized","with","a","node","table","``","v","``",",","whose","rows","represent","the","nodes","of","the","graph",",","as","well","as","an","edge","table","``","e","``",",","whose","rows","represent","edges","between","the","nodes",".","Given","a","node","table","``","v","``",",","it","provides","methods","to","iteratively","compute","pairwise","relations","between","the","nodes","using","arbitrary",",","user-defined","functions",".","These","methods","provide","arguments","to","parallelize","the","computation","and","control","memory","consumption","(","see","``","create_edges","``","and","``","create_edges_ft","``",")",".","Also","provides","methods","to","partition","nodes",",","edges","or","an","entire","graph","by","the","graph","'s","properties","and","labels",",","and","to","create","common","network","representations","and","graph","objects","of","popular","Python","network","packages",".","Furthermore",",","it","provides","methods","to","visualize","graphs","and","their","properties","and","to","benchmark","the","graph","construction","parameters",".","Optionally",",","the","convenience","parameter","``","supernode_labels_by","``","can","be","passed",",","creating","supernode","labels","by","enumerating","all","distinct","(","tuples","of",")","values","of","a","(","multiple",")","column","(","s",")","of","``","v","``",".","Superedge","labels","can","be","created","analogously",",","by","passing","the","parameter","``","superedge_labels_by","``",".","Parameters","--","--","--","--","--","v",":","pandas.DataFrame","or","pandas.HDFStore",",","optional","(","default=None",")","The","node","table",",","a","table","representation","of","the","nodes","of","a","graph",".","The","index","of","``","v","``","must","be","unique","and","represents","the","node","indices",".","The","column","names","of","``","v","``","represent","the","types","of","features","of","the","nodes",",","and","each","cell","represents","a","feature","of","a","node",".","Only","a","reference","to","the","input","DataFrame","is","created",",","not","a","copy",".","May","also","be","a","``","pandas.HDFStore","``",",","but","only","``","create_edges","``","and","``","create_edges_ft","``","may","then","be","used","(","so","far",")",".","e",":","pandas.DataFrame",",","optional","(","default=None",")","The","edge","table",",","a","table","representation","of","the","edges","between","the","nodes","given","by","``","v","``",".","Its","index","has","to","be","a","``","pandas.core.index.MultiIndex","``",",","whose","first","level","contains","the","indices","of","the","source","nodes",",","and","the","second","level","contains","the","indices","of","the","target","nodes",".","Each","row","of","``","e","``","represents","an","edge",",","column","names","of","``","e","``","represent","the","types","of","relations","of","the","edges",",","and","each","cell","in","``","e","``","represents","a","relation","of","an","edge",".","Only","a","reference","to","the","input","DataFrame","is","created",",","not","a","copy",".","supernode_labels_by",":","dict",",","optional","(","default=None",")","A","dictionary","whose","keys","are","strings","and","their","values","are","(","lists","of",")","column","names","of","``","v","``",".","Appends","a","column","to","``","v","``","for","each","key",",","whose","values","correspond","to","supernode","labels",",","enumerating","all","distinct","(","tuples","of",")","values","of","the","column","(","s",")","given","by","the","dict","'s","value",".","superedge_labels_by",":","dict",",","optional","(","default=None",")","A","dictionary","whose","keys","are","strings","and","their","values","are","(","lists","of",")","column","names","of","``","e","``",".","Appends","a","column","to","``","e","``","for","each","key",",","whose","values","correspond","to","superedge","labels","enumerating","all","distinct","(","tuples","of",")","values","of","the","column","(","s",")","given","by","the","dict","'s","value",".","Attributes","--","--","--","--","--","v",":","pandas.DataFrame","See","Parameters",".","e",":","pandas.DataFrame","See","Parameters",".","n",":","int","Property",":","Number","of","nodes",".","m",":","int","Property",":","Number","of","edges",".","f",":","pd.DataFrame","Property",":","types","of","features","and","number","of","features","of","corresponding","type",".","r",":","pd.DataFrame","Property",":","types","of","relations","and","number","of","relations","of","corresponding","type","."]
docstr: 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 : graph_tool.Graph
  
  See also
  --------
  return_cs_graph
  return_nx_graph
  return_nx_multigraph
  
  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.
docstr_tok: ["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",":","graph_tool.Graph","See","also","--","--","--","--","return_cs_graph","return_nx_graph","return_nx_multigraph","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","."]
code: def return_gt_graph(
      self,
      features=False,
      relations=False,
      dropna="none",
      node_indices=False,
      edge_indices=False,
  ):
      """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 : graph_tool.Graph
  
      See also
      --------
      return_cs_graph
      return_nx_graph
      return_nx_multigraph
  
      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.
  
      """
  
      import graph_tool as gt
  
      # propertymap dtypes
      dtdic = {
          "bool": "bool",
          # int16_t: 'short',
          "uint8": "int16_t",
          "int8": "int16_t",
          "int16": "int16_t",
          # int32_t: 'int',
          "uint16": "int32_t",
          "int32": "int32_t",
          # int64_t: 'long',
          "uint32": "int64_t",
          "int64": "int64_t",
          "uint64": "int64_t",
          # double: 'float',
          "float16": "double",
          "float32": "double",
          "float64": "double",
          "float128": "double",
      }
  
      # get indices
      index = self.v.index
      indices = index.values
      n = len(indices)
  
      # enumerate indices if necessary
      if type(index) is pd.RangeIndex:
          if index.start == 0 and index.stop == n:
              inddic = None
          else:
              inddic = {j: i for i, j in enumerate(indices)}
      else:
          inddic = {j: i for i, j in enumerate(indices)}
  
      # create empty Graph
      gt_g = gt.Graph(directed=True)
  
      # select features
      if features is False:
          vt = pd.DataFrame(index=index)
      elif features is True:
          vt = self.v
      elif _is_array_like(features):
          vt = self.v[features]
      else:
          vt = self.v[features].to_frame()
  
      # add nodes
      gt_g.add_vertex(n)
  
      # add vertex propertymaps
      if node_indices:
          try:
              pm = gt_g.new_vertex_property(
                  dtdic[str(index.dtype)], indices
              )
          except KeyError:
              pm = gt_g.new_vertex_property("object", indices)
          # internalize
          gt_g.vertex_properties["i"] = pm
  
      for col in vt.columns:
          try:
              pm = gt_g.new_vertex_property(
                  dtdic[str(vt[col].dtype)], vt[col].values
              )
          except KeyError:
              pm = gt_g.new_vertex_property("object", vt[col].values)
          # internalize
          gt_g.vertex_properties[str(col)] = pm
  
      # select relations
      if hasattr(self, "e"):
          if relations is False:
              et = pd.DataFrame(index=self.e.index)
          elif relations is True:
              et = self.e
          elif _is_array_like(relations):
              if dropna != "none":
                  et = self.e[relations].dropna(how=dropna)
              else:
                  et = self.e[relations]
          else:
              if dropna != "none":
                  et = self.e[relations].to_frame().dropna(how=dropna)
              else:
                  et = self.e[relations].to_frame()
  
          # add edges
          s = et.index.get_level_values(level=0).values
          t = et.index.get_level_values(level=1).values
          if inddic:
              ns = _dic_translator(s, inddic).astype(int)
              nt = _dic_translator(t, inddic).astype(int)
              gt_g.add_edge_list(np.column_stack((ns, nt)))
              del ns, nt
          else:
              gt_g.add_edge_list(np.column_stack((s, t)))
  
          # add edge propertymaps
          if edge_indices:
              try:
                  s = gt_g.new_edge_property(dtdic[str(s.dtype)], s)
                  t = gt_g.new_edge_property(dtdic[str(t.dtype)], t)
              except KeyError:
                  s = gt_g.new_edge_property("object", s)
                  t = gt_g.new_edge_property("object", t)
              # internalize
              gt_g.edge_properties["s"] = s
              gt_g.edge_properties["t"] = t
  
          for col in et.columns:
              try:
                  pm = gt_g.new_edge_property(
                      dtdic[str(et[col].dtype)], et[col].values
                  )
              except KeyError:
                  pm = gt_g.new_edge_property("object", et[col].values)
              # internalize
              gt_g.edge_properties[str(col)] = pm
  
      return gt_g
  
imports: import inspect
  import os
  from datetime import datetime
  from itertools import chain
  from deepgraph.iterators_and_indexers import _matrix_iterator, _ft_iterator, _iter_edges, _initiate_create_edges, _aggregate_super_table
  from deepgraph.utils import _is_array_like, _dic_translator, _create_bin_edges, _flatten
  import numpy
  import pandas
label_desc: Use image node_id 12 for calling the DeepGraph obj's underlying member method code with example usage: obj.return_gt_graph(features, relations, dropna, node_indices, edge_indices) and returns: gt_g