On 05/08/2014 06:15 PM, marklasta wrote: > Hi there ! > > I'm wondering if possible to build a graph starting from the adjacency > matrix. > > Having such a matrix > > matrix = [[1.0, 0.0], [1.0, 1.0]] > > I'd like to build its graph > > (0) --- (0) > > (1) --- (0) > > (1) --- (1)
Yes, you should do:
adj = numpy.array(matrix)
g = Graph()
g.add_edge_list(transpose(adj.nonzero()))
Best,
Tiago
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
