Class GreedyColoring<V,E>

java.lang.Object
org.jgrapht.alg.color.GreedyColoring<V,E>
Type Parameters:
V - the graph vertex type
E - the graph edge type
All Implemented Interfaces:
VertexColoringAlgorithm<V>
Direct Known Subclasses:
LargestDegreeFirstColoring, RandomGreedyColoring, SmallestDegreeLastColoring

public class GreedyColoring<V,E> extends Object implements VertexColoringAlgorithm<V>
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.

Author:
Dimitrios Michail
  • Field Details

    • SELF_LOOPS_NOT_ALLOWED

      protected static final String SELF_LOOPS_NOT_ALLOWED
      Error message if the input graph contains self-loops.
      See Also:
    • graph

      protected final Graph<V,E> graph
      The input graph
  • Constructor Details

    • GreedyColoring

      public GreedyColoring(Graph<V,E> graph)
      Construct a new coloring algorithm.
      Parameters:
      graph - the input graph
  • Method Details