Class GreedyColoring<V,E>
java.lang.Object
org.jgrapht.alg.color.GreedyColoring<V,E>
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
VertexColoringAlgorithm<V>
- Direct Known Subclasses:
LargestDegreeFirstColoring, RandomGreedyColoring, SmallestDegreeLastColoring
The greedy coloring algorithm.
The algorithm iterates over all vertices and assigns the smallest possible color that is not used by any neighbors. Subclasses may provide a different vertex ordering.
-
Nested Class Summary
Nested classes/interfaces inherited from interface VertexColoringAlgorithm
VertexColoringAlgorithm.Coloring<V>, VertexColoringAlgorithm.ColoringImpl<V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes a vertex coloring.Get the ordering of the vertices used by the algorithm.
-
Field Details
-
SELF_LOOPS_NOT_ALLOWED
Error message if the input graph contains self-loops.- See Also:
-
graph
-
-
Constructor Details
-
GreedyColoring
-
-
Method Details
-
getVertexOrdering
-
getColoring
Computes a vertex coloring.- Specified by:
getColoringin interfaceVertexColoringAlgorithm<V>- Returns:
- a vertex coloring
-