You are viewing an older version (1.17.1).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 1.17.1 / scipy / sparse / csgraph / _tools / csgraph_to_masked

cython_function_or_method

scipy.sparse.csgraph._tools:csgraph_to_masked

Signature

def csgraph_to_masked(csgraph)

Summary

Convert a sparse graph representation to a masked array representation

Extended Summary

Parameters

csgraph : csr_array, csc_array, or lil_array

Sparse representation of a graph.

Returns

graph : MaskedArray

The masked dense representation of the sparse graph.

Examples

from scipy.sparse import csr_array
from scipy.sparse.csgraph import csgraph_to_masked
✓
graph = csr_array( [
[0, 1, 2, 0],
[0, 0, 0, 1],
[0, 0, 0, 3],
[0, 0, 0, 0]
])
✓
graph
✗
csgraph_to_masked(graph)
✗

Aliases

  • scipy.sparse.csgraph.csgraph_to_masked