

from __future__ import annotations

import re


def  __a    (				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''

    def alphanum_key(SCREAMING_SNAKE_CASE ):
        return [int(SCREAMING_SNAKE_CASE ) if s.isdigit() else s.lower() for s in re.split('''([0-9]+)'''    ,				SCREAMING_SNAKE_CASE )]

    return sorted(SCREAMING_SNAKE_CASE    ,				key=SCREAMING_SNAKE_CASE )


if __name__ == "__main__":
       import doctest

       doctest.testmod()







from __future__ import annotations

from collections import deque
from queue import Queue
from timeit import timeit

A_						:     Optional[int]			  =				{
    'A': ['B', 'C'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F'],
    'D': ['B'],
    'E': ['B', 'F'],
    'F': ['C', 'E'],
}


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''
    __UpperCAmelCase			   =     {start}
    __UpperCAmelCase			   =     [start]
    __UpperCAmelCase			   =     Queue()
    queue.put(SCREAMING_SNAKE_CASE )
    while not queue.empty():
        __UpperCAmelCase			   =     queue.get()
        for w in graph[v]:
            if w not in explored:
                explored.add(SCREAMING_SNAKE_CASE )
                result.append(SCREAMING_SNAKE_CASE )
                queue.put(SCREAMING_SNAKE_CASE )
    return result


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''
    __UpperCAmelCase			   =     {start}
    __UpperCAmelCase			   =     [start]
    __UpperCAmelCase			   =     deque([start] )
    while queue:
        __UpperCAmelCase			   =     queue.popleft()
        for child in graph[v]:
            if child not in visited:
                visited.add(SCREAMING_SNAKE_CASE )
                result.append(SCREAMING_SNAKE_CASE )
                queue.append(SCREAMING_SNAKE_CASE )
    return result


def  __a    (				SCREAMING_SNAKE_CASE ) ->       None:






    '''simple docstring'''
    __UpperCAmelCase			   =     f'''from __main__ import G, {name}'''
    __UpperCAmelCase			   =     1_0_0_0_0
    __UpperCAmelCase			   =     timeit(f'''{name}(G, \'A\')'''    ,				setup=SCREAMING_SNAKE_CASE    ,				number=SCREAMING_SNAKE_CASE )
    print(f'''{name:<35} finished {number} runs in {res:.5f} seconds''' )


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       benchmark_function('breadth_first_search')
       benchmark_function('breadth_first_search_with_deque')
       # breadth_first_search                finished 10000 runs in 0.20999 seconds
       # breadth_first_search_with_deque     finished 10000 runs in 0.01421 seconds




