If unvisited push onto queue and mark visited as 1 and add the distance of curr + 1.
if ( vis [ x ] == 0 ) : NEW_LINE INDENT vis [ x ] = 1 NEW_LINE q . append ( x ) NEW_LINE dis [ x ] = dis [ curr ] + 1 NEW_LINE DEDENT