[graph-tool] Building graph from adjacency matrix

Pietro Battiston ml at pietrobattiston.it
Thu Mar 20 13:10:32 CET 2014


Il giorno gio, 20/03/2014 alle 12.52 +0100, Tiago de Paula Peixoto ha
scritto:
> [...] I have now just added a Graph.add_edge_list() to the
> git version, which takes a list of edges to be added, which can be a
> numpy array. If you have a full adjacency matrix instead of an edge
> list, you can do simply:
> 
>     g.add_edge_list(transpose(nonzero(a)))
> 
> This should be much faster than the Python loop above.
> 


This is really great, I will try the git version as soon as possible.

Thank you very much.

Pietro




More information about the graph-tool mailing list