Wrote custom function to count vertices via iterator