(int[][] graph)
| 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 | } |