MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / isBipartite

Method isBipartite

IsGraphBipartite.java:20–32  ·  view source on GitHub ↗
(int[][] graph)

Source from the content-addressed store, hash-verified

18 return true;
19 }
20 public boolean isBipartite(int[][] graph) {
21 int n = graph.length;
22 int color[] = new int[n];
23 Arrays.fill(color,-1);
24 for(int i=0;i<n;i++){
25 if(color[i] == -1){
26 if(!color(i,graph,color)){
27 return false;
28 }
29 }
30 }
31 return true;
32 }
33}

Callers

nothing calls this directly

Calls 1

colorMethod · 0.95

Tested by

no test coverage detected