Statistics
| Branch: | Tag: | Revision:

root / htest / Test / Ganeti / HTools / Graph.hs @ cce30754

History | View | Annotate | Download (7 kB)

# Date Author Comment
cce30754 12/14/2012 03:11 pm Guido Trotter

Improve a few Graph test properties

Return type is changed from Property to Bool, and the ==? True at the
end is dropped.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

8e6623c8 12/04/2012 06:46 pm Guido Trotter

Add Ganeti.HTools.Graph

This module implements some algorithms on Data.Graph data structures.
At the moment its main functionality is an LF-color implementation
(greedy coloring in descending order of degree). There are also a few
extra functions to calculate the degree order, and convert the node to...

742bd043 12/04/2012 06:46 pm Guido Trotter

Add Dsatur implementation

Implement the Dsatur algorithm for Graph coloring. This also abstracts
the neighColors function into two subfunctions that this algorithm can
reuse.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

faef859e 12/04/2012 06:46 pm Guido Trotter

Ganeti/HTools/Graph Add isColorable

Check whether coloring on a given graph makes sense. This is the case
only if there are no loops and the graph is undirected.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

34a21cc4 12/04/2012 06:46 pm Guido Trotter

Add tests for verticesByDegree{Asc,Desc}

This brings our coverage of Graph.hs to 100%

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

8b50de5c 12/04/2012 06:46 pm Guido Trotter

Fix Dsatur and add Dcolor

Our Dsatur implementation was incorrect: while the paper defined the
degree of saturation of a vertex as the number of different colors it is
adjacent to, we were using the number of colors, without considering
uniqueness. This effectively implemented a different algorithm, which is...

c94f9990 12/04/2012 06:46 pm Guido Trotter

Add "proper coloring" unittest check

We have to check that for each edge its vertices have different colors.

This is very easy to do with a vertex-to-color map, but not so easy with
a color-to-vertex one. Since all our coloring algorithms created a
vertex-to-color map behind the scenes and then converted it, we flip...