save_npz(file, matrix, compressed=True)
Either the file name (string) or an open file (file-like object) where the data will be saved. If file is a string, the .npz
extension will be appended to the file name if it is not already there.
The sparse matrix to save.
Allow compressing the file. Default: True
Save a sparse matrix to a file using .npz
format.
numpy.savez
Save several arrays into a .npz
archive.
numpy.savez_compressed
Save several arrays into a compressed .npz
archive.
scipy.sparse.load_npz
Load a sparse matrix from a file using .npz
format.
Store sparse matrix to disk, and load it again:
>>> import scipy.sparse
... sparse_matrix = scipy.sparse.csc_matrix(np.array([[0, 0, 3], [4, 0, 0]]))
... sparse_matrix <2x3 sparse matrix of type '<class 'numpy.int64'>' with 2 stored elements in Compressed Sparse Column format>
>>> sparse_matrix.toarray() array([[0, 0, 3], [4, 0, 0]], dtype=int64)
>>> scipy.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix)
... sparse_matrix = scipy.sparse.load_npz('/tmp/sparse_matrix.npz')
>>> sparse_matrix <2x3 sparse matrix of type '<class 'numpy.int64'>' with 2 stored elements in Compressed Sparse Column format>
>>> sparse_matrix.toarray() array([[0, 0, 3], [4, 0, 0]], dtype=int64)See :
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.sparse._matrix_io.save_npz
scipy.sparse._matrix_io.load_npz
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them