introduced hashmap to add vertices only once

performance improvement is imense!