scipy.sparse.csgraph.csgraph_from_dense¶
-
scipy.sparse.csgraph.
csgraph_from_dense
(graph, null_value=0, nan_null=True, infinity_null=True)¶ Construct a CSR-format sparse graph from a dense matrix.
New in version 0.11.0.
Parameters: - graph : array_like
Input graph. Shape should be (n_nodes, n_nodes).
- null_value : float or None (optional)
Value that denotes non-edges in the graph. Default is zero.
- infinity_null : bool
If True (default), then infinite entries (both positive and negative) are treated as null edges.
- nan_null : bool
If True (default), then NaN entries are treated as non-edges
Returns: - csgraph : csr_matrix
Compressed sparse representation of graph,