Implement classes for vertices and edges.