



'''simple docstring'''




def        lowerCAmelCase_     (			_lowerCamelCase:     list[list[int]] ,   _lowerCamelCase:     int ,   _lowerCamelCase:     int ,   _lowerCamelCase:     list[int]      ):

		# 1. Validate that path exists between current and next vertices
		if graph[path[curr_ind - 1]][next_ver] == 0:
				return False

		# 2. Validate that next vertex is not already in path
		return not any(vertex == next_ver for vertex in path      )


def        lowerCAmelCase_     (			_lowerCamelCase:     list[list[int]] ,   _lowerCamelCase:     list[int] ,   _lowerCamelCase:     int      ):

		# Base Case
		if curr_ind == len(_lowerCamelCase      ):
				# return whether path exists between current and starting vertices
				return graph[path[curr_ind - 1]][path[0]] == 1

		# Recursive Step
		for next_ver in range(0 ,   len(_lowerCamelCase      )      ):
				if valid_connection(_lowerCamelCase ,   _lowerCamelCase ,   _lowerCamelCase ,   _lowerCamelCase      ):
						# Insert current vertex  into path as next transition
						__SCREAMING_SNAKE_CASE :	Tuple					 =	next_ver
						# Validate created path
						if util_hamilton_cycle(_lowerCamelCase ,   _lowerCamelCase ,   curr_ind + 1      ):
								return True
						# Backtrack
						__SCREAMING_SNAKE_CASE :	str					 =	-1
		return False


def        lowerCAmelCase_     (			_lowerCamelCase:     list[list[int]] ,   _lowerCamelCase:     int = 0      ):
		__SCREAMING_SNAKE_CASE :	Tuple					 =	[-1] * (len(_lowerCamelCase      ) + 1)
		# initialize start and end of path with starting index
		__SCREAMING_SNAKE_CASE :	Tuple					 =	start_index
		# evaluate and if we find answer return path either return empty array
		return path if util_hamilton_cycle(_lowerCamelCase ,   _lowerCamelCase ,   1      ) else []




'''simple docstring'''




UpperCamelCase__ :			List[str]												=				'''0.21.0'''

from .accelerator import Accelerator
from .big_modeling import (
    cpu_offload,
    cpu_offload_with_hook,
    disk_offload,
    dispatch_model,
    init_empty_weights,
    init_on_device,
    load_checkpoint_and_dispatch,
)
from .data_loader import skip_first_batches
from .launchers import debug_launcher, notebook_launcher
from .state import PartialState
from .utils import (
    DeepSpeedPlugin,
    DistributedDataParallelKwargs,
    DistributedType,
    FullyShardedDataParallelPlugin,
    GradScalerKwargs,
    InitProcessGroupKwargs,
    find_executable_batch_size,
    infer_auto_device_map,
    is_rich_available,
    load_checkpoint_in_model,
    synchronize_rng_states,
)


if is_rich_available():
						from .utils import rich