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 ``scipy.sparse.coo_matrix`` representation(s).
  
  Create a compressed sparse graph representation for each type of
  relation given by ``relations``. ``relations`` can either be False,
  True, or a (list of) column name(s) of ``e``. If ``relations`` is False
  (default), return a single csgraph entailing all edges in ``e.index``,
  each with a weight of 1 (in that case, ``dropna`` is discarded). If
  ``relations`` is True, create one csgraph for each column of ``e``,
  where the weights are given by the columns' values. If only a subset of
  columns is to be mapped to csgraphs, ``relations`` has to be a (list
  of) column name(s) of ``e``.
  
  The argument ``dropna`` indicates whether to discard edges with NA
  values or not. If ``dropna`` is True or False, it applies to all types
  of relations given by ``relations``. However, ``dropna`` can also be
  array_like with the same shape as ``relations`` (or with the same shape
  as ``e.columns``, if ``relations`` is True).
  
  Parameters
  ----------
  relations : bool, str or array_like, optional (default=False)
      The types of relations to be mapped to scipy csgraphs. Can be
      False, True, or a (list of) column name(s) of ``e``.
  
  dropna : bool or array_like, optional (default=True)
      Whether to drop edges with NA values. If True or False, applies to
      all relations given by ``relations``. Otherwise, must be the same
      shape as ``relations``. If ``relations`` is False, ``dropna`` is
      discarded.
  
  Returns
  -------
  csgraph : scipy.sparse.coo_matrix or dict
      A dictionary, where keys are column names of ``e``, and values are
      the corresponding ``scipy.sparse.coo_matrix`` instance(s). If only
      one csgraph is created, return it directly.
  
  See also
  --------
  return_nx_graph
  return_nx_multigraph
  return_gt_graph
docstr_tok: ["Return","``","scipy.sparse.coo_matrix","``","representation","(","s",")",".","Create","a","compressed","sparse","graph","representation","for","each","type","of","relation","given","by","``","relations","``",".","``","relations","``","can","either","be","False",",","True",",","or","a","(","list","of",")","column","name","(","s",")","of","``","e","``",".","If","``","relations","``","is","False","(","default",")",",","return","a","single","csgraph","entailing","all","edges","in","``","e.index","``",",","each","with","a","weight","of","1","(","in","that","case",",","``","dropna","``","is","discarded",")",".","If","``","relations","``","is","True",",","create","one","csgraph","for","each","column","of","``","e","``",",","where","the","weights","are","given","by","the","columns","'","values",".","If","only","a","subset","of","columns","is","to","be","mapped","to","csgraphs",",","``","relations","``","has","to","be","a","(","list","of",")","column","name","(","s",")","of","``","e","``",".","The","argument","``","dropna","``","indicates","whether","to","discard","edges","with","NA","values","or","not",".","If","``","dropna","``","is","True","or","False",",","it","applies","to","all","types","of","relations","given","by","``","relations","``",".","However",",","``","dropna","``","can","also","be","array_like","with","the","same","shape","as","``","relations","``","(","or","with","the","same","shape","as","``","e.columns","``",",","if","``","relations","``","is","True",")",".","Parameters","--","--","--","--","--","relations",":","bool",",","str","or","array_like",",","optional","(","default=False",")","The","types","of","relations","to","be","mapped","to","scipy","csgraphs",".","Can","be","False",",","True",",","or","a","(","list","of",")","column","name","(","s",")","of","``","e","``",".","dropna",":","bool","or","array_like",",","optional","(","default=True",")","Whether","to","drop","edges","with","NA","values",".","If","True","or","False",",","applies","to","all","relations","given","by","``","relations","``",".","Otherwise",",","must","be","the","same","shape","as","``","relations","``",".","If","``","relations","``","is","False",",","``","dropna","``","is","discarded",".","Returns","--","--","--","-","csgraph",":","scipy.sparse.coo_matrix","or","dict","A","dictionary",",","where","keys","are","column","names","of","``","e","``",",","and","values","are","the","corresponding","``","scipy.sparse.coo_matrix","``","instance","(","s",")",".","If","only","one","csgraph","is","created",",","return","it","directly",".","See","also","--","--","--","--","return_nx_graph","return_nx_multigraph","return_gt_graph"]
code: def return_cs_graph(self, relations=False, dropna=True):
      """Return ``scipy.sparse.coo_matrix`` representation(s).
  
      Create a compressed sparse graph representation for each type of
      relation given by ``relations``. ``relations`` can either be False,
      True, or a (list of) column name(s) of ``e``. If ``relations`` is False
      (default), return a single csgraph entailing all edges in ``e.index``,
      each with a weight of 1 (in that case, ``dropna`` is discarded). If
      ``relations`` is True, create one csgraph for each column of ``e``,
      where the weights are given by the columns' values. If only a subset of
      columns is to be mapped to csgraphs, ``relations`` has to be a (list
      of) column name(s) of ``e``.
  
      The argument ``dropna`` indicates whether to discard edges with NA
      values or not. If ``dropna`` is True or False, it applies to all types
      of relations given by ``relations``. However, ``dropna`` can also be
      array_like with the same shape as ``relations`` (or with the same shape
      as ``e.columns``, if ``relations`` is True).
  
      Parameters
      ----------
      relations : bool, str or array_like, optional (default=False)
          The types of relations to be mapped to scipy csgraphs. Can be
          False, True, or a (list of) column name(s) of ``e``.
  
      dropna : bool or array_like, optional (default=True)
          Whether to drop edges with NA values. If True or False, applies to
          all relations given by ``relations``. Otherwise, must be the same
          shape as ``relations``. If ``relations`` is False, ``dropna`` is
          discarded.
  
      Returns
      -------
      csgraph : scipy.sparse.coo_matrix or dict
          A dictionary, where keys are column names of ``e``, and values are
          the corresponding ``scipy.sparse.coo_matrix`` instance(s). If only
          one csgraph is created, return it directly.
  
      See also
      --------
      return_nx_graph
      return_nx_multigraph
      return_gt_graph
  
      """
  
      from scipy.sparse import coo_matrix
  
      # 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)}
  
      # for default arguments
      if relations is False:
          s = self.e.index.get_level_values(0).values
          t = self.e.index.get_level_values(1).values
          if inddic:
              s = _dic_translator(s, inddic)
              t = _dic_translator(t, inddic)
          else:
              pass
  
          # create cs graph
          cs_g = coo_matrix(
              (np.ones(len(s), dtype=bool), (s, t)),
              shape=(n, n),
              dtype=bool,
          )
  
      else:
          if relations is True:
              relations = self.e.columns.values
  
          # check that relations and dropna have the same shape
          if _is_array_like(relations) and _is_array_like(dropna):
              assert len(relations) == len(
                  dropna
              ), "dropna and relations have different shapes!"
  
          if not _is_array_like(relations):
              relations = [relations]
          if not _is_array_like(dropna):
              dropna = [dropna] * len(relations)
  
          # create coo_matrices
          cs_g = {}
          for r, drop in zip(relations, dropna):
              if drop:
                  data = self.e[r].dropna()
              else:
                  data = self.e[r]
              s = data.index.get_level_values(0).values
              t = data.index.get_level_values(1).values
              if inddic:
                  s = _dic_translator(s, inddic)
                  t = _dic_translator(t, inddic)
              else:
                  pass
  
              # create cs graph
              cs_g[r] = coo_matrix(
                  (data.values, (s, t)), shape=(n, n), dtype=data.dtype
              )
  
          # if there is only one csgraph
          if len(cs_g) == 1:
              cs_g = cs_g[r]
  
      return cs_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 9 for calling the DeepGraph obj's underlying member method code with example usage: obj.return_cs_graph(relations, dropna) and returns: cs_g