Class GreedyColoring

All Implemented Interfaces:
ColoringAlgorithm
Direct Known Subclasses:
GreedyBandwithColoring, LargestDegreeFirstColoring, RandomGreedyColoring, SmallestDegreeLastColoring

public class GreedyColoring extends GreedyColoringBase

The order in which vertices are colored is either according to their indices in the graph, or can be specified in the constructor.

Author:
Cristian Frăsinaru
  • Field Details

    • pos

      protected int pos
    • vertexOrdering

      protected int[] vertexOrdering
  • Constructor Details

    • GreedyColoring

      public GreedyColoring(Graph graph)
      The vertices will be colored in the order of their graph indices.
      Parameters:
      graph - the input graph.
    • GreedyColoring

      public GreedyColoring(Graph graph, int[] vertexOrdering)
      Creates a greedy algorithm that will color the vertices of the graph in the specified order. Checks if the ordering is valid.
      Parameters:
      graph - the input graph.
      vertexOrdering - an ordering of the graph vertices.
      Throws:
      InvalidVertexOrdering - if the ordering is invalid.
    • GreedyColoring

      public GreedyColoring(Graph graph, int[] vertexOrdering, boolean validateOrdering)
      Creates a greedy algorithm that will color the vertices of the graph in the specified order.Validation of the ordering is optional.
      Parameters:
      graph - the input graph.
      vertexOrdering - an ordering of the graph vertices.
      validateOrdering - true if the order should be validate, false otherwise.
      Throws:
      InvalidVertexOrdering - if the ordering is invalid.
  • Method Details