(String[] args)
| 66 | |
| 67 | // Driver code |
| 68 | public static void main(String[] args) |
| 69 | { |
| 70 | |
| 71 | /* Create following graph and |
| 72 | test whether it is 3 colorable |
| 73 | (3)---(2) |
| 74 | | / | |
| 75 | | / | |
| 76 | | / | |
| 77 | (0)---(1) |
| 78 | */ |
| 79 | boolean[][] graph = { |
| 80 | { false, true, true, true }, |
| 81 | { true, false, true, false }, |
| 82 | { true, true, false, true }, |
| 83 | { true, false, true, false }, |
| 84 | }; |
| 85 | int m = 3; // Number of colors |
| 86 | |
| 87 | // Initialize all color values as 0. |
| 88 | // This initialization is needed |
| 89 | // correct functioning of isSafe() |
| 90 | int[] color = new int[V]; |
| 91 | for (int i = 0; i < V; i++) |
| 92 | color[i] = 0; |
| 93 | |
| 94 | // Function call |
| 95 | if (!graphColoring(graph, m, 0, color)) |
| 96 | System.out.println("Solution does not exist"); |
| 97 | } |
| 98 | } |
| 99 |
nothing calls this directly
no test coverage detected