From adjacency matrix to the list of edges#2471