Package org.graph4j.generators
Class RandomDAGGenerator
java.lang.Object
org.graph4j.generators.AbstractGraphGenerator
org.graph4j.generators.RandomDAGGenerator
Generates a random directed acyclic graph (DAG).
Each possible arc is added considering a given probability.
- Author:
- Cristian Frăsinaru
- See Also:
-
Field Summary
Fields inherited from class org.graph4j.generators.AbstractGraphGenerator
vertices -
Constructor Summary
ConstructorsConstructorDescriptionRandomDAGGenerator(int numVertices, double edgeProbability) RandomDAGGenerator(int firstVertex, int lastVertex, double edgeProbability) -
Method Summary
Modifier and TypeMethodDescriptionint[]The method returns the topological ordering of the vertices, based on which the DAG was created.Methods inherited from class org.graph4j.generators.AbstractGraphGenerator
addRandomEdges
-
Constructor Details
-
RandomDAGGenerator
public RandomDAGGenerator(int numVertices, double edgeProbability) - Parameters:
numVertices- number of vertices.edgeProbability- probability that two vertices are connected.
-
RandomDAGGenerator
public RandomDAGGenerator(int firstVertex, int lastVertex, double edgeProbability) - Parameters:
firstVertex- first vertex number of the graph.lastVertex- last vertex number of the graph.edgeProbability- probability that two vertices are connected.
-
-
Method Details
-
createDAG
- Returns:
- a random directed acyclic graph.
-
getTopologicalOrdering
public int[] getTopologicalOrdering()The method returns the topological ordering of the vertices, based on which the DAG was created.- Returns:
- the topological ordering of the generated DAG.
-