Module Coloring.Make

Provide a function for k-coloring a graph.

Parameters

Signature

module H : Stdlib.Hashtbl.S with type H.key = G.V.t and type 'a H.t = 'a Stdlib.Hashtbl.Make(G.V).t

Hash tables used to store the coloring

val coloring : G.t -> int -> int H.t

coloring g k colors the graph g with k colors and returns the coloring as a hash table mapping nodes to their colors. Colors are integers from 1 to k.

raises NoColoring

if g cannot be k-colored.

Worst-case time complexity is exponential. Space complexity is O(V).

val two_color : G.t -> int H.t