Class CycleGenerator


public class CycleGenerator extends AbstractGraphGenerator
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
  • Constructor Details

    • CycleGenerator

      public CycleGenerator(int numVertices)
    • CycleGenerator

      public CycleGenerator(int firstVertex, int lastVertex)
    • CycleGenerator

      public CycleGenerator(int[] vertices)
  • Method Details

    • createGraph

      public Graph createGraph()
      Returns:
      a cycle with the specified vertices.
    • createDigraph

      public Digraph createDigraph(boolean clockwise)
      Parameters:
      clockwise - the orientation of the cycle.
      Returns:
      a cycle with the specified vertices.