Class PathGenerator


public class PathGenerator extends AbstractGraphGenerator
A path graph consists of a single path. If the vertices of the graph are 0,1,...,n-1 then its edges are (i, i+1), for i=0,...,n-2 The cycle graph with n vertices is denoted by Pn. The number of edges of Pn is n-1 and every vertex has degree 2, except the extremities which have degree 1.
Author:
Cristian Frăsinaru
  • Constructor Details

    • PathGenerator

      public PathGenerator(int numVertices)
    • PathGenerator

      public PathGenerator(int firstVertex, int lastVertex)
  • Method Details

    • createGraph

      public Graph createGraph()
      Returns:
      a path graph.
    • createDigraph

      public Digraph createDigraph(boolean leftToRight)
      Parameters:
      leftToRight - the orientation of the path.
      Returns:
      a directed path graph.