Class GeneralizedPetersenGraphGenerator<V,E>

java.lang.Object
org.jgrapht.generate.GeneralizedPetersenGraphGenerator<V,E>
Type Parameters:
V - graph vertex type
E - graph edge type
All Implemented Interfaces:
GraphGenerator<V,E,List<V>>

public class GeneralizedPetersenGraphGenerator<V,E> extends Object implements GraphGenerator<V,E,List<V>>
Generator for Generalized Petersen Graphs The Generalized Petersen graphs $GP(n,k)$ are a family of cubic graphs formed by connecting the vertices of a regular polygon (cycle graph $C_n$) to the corresponding vertices of a star polygon ${n,k}$. Several special cases of the generalized Petersen graph are predefined in the NamedGraphGenerator.
Author:
Joris Kinable
  • Field Details

    • STAR

      public static final String STAR
      Key used to access the star polygon vertices in the resultMap
      See Also:
    • REGULAR

      public static final String REGULAR
      Key used to access the regular polygon vertices in the resultMap
      See Also:
  • Constructor Details

    • GeneralizedPetersenGraphGenerator

      public GeneralizedPetersenGraphGenerator(int n, int k)
      Constructs a GeneralizedPetersenGraphGenerator used to generate a Generalized Petersen graphs $GP(n,k)$.
      Parameters:
      n - size of the regular polygon (cycle graph $C_n$)
      k - size of the star polygon ${n,k}$
  • Method Details

    • generateGraph

      public void generateGraph(Graph<V,E> target, Map<String,List<V>> resultMap)
      Generates the Generalized Petersen Graph
      Specified by:
      generateGraph in interface GraphGenerator<V,E,List<V>>
      Parameters:
      target - receives the generated edges and vertices; if this is non-empty on entry, the result will be a disconnected graph since generated elements will not be connected to existing elements
      resultMap - if non-null, the resultMap contains a mapping from the key "star" to a list of vertices constituting the star polygon, as well as a key "regular" which maps to a list of vertices constituting the regular polygon.