From adjacency matrix to edge list#4762