





"""simple docstring"""
def      __lowerCamelCase   (							a_     :		list[list[int]] ,   a_     :		int ,   a_     :		int ,   a_     :		list[int]							)			->      bool:

      # 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   (							a_     :		list[list[int]] ,   a_     :		list[int] ,   a_     :		int							)			->      bool:

      # Base Case
      if curr_ind == len(a_							):
            # 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(a_							)							):
            if valid_connection(a_ ,   a_ ,   a_ ,   a_							):
                  # Insert current vertex  into path as next transition
                  __SCREAMING_SNAKE_CASE   :str						=  next_ver
                  # Validate created path
                  if util_hamilton_cycle(a_ ,   a_ ,   curr_ind + 1							):
                        return True
                  # Backtrack
                  __SCREAMING_SNAKE_CASE   :List[Any]						=  -1
      return False







def      __lowerCamelCase   (							a_     :		list[list[int]] ,   a_     :		int = 0							)			->      list[int]:
      __SCREAMING_SNAKE_CASE   :List[str]						=  [-1] * (len(a_							) + 1)
      # initialize start and end of path with starting index
      __SCREAMING_SNAKE_CASE   :Optional[Any]						=  start_index
      # evaluate and if we find answer return path either return empty array
      return path if util_hamilton_cycle(a_ ,   a_ ,   1							) else []






"""simple docstring"""
import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict



@pytest.mark.parametrize(
    '''split_dict''' ,   [
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train''' ,   num_bytes=13_37 ,   num_examples=42 ,   dataset_name='''my_dataset'''							)}							),
        SplitDict({'''train''': SplitInfo(name='''train''' ,   num_bytes=13_37 ,   num_examples=42							)}							),
        SplitDict({'''train''': SplitInfo()}							),
    ] ,   )
def      __lowerCamelCase   (							a_     :		SplitDict							)			->      Optional[int]:
      __SCREAMING_SNAKE_CASE   :Tuple						=  split_dict._to_yaml_list()
      assert len(a_							) == len(a_							)
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  SplitDict._from_yaml_list(a_							)
      for split_name, split_info in split_dict.items():
            # dataset_name field is deprecated, and is therefore not part of the YAML dump
            __SCREAMING_SNAKE_CASE   :int						=  None
            # the split name of split_dict takes over the name of the split info object
            __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  split_name
      assert split_dict == reloaded







@pytest.mark.parametrize(
    '''split_info''' ,   [SplitInfo(), SplitInfo(dataset_name=a_							), SplitInfo(dataset_name='''my_dataset'''							)]							)
def      __lowerCamelCase   (							a_     :		Dict							)			->      Any:
      # For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
      # field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  asdict(SplitDict({'''train''': split_info}							)							)
      assert "dataset_name" in split_dict_asdict["train"]
      assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name