Package org.graph4j.realization
Class KleitmanWangDigraphRealization
java.lang.Object
org.graph4j.realization.KleitmanWangDigraphRealization
- All Implemented Interfaces:
DigraphRealizationAlgorithm
This class provides a method to generate a directed graph from a given
sequence of in-degrees and out-degrees, using the Kleitman-Wang algorithm.
The time complexity is O(n^2 log n), where n is the number of vertices.
- Author:
- Cristian Frăsinaru
-
Constructor Summary
ConstructorsConstructorDescriptionKleitmanWangDigraphRealization(int[] indegrees, int[] outdegrees) Creates an algorithm for the digraph realization problem. -
Method Summary
Modifier and TypeMethodDescriptionCreates a directed graph with the specified in-degrees and out-degrees.booleanChecks if the degree sequence is digraphic.
-
Constructor Details
-
KleitmanWangDigraphRealization
public KleitmanWangDigraphRealization(int[] indegrees, int[] outdegrees) Creates an algorithm for the digraph realization problem.- Parameters:
indegrees- the in-degrees of the vertices.outdegrees- the out-degrees of the vertices.
-
-
Method Details
-
isDigraphic
public boolean isDigraphic()Description copied from interface:DigraphRealizationAlgorithmChecks if the degree sequence is digraphic.- Specified by:
isDigraphicin interfaceDigraphRealizationAlgorithm- Returns:
trueif the sequence is digraphic,falseotherwise.
-
getDigraph
Description copied from interface:DigraphRealizationAlgorithmCreates a directed graph with the specified in-degrees and out-degrees.- Specified by:
getDigraphin interfaceDigraphRealizationAlgorithm- Returns:
- a digraph with the specified degree sequence.
-