Class RegularGraphGenerator

java.lang.Object
org.graph4j.generators.AbstractGraphGenerator
org.graph4j.generators.RegularGraphGenerator

public class RegularGraphGenerator extends AbstractGraphGenerator
Generates a regular graph. An undirected graph id regular if every vertex has the same degree. A directed graph is regular if the vertices indegrees and outdegrees are all equal.
Author:
Cristian Frăsinaru
  • Constructor Details

    • RegularGraphGenerator

      public RegularGraphGenerator(int numVertices, int degree)
      Parameters:
      numVertices - the number of vertices.
      degree - the degree of all vertices.
    • RegularGraphGenerator

      public RegularGraphGenerator(int firstVertex, int lastVertex, int degree)
      Parameters:
      firstVertex - the number of the first vertex in the generated graph.
      lastVertex - the number of the last vertex in the generated graph.
      degree - the degree of all vertices.
  • Method Details

    • createGraph

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

      public Digraph createDigraph()
      Returns:
      a regular directed graph.