template<typename Graph>
class lemon::PlanarColoring< Graph >
The graph coloring problem is the coloring of the graph nodes so that there are no adjacent nodes with the same color. The planar graphs can always be colored with four colors, which is proved by Appel and Haken. Their proofs provide a quadratic time algorithm for four coloring, but it could not be used to implement an efficient algorithm. The five and six coloring can be made in linear time, but in this class, the five coloring has quadratic worst case time complexity. The two coloring (if possible) is solvable with a graph search algorithm and it is implemented in bipartitePartitions() function in LEMON. To decide whether a planar graph is three colorable is NP-complete.
This class contains member functions for calculate colorings with five and six colors. The six coloring algorithm is a simple greedy coloring on the backward minimum outgoing order of nodes. This order can be computed by selecting the node with least outgoing arcs to unprocessed nodes in each phase. This order guarantees that when a node is chosen for coloring it has at most five already colored adjacents. The five coloring algorithm use the same method, but if the greedy approach fails to color with five colors, i.e. the node has five already different colored neighbours, it swaps the colors in one of the connected two colored sets with the Kempe recoloring method.
|
| PlanarColoring (const Graph &graph) |
| Constructor.
|
|
IndexMap | colorIndexMap () const |
| Return the node map of color indices.
|
|
ColorMap | colorMap () const |
| Return the node map of colors.
|
|
int | colorIndex (const Node &node) const |
| Return the color index of the node.
|
|
Color | color (const Node &node) const |
| Return the color of the node.
|
|
bool | runSixColoring () |
| Calculate a coloring with at most six colors.
|
|
template<typename EmbeddingMap > |
void | runFiveColoring (const EmbeddingMap &embedding) |
| Calculate a coloring with at most five colors.
|
|
bool | runFiveColoring () |
| Calculate a coloring with at most five colors.
|
|