refactor edge and vertex classes