Commit 7b52f3b6 authored by James C Bowden's avatar James C Bowden
Browse files

add more wheel graph tests!

parent 0ec4c805
No related merge requests found
Pipeline #78108 canceled with stage
Showing with 14 additions and 6 deletions
+14 -6
...@@ -157,12 +157,14 @@ public class DSaturTests { ...@@ -157,12 +157,14 @@ public class DSaturTests {
checkValidNColoring(g, K); checkValidNColoring(g, K);
} }
@Test
@Tag("B") @Tag("B")
@DisplayName("Test DSatur on wheel graph (guaranteed optimal)") @DisplayName("Test DSatur on various wheel graphs (guaranteed optimal)")
public void testWheel() { @ParameterizedTest(name = "Test DSatur on wheel graph with {0} vertices")
int K = 6; @CsvSource({"6","7","8","9","10","25","100","501","1000"})
NodeGraph g = new NodeGraph(K + 1); public void testWheel(int T) {
// K is number of outer vertices
int K = T-1;
NodeGraph g = new NodeGraph(T);
for (int i = 0; i < K + 1; i++) { for (int i = 0; i < K + 1; i++) {
g.addEdge(i % K, (i + 1) % K); g.addEdge(i % K, (i + 1) % K);
} }
...@@ -171,7 +173,13 @@ public class DSaturTests { ...@@ -171,7 +173,13 @@ public class DSaturTests {
} }
DSatur.color(g); DSatur.color(g);
checkValidNColoring(g, 3); int maxColors;
if (K % 2 == 0){
maxColors = 3;
} else {
maxColors = 4;
}
checkValidNColoring(g, maxColors);
} }
@Tag("B") @Tag("B")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment