called every time before a BFS so that visited array is reset to zero
internal static void reset_visited ( ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { visited [ i ] [ j ] = 0 ; } } }