[graph-tool] make graph from scipy sparse matrix
Tiago de Paula Peixoto
tiago at skewed.de
Wed Feb 7 14:22:42 CET 2018
On 27.12.2017 13:12, hoptical wrote:
> hi,
> I have a scipy sparse matrix and I want to make a graph from this matrix in
> graphtool.
> In Netwrokx this is simplly done by from_scipy_sparse_matrix method(). is
> there any method like this in graph tool package?
If 'a' is your sparse matrix, you can do:
g = Graph()
g.add_edge_list(array(a.nonzero()).T)
Best,
Tiago
--
Tiago de Paula Peixoto <tiago at skewed.de>
More information about the graph-tool
mailing list