



from .imports import is_tqdm_available


if is_tqdm_available():
       from tqdm.auto import tqdm as _tqdm

from ..state import PartialState



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_ = True  ,					*SCREAMING_SNAKE_CASE_  ,					**SCREAMING_SNAKE_CASE_					):
   if not is_tqdm_available():
      raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."					)
   lowercase__   					=			False
   if main_process_only:
      lowercase__   					=			PartialState().local_process_index == 0
   return _tqdm(*SCREAMING_SNAKE_CASE_  ,					**SCREAMING_SNAKE_CASE_  ,					disable=SCREAMING_SNAKE_CASE_					)









from graphs.minimum_spanning_tree_kruskal import kruskal



def __lowerCAmelCase	(       ):
			lowercase__   					=			9
			lowercase__   					=			[
			    [0, 1, 4],
			    [0, 7, 8],
			    [1, 2, 8],
			    [7, 8, 7],
			    [7, 6, 1],
			    [2, 8, 2],
			    [8, 6, 6],
			    [2, 3, 7],
			    [2, 5, 4],
			    [6, 5, 2],
			    [3, 5, 14],
			    [3, 4, 9],
			    [5, 4, 10],
			    [1, 7, 11],
			]

			lowercase__   					=			kruskal(SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_					)

			lowercase__   					=			[
			    [7, 6, 1],
			    [2, 8, 2],
			    [6, 5, 2],
			    [0, 1, 4],
			    [2, 5, 4],
			    [2, 3, 7],
			    [0, 7, 8],
			    [3, 4, 9],
			]

			assert sorted(SCREAMING_SNAKE_CASE_					) == sorted(SCREAMING_SNAKE_CASE_					)




