fix a bug (change Vertex to const Vertex&)