SciPy

scipy.sparse.csgraph.csgraph_to_masked

scipy.sparse.csgraph.csgraph_to_masked(csgraph)

Convert a sparse graph representation to a masked array representation

New in version 0.11.0.

Parameters:
csgraph : csr_matrix, csc_matrix, or lil_matrix

Sparse representation of a graph.

Returns:
graph : MaskedArray

The masked dense representation of the sparse graph.