Package org.graph4j.generators
Class CycleGenerator
java.lang.Object
org.graph4j.generators.AbstractGraphGenerator
org.graph4j.generators.CycleGenerator
A cycle graph consists of a single cycle. If the vertices of the
graph are
0,1,...,n-1 then its edges are
(i, (i+1) mod n), for i=0,...,n-1
The cycle graph with n vertices is denoted by Cn. The number of
vertices in a cycle graph equals the number of edges and every vertex has
degree 2.- Author:
- Cristian Frăsinaru
-
Field Summary
Fields inherited from class org.graph4j.generators.AbstractGraphGenerator
vertices -
Constructor Summary
ConstructorsConstructorDescriptionCycleGenerator(int numVertices) CycleGenerator(int[] vertices) CycleGenerator(int firstVertex, int lastVertex) -
Method Summary
Methods inherited from class org.graph4j.generators.AbstractGraphGenerator
addRandomEdges
-
Constructor Details
-
CycleGenerator
public CycleGenerator(int numVertices) -
CycleGenerator
public CycleGenerator(int firstVertex, int lastVertex) -
CycleGenerator
public CycleGenerator(int[] vertices)
-
-
Method Details
-
createGraph
- Returns:
- a cycle with the specified vertices.
-
createDigraph
- Parameters:
clockwise- the orientation of the cycle.- Returns:
- a cycle with the specified vertices.
-