working in sparse matrix for edgelist