Fix generation of adjacency, laplacian and adjacency matrices when there are no edges.