MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / isSafe

Method isSafe

Programs/Mcolor.java:21–29  ·  view source on GitHub ↗
(boolean[][] graph, int[] color)

Source from the content-addressed store, hash-verified

19 // check if the colored
20 // graph is safe or not
21 static boolean isSafe(boolean[][] graph, int[] color)
22 {
23 // check for every edge
24 for (int i = 0; i < V; i++)
25 for (int j = i + 1; j < V; j++)
26 if (graph[i][j] && color[j] == color[i])
27 return false;
28 return true;
29 }
30
31 /* This function solves the m Coloring
32 problem using recursion. It returns

Callers 1

graphColoringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected