Class RecursiveLargestFirstColoring
- All Implemented Interfaces:
ColoringAlgorithm
The RLF algorithm assigns colors to a graph’s vertices by constructing each color class one at a time. It does this by identifying a maximal independent set of vertices in the graph (using various heuristics), assigning these to the same color, and then removing these vertices from the graph. These actions are repeated on the remaining subgraph until no vertices remain. If using the heuristic described in (Lewis, R. (2021). A Guide to Graph Colouring: Algorithms and Applications.) RLF produces exact results for bipartite, cycle, and wheel graphs. RLF was shown to produce significantly better vertex colorings than alternative heuristics, such as DSatur, on random graphs. Having a complexity of O(nm), it is slower than the greedy or DSatur heuristics.
- Author:
- Cristian Frăsinaru
-
Field Summary
Fields inherited from class org.graph4j.SimpleGraphAlgorithm
graph -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIn case of exact algorithms, this method should return the optimum coloring, if one can be computed within the alloted time.findColoring(int numColors) Methods inherited from class org.graph4j.SimpleGraphAlgorithm
getGraphMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graph4j.coloring.ColoringAlgorithm
getGraph, getHeuristicColoring, getLowerBound, getMaximalClique, isOptimalityEnsured, isSolvingComponents, isStoppingOnFailure, isValid
-
Constructor Details
-
RecursiveLargestFirstColoring
-
-
Method Details
-
findColoring
Description copied from interface:ColoringAlgorithmIn case of exact algorithms, this method should return the optimum coloring, if one can be computed within the alloted time. Otherwise, in case of heuristics or if the time limit is exceeded, it should return the best valid coloring that could be computed.- Specified by:
findColoringin interfaceColoringAlgorithm- Returns:
- a valid coloring of the graph.
-
findColoring
- Specified by:
findColoringin interfaceColoringAlgorithm- Parameters:
numColors- maximum number of colors to be used.- Returns:
- a coloring of the graph with the specified number of colors, or
nullif no coloring can be found by this algorithm.
-