deepgraph.deepgraph.DeepGraph.return_cs_graph¶

DeepGraph.
return_cs_graph
(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) ofe
. Ifrelations
is False (default), return a single csgraph entailing all edges ine.index
, each with a weight of 1 (in that case,dropna
is discarded). Ifrelations
is True, create one csgraph for each column ofe
, 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) ofe
.The argument
dropna
indicates whether to discard edges with NA values or not. Ifdropna
is True or False, it applies to all types of relations given byrelations
. However,dropna
can also be array_like with the same shape asrelations
(or with the same shape ase.columns
, ifrelations
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 asrelations
. Ifrelations
is False,dropna
is discarded.
Returns: csgraph – A dictionary, where keys are column names of
e
, and values are the correspondingscipy.sparse.coo_matrix
instance(s). If only one csgraph is created, return it directly.Return type: scipy.sparse.coo_matrix or dict
See also
return_nx_graph()
,return_nx_multigraph()
,return_gt_graph()
,return_sparse_tensor()
 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