<awangdev>785. Is Graph Bipartite_1.java
private boolean dfs(int[][] graph, int[] states, int state, int node) {

        if (states[node] != 0) return states[node] == state;
        if (graph[node].length == 0) return true;
        
        states[node] = state;
        
        for (int val : graph[node]) {
            if (!dfs(graph, states, - state, val)) return false;
        }
        return true;
 
    }
private boolean sample_funcname ( int [ ] [ ] graph , int [ ] states , int state , int node ) {
  if ( states [ node ] != 0 ) return states [ node ] == state ;
  if ( graph [ node ] . length == 0 ) return true ;
  states [ node ] = state ;
  for ( int val : graph [ node ] ) {
    if ( ! dfs ( graph , states , - state , val ) ) return false ;
  }
  return true ;
}
