Apply dfs and add nodes belonging to this component
foreach ( int it in adj [ u ] ) { if ( vis [ it ] == 0 ) { componentSize += dfs ( it , adj , vis ) ; } } return componentSize ; } static int maximumComponentSize ( int [ ] a , int n ) {