NetworkX

Previous topic

to_scipy_sparse_matrix

Next topic

Relabeling nodes

from_scipy_sparse_matrix

from_scipy_sparse_matrix(A, create_using=None)[source]

Return a graph from scipy sparse matrix adjacency list.

Parameters :

A : scipy sparse matrix

An adjacency matrix representation of a graph

create_using : NetworkX graph

Use specified graph for result. The default is Graph()

Examples

>>> import scipy.sparse
>>> A=scipy.sparse.eye(2,2,1)
>>> G=nx.from_scipy_sparse_matrix(A)