Refactor common code from vertex, edge parsing into a superclass