assigning level to nodes
static void leveling ( int src ) { for ( int i = 0 ; i < ( g [ src ] . Count ) ; i ++ ) { int des = g [ src ] [ i ] ; if ( level [ des ] != 0 ) { level [ des ] = level [ src ] + 1 ; leveling ( des ) ; } } } static bool [ ] visited = new bool [ maxn ] ;