Module Coloring.Make

Provide a function for k-coloring a graph.

Parameters

module G : G

Signature

module H : Hashtbl.S with type key = G.V.t and type 'a t = 'a 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