counting vertices function added + tests