static void colorGraph ( List < Integer > [ ] graph , boolean [ ] vis , int vertex , int currColor , BigInteger [ ] colorCount ) {
  if ( vis [ vertex ] ) return ;
  List < Integer > edges = graph [ vertex ] ;
  if ( edges == null ) return ;
  int next = ( currColor == RED ) ? BLUE : RED ;
  vis [ vertex ] = true ;
  colorCount [ currColor ] = colorCount [ currColor ] . add ( BigInteger . ONE ) ;
  for ( Integer i : edges ) {
    colorGraph ( graph , vis , i , next , colorCount ) ;
  }
}

static void colorGraph ( List < Integer > [ ] graph , boolean [ ] vis , int vertex , int currColor , BigInteger [ ] colorCount ) { if ( vis [ vertex ] ) return ; List < Integer > edges = graph [ vertex ] ; if ( edges == null ) return ; int next = ( currColor == RED ) ? BLUE : RED ; vis [ vertex ] = true ; colorCount [ currColor ] = colorCount [ currColor ] . add ( BigInteger . ONE ) ; for ( Integer i : edges ) { colorGraph ( graph , vis , i , next , colorCount ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (generic_type (type_identifier) (type_arguments (type_identifier))) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (boolean_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (return_statement)) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (return_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (identifier) alternative: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (identifier))))))))