private static int findGreatestX(Graph g) {
        DynamicArray vertices = g.getVertices();
        Vertex v = (Vertex) vertices.get(0);
        int greatest = v.getX();
        for (int i = 0; vertices.get(i) != null; i++) {
            v = (Vertex) vertices.get(i);
            if (v.getX() > greatest) {
                greatest = v.getX();
            }
        }
        return greatest;
    }