Package org.graph4j.coloring
Class BacktrackColoringBase
java.lang.Object
org.graph4j.SimpleGraphAlgorithm
org.graph4j.coloring.ExactColoringBase
org.graph4j.coloring.BacktrackColoringBase
- All Implemented Interfaces:
ColoringAlgorithm
- Direct Known Subclasses:
BacktrackBandwithColoring,BacktrackColoring,BacktrackEquitableColoring
Attempts at finding the optimum coloring of a graph using a systematic
exploration of the search space. The backtracking is implemented in a
non-recursive manner, using multiple threads.
First, a maximal clique is computed that offers a lower bound q
of the chromatic number. The colors of the vertices in the maximal clique are
fixed before the backtracking algorithm starts.
Secondly, an initial coloring is computed using a simple heuristic (DSatur).
This gives an upper bound kof the chromatic number.
Next, the algorithm will attemtp to color the graph using a number of colors
ranging from k-1 to q, determining the optimal
coloring.
A time limit may be imposed. If the algorithm stops due to the time limit, it will return the best coloring found until then.
- Author:
- Cristian Frăsinaru
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.graph4j.coloring.ExactColoringBase
components, initialColoring, outputEnabled, solutions, solutionsLimit, startTime, timeExpired, timeLimitFields inherited from class org.graph4j.SimpleGraphAlgorithm
graph -
Constructor Summary
ConstructorsConstructorDescriptionBacktrackColoringBase(Graph graph) BacktrackColoringBase(Graph graph, long timeLimit) BacktrackColoringBase(Graph graph, Coloring initialColoring) BacktrackColoringBase(Graph graph, Coloring initialColoring, long timeLimit) -
Method Summary
Modifier and TypeMethodDescriptionprotected NodecreateNode(Node parent, int vertex, int color, Domain[] domains, Coloring coloring) protected Nodeinit(int numColors) protected booleanprepareRootColoring(Coloring rootColoring, int numColors) protected abstract booleanpropagateAssignment(int v, int color, Node node, int[][] assignQueue) protected voidpropagateFailure(Node node) Deprecated.protected booleanpropagationForcedColor(int u, int color, Node node) protected intremoveColor(int u, int color, Node node, int[][] assignQueue, int queuePos) protected voidsolve(int numColors) Methods inherited from class org.graph4j.coloring.ExactColoringBase
checkTime, findAllColorings, findColoring, findColoring, getInstance, getMaximalClique, getSolutionsLimit, isOutputEnabled, isTimeExpired, setOutputEnabled, solveDisconnectedMethods 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, isOptimalityEnsured, isSolvingComponents, isStoppingOnFailure, isValid
-
Field Details
-
workers
-
nodesExplored
protected long nodesExplored
-
-
Constructor Details
-
BacktrackColoringBase
-
BacktrackColoringBase
-
BacktrackColoringBase
-
BacktrackColoringBase
-
-
Method Details
-
solve
protected void solve(int numColors) - Specified by:
solvein classExactColoringBase
-
prepareRootColoring
-
init
-
createNode
-
propagateAssignment
-
removeColor
-
propagationForcedColor
-
propagateFailure
Deprecated.
-