You need to override the hashCode
method to make the JVM store and retrieve your objects in HashMap properly.
When a put method is called on a hashed collection such as HashMap, the key object hashcode method is called to decide the bucket to store the object. Then its equals method is called to see whether something already exist there or not.
Similary when you do a get on the HashMap, key hashCode method will be called to find the bucket and to retreive the object.
As you have not overridden the hashcode method in your Vertex class so defualt hashcode implemenataion is used. And hence two your Vertex objects having the same id value may be having a different hashcode.
Read this related post to understand how to override the equals and hashcode method:
What issues should be considered when overriding equals and hashCode in Java?
You can find different articles on google for the same topic. A good google result:
http://javarevisited.blogspot.in/2011/02/how-to-write-equals-method-in-java.html