class 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); // Regular polygon vertices
        List<V> verticesV = new ArrayList<>(n); // Star polygon vertices
        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);
        }
    }

    public  GeneralizedPetersenGraphGenerator(int n, int k);

}