


'''simple docstring'''
from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
@dataclass
class        lowercase     :

		"""simple docstring"""

		_a   			=    42
		_a   			=    42



class        lowercase     :

		"""simple docstring"""

		def __init__(		self   ,       UpperCamelCase_							):

							'''simple docstring'''


							UpperCamelCase__       :List[str]							 =			[[] for _ in range(a__							)]
							UpperCamelCase__       :List[str]							 =			size




		def __getitem__(		self   ,       UpperCamelCase_							):

							'''simple docstring'''


							return iter(self._graph[vertex]							)




		@property
		def    lowerCAmelCase__    (		self							):

							'''simple docstring'''


							return self._size




		def    lowerCAmelCase__    (		self   ,       UpperCamelCase_   ,       UpperCamelCase_   ,       UpperCamelCase_							):

							'''simple docstring'''


							if weight not in (0, 1):
												raise ValueError('''Edge weight must be either 0 or 1.'''							)

							if to_vertex < 0 or to_vertex >= self.size:
												raise ValueError('''Vertex indexes must be in [0; size).'''							)

							self._graph[from_vertex].append(Edge(a__   ,       a__							)							)




		def    lowerCAmelCase__    (		self   ,       UpperCamelCase_   ,       UpperCamelCase_							):

							'''simple docstring'''


							UpperCamelCase__       :Dict							 =			deque([start_vertex]							)
							UpperCamelCase__       :Optional[Any]							 =			[None] * self.size
							UpperCamelCase__       :List[Any]							 =			0

							while queue:
												UpperCamelCase__       :Tuple							 =			queue.popleft()
												UpperCamelCase__       :List[Any]							 =			distances[current_vertex]
												if current_distance is None:
																	continue

												for edge in self[current_vertex]:
																	UpperCamelCase__       :str							 =			current_distance + edge.weight
																	UpperCamelCase__       :Tuple							 =			distances[edge.destination_vertex]
																	if (
																	    isinstance(a__   ,       a__							)
																	    and new_distance >= dest_vertex_distance
																	):
																						continue
																	UpperCamelCase__       :Any							 =			new_distance
																	if edge.weight == 0:
																						queue.appendleft(edge.destination_vertex							)
																	else:
																						queue.append(edge.destination_vertex							)

							if distances[finish_vertex] is None:
												raise ValueError('''No path from start_vertex to finish_vertex.'''							)

							return distances[finish_vertex]


if __name__ == "__main__":
	import doctest

	doctest.testmod()



'''simple docstring'''
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
__snake_case											=					abspath(join(dirname(dirname(__file__)), '''src'''))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='''ignore''', category=FutureWarning)


def       a				(      __a       )  ->     Optional[int]:



					'''simple docstring'''






					from diffusers.utils.testing_utils import pytest_addoption_shared

					pytest_addoption_shared(__a       )







def       a				(      __a       )  ->     str:



					'''simple docstring'''






					from diffusers.utils.testing_utils import pytest_terminal_summary_main

					UpperCamelCase__       :Union[str, Any]							 =			terminalreporter.config.getoption('''--make-reports'''       )
					if make_reports:
										pytest_terminal_summary_main(__a			, id=__a       )