### Question:
GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.add(vertexFactory.createVertex()); verticesV.add(vertexFactory.createVertex()); } Graphs.addAllVertices(target, verticesU); Graphs.addAllVertices(target, verticesV); for (int i = 0; i < n; i++) { target.addEdge(verticesU.get(i), verticesU.get((i + 1) % n)); target.addEdge(verticesU.get(i), verticesV.get(i)); target.addEdge(verticesV.get(i), verticesV.get((i + k) % n)); } if (resultMap != null) { resultMap.put(REGULAR, verticesU); resultMap.put(STAR, verticesV); } } GeneralizedPetersenGraphGenerator(int n, int k); @Override void generateGraph(
        Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap); final String STAR; final String REGULAR; }### Answer:
@Test public void testCubicalGraph() { Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); GeneralizedPetersenGraphGenerator<Integer, DefaultEdge> gpgg = new GeneralizedPetersenGraphGenerator<>(4, 1); gpgg.generateGraph(g, new IntegerVertexFactory(), null); this.validateBasics(g, 8, 12, 3, 3, 4); assertTrue(GraphTests.isBipartite(g)); assertTrue(GraphTests.isCubic(g)); }