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)
Thank you in advance.
Marco.
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)
Thank you in advance.
Marco.
Yes, you should do:
adj = numpy.array(matrix)
g = Graph()
g.add_edge_list(transpose(adj.nonzero()))
Best,
Tiago