Function ADS::coloring

Function Documentation

inline std::optional<std::vector<int>> ADS::coloring(const Adjacency &G, int k)

a coloring of the nodes with at most k colors, adjacent nodes of different colors, by backtrack, or nothing (exercise 18.6)

Pre:

G is unoriented, i.e., square and symmetric, and k >= 0

Post:

a coloring returned is proper, with colors in [ 0 , k )