Pass length of edge array instead of recomputing