Package org.jgrapht.generate
Class GeneralizedPetersenGraphGenerator<V,E>
- java.lang.Object
-
- org.jgrapht.generate.GeneralizedPetersenGraphGenerator<V,E>
-
- Type Parameters:
V
- graph vertex typeE
- 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 theNamedGraphGenerator
.- Author:
- Joris Kinable
-
-
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, Map<String,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
-
Methods inherited from interface org.jgrapht.generate.GraphGenerator
generateGraph
-
-
-
-
Field Detail
-
STAR
public final String STAR
Key used to access the star polygon vertices in the resultMap- See Also:
- Constant Field Values
-
REGULAR
public final 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, Map<String,List<V>> resultMap)
Generates the Generalized Petersen Graph- Specified by:
generateGraph
in interfaceGraphGenerator<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 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.
-
-