Class GeneralizedPetersenGraphGenerator<V,​E>

  • Type Parameters:
    V - graph vertex type
    E - graph edge type
    All Implemented Interfaces:
    GraphGenerator<V,​E,​java.util.List<V>>

    public class GeneralizedPetersenGraphGenerator<V,​E>
    extends java.lang.Object
    implements GraphGenerator<V,​E,​java.util.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 Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String REGULAR
      Key used to access the regular polygon vertices in the resultMap
      java.lang.String STAR
      Key used to access the star polygon vertices in the resultMap
    • Constructor Summary

      Constructors 
      Constructor Description
      GeneralizedPetersenGraphGenerator​(int n, int k)
      Constructs a GeneralizedPetersenGraphGenerator used to generate a Generalized Petersen graphs $GP(n,k)$.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generateGraph​(Graph<V,​E> target, java.util.Map<java.lang.String,​java.util.List<V>> resultMap)
      Generates the Generalized Petersen Graph
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STAR

        public final java.lang.String STAR
        Key used to access the star polygon vertices in the resultMap
        See Also:
        Constant Field Values
      • REGULAR

        public final java.lang.String REGULAR
        Key used to access the regular polygon vertices in the resultMap
        See Also:
        Constant Field Values
    • Constructor Detail

      • 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 Detail

      • generateGraph

        public void generateGraph​(Graph<V,​E> target,
                                  java.util.Map<java.lang.String,​java.util.List<V>> resultMap)
        Generates the Generalized Petersen Graph
        Specified by:
        generateGraph in interface GraphGenerator<V,​E,​java.util.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.