Counts number of vertices connected in a component containing x . Stores the count in k .
static void dfs ( List < int > [ ] graph , bool [ ] visited , int x ) { for ( int i = 0 ; i < graph [ x ] . Count ; i ++ ) { if ( ! visited [ graph [ x ] [ i ] ] ) {