Package org.graph4j.realization
Class HavelHakimiBipartiteRealization
java.lang.Object
org.graph4j.realization.HavelHakimiBipartiteRealization
- All Implemented Interfaces:
BipartiteRealizationAlgorithm
public class HavelHakimiBipartiteRealization
extends Object
implements BipartiteRealizationAlgorithm
This class provides a method to generate a bipartite graph from a given
sequence of degrees, using an adaptation of the Havel-Hakimi algorithm.
The time complexity is O(n^2 log n), where n is the number of vertices.
- Author:
- Cristian Frăsinaru
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHavelHakimiBipartiteRealization(int[] leftDegrees, int[] rightDegrees) Creates an algorithm for the bipartite realization problem. -
Method Summary
Modifier and TypeMethodDescriptiongetGraph()Creates a bipartite graph with the specified degree sequence.booleanChecks if the degree sequence is valid (bigraphic).
-
Constructor Details
-
HavelHakimiBipartiteRealization
public HavelHakimiBipartiteRealization(int[] leftDegrees, int[] rightDegrees) Creates an algorithm for the bipartite realization problem.- Parameters:
leftDegrees- the degrees of the vertices on the left side.rightDegrees- the degrees of the vertices on the right side.
-
-
Method Details
-
isBigraphic
public boolean isBigraphic()Description copied from interface:BipartiteRealizationAlgorithmChecks if the degree sequence is valid (bigraphic).- Specified by:
isBigraphicin interfaceBipartiteRealizationAlgorithm- Returns:
trueif the sequence is bigraphic,falseotherwise.
-
getGraph
Description copied from interface:BipartiteRealizationAlgorithmCreates a bipartite graph with the specified degree sequence.- Specified by:
getGraphin interfaceBipartiteRealizationAlgorithm- Returns:
- a bipartite graph with the specified degree sequence.
-