java.lang.Object
org.jgrapht.generate.GeneralizedPetersenGraphGenerator<V,E>
- Type Parameters:
V
- graph vertex typeE
- 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
-
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
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
-
Field Details
-
STAR
public final java.lang.String STARKey used to access the star polygon vertices in the resultMap- See Also:
- Constant Field Values
-
REGULAR
public final java.lang.String REGULARKey used to access the regular polygon vertices in the resultMap- See Also:
- Constant Field Values
-
-
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, java.util.Map<java.lang.String,java.util.List<V>> resultMap)Generates the Generalized Petersen Graph- Specified by:
generateGraph
in interfaceGraphGenerator<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 elementsresultMap
- 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.
-