Class RandomTreeGenerator

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

public class RandomTreeGenerator extends AbstractGraphGenerator
Generates a random tree or arborescence. A tree is a connected acyclic graph. An arborescence is a directed rooted tree where there is exactly one path from the root to every other vertex.
Author:
Cristian Frăsinaru
  • Constructor Details

    • RandomTreeGenerator

      public RandomTreeGenerator(int numVertices)
    • RandomTreeGenerator

      public RandomTreeGenerator(int firstVertex, int lastVertex)
    • RandomTreeGenerator

      public RandomTreeGenerator(int[] vertices)
  • Method Details

    • createTree

      public Graph createTree()
      Creates a random tree.
      Returns:
      a random tree.
    • createArborescence

      public Digraph createArborescence()
      Creates a random arborescence.
      Returns:
      a random arborescence.