count number of edge occurrences before copying. addresses #1547