



from __future__ import annotations





class 							lowerCAmelCase_		:







		def __init__(    self  :   Dict       ,		UpperCAmelCase_  :   int					)       ->		None:


						'''simple docstring'''







						_UpperCAmelCase						:  int     					=	vertices
						_UpperCAmelCase						:  Any     					=	[[0] * vertices for _ in range(UpperCAmelCase_					)]







		def 					a_  (    self  :   Optional[Any]       ,		UpperCAmelCase_  :   list[int]					)       ->		None:


						'''simple docstring'''







						print('''Vertex \t Distance from Source'''					)
						for vertex in range(self.vertices					):
										print(UpperCAmelCase_       ,		'''\t\t'''       ,		distances_from_source[vertex]					)







		def 					a_  (    self  :   List[str]       ,		UpperCAmelCase_  :   list[int]       ,		UpperCAmelCase_  :   list[bool]					)       ->		int:


						'''simple docstring'''







						_UpperCAmelCase						:  int     					=	1E7
						_UpperCAmelCase						:  List[str]     					=	0

						# Search not nearest vertex not in the shortest path tree
						for vertex in range(self.vertices					):
										if distances_from_source[vertex] < minimum and visited[vertex] is False:
														_UpperCAmelCase						:  Union[str, Any]     					=	distances_from_source[vertex]
														_UpperCAmelCase						:  Any     					=	vertex
						return min_index







		def 					a_  (    self  :   Union[str, Any]       ,		UpperCAmelCase_  :   int					)       ->		None:


						'''simple docstring'''







						_UpperCAmelCase						:  Tuple     					=	[int(1E7					)] * self.vertices  # distances from the source
						_UpperCAmelCase						:  Union[str, Any]     					=	0
						_UpperCAmelCase						:  str     					=	[False] * self.vertices

						for _ in range(self.vertices					):
										_UpperCAmelCase						:  str     					=	self.minimum_distance(UpperCAmelCase_       ,		UpperCAmelCase_					)
										_UpperCAmelCase						:  List[str]     					=	True

										# Update dist value of the adjacent vertices
										# of the picked vertex only if the current
										# distance is greater than new distance and
										# the vertex in not in the shortest path tree
										for v in range(self.vertices					):
														if (
														    self.graph[u][v] > 0
														    and visited[v] is False
														    and distances[v] > distances[u] + self.graph[u][v]
														):
																		_UpperCAmelCase						:  Any     					=	distances[u] + self.graph[u][v]

						self.print_solution(UpperCAmelCase_					)


if __name__ == "__main__":
					UpperCAmelCase__			:   Dict      			=    Graph(9)
					UpperCAmelCase__			:   List[str]      			=    [
					    [0, 4, 0, 0, 0, 0, 0, 8, 0],
					    [4, 0, 8, 0, 0, 0, 0, 11, 0],
					    [0, 8, 0, 7, 0, 4, 0, 0, 2],
					    [0, 0, 7, 0, 9, 14, 0, 0, 0],
					    [0, 0, 0, 9, 0, 10, 0, 0, 0],
					    [0, 0, 4, 14, 10, 0, 2, 0, 0],
					    [0, 0, 0, 0, 0, 2, 0, 1, 6],
					    [8, 11, 0, 0, 0, 0, 1, 0, 7],
					    [0, 0, 2, 0, 0, 0, 6, 7, 0],
					]
					graph.dijkstra(0)





import importlib.metadata
import sys

from transformers.testing_utils import TestCasePlus
from transformers.utils.versions import require_version, require_version_core


UpperCAmelCase__			:   str      			=    importlib.metadata.version('numpy')
UpperCAmelCase__			:   Optional[int]      			=    '.'.join([str(x) for x in sys.version_info[:3]])





class 							lowerCAmelCase_		(		lowercase_     ):







		def 					a_  (    self  :   Tuple					)       ->		Tuple:


						'''simple docstring'''







						require_version_core('''numpy<1000.4.5'''					)
						require_version_core('''numpy<1000.4'''					)
						require_version_core('''numpy<1000'''					)

						# le
						require_version_core('''numpy<=1000.4.5'''					)
						require_version_core(F'''numpy<={numpy_ver}'''					)

						# eq
						require_version_core(F'''numpy=={numpy_ver}'''					)

						# ne
						require_version_core('''numpy!=1000.4.5'''					)

						# ge
						require_version_core('''numpy>=1.0'''					)
						require_version_core('''numpy>=1.0.0'''					)
						require_version_core(F'''numpy>={numpy_ver}'''					)

						# gt
						require_version_core('''numpy>1.0.0'''					)

						# mix
						require_version_core('''numpy>1.0.0,<1000'''					)

						# requirement w/o version
						require_version_core('''numpy'''					)

						# unmet requirements due to version conflict
						for req in ["numpy==1.0.0", "numpy>=1000.0.0", F'''numpy<{numpy_ver}''']:
										try:
														require_version_core(UpperCAmelCase_					)
										except ImportError as e:
														self.assertIn(F'''{req} is required'''       ,		str(UpperCAmelCase_					)					)
														self.assertIn('''but found'''       ,		str(UpperCAmelCase_					)					)

        # unmet requirements due to missing module
						for req in ["numpipypie>1", "numpipypie2"]:
										try:
														require_version_core(UpperCAmelCase_					)
										except importlib.metadata.PackageNotFoundError as e:
														self.assertIn(F'''The \'{req}\' distribution was not found and is required by this application'''       ,		str(UpperCAmelCase_					)					)
														self.assertIn('''Try: pip install transformers -U'''       ,		str(UpperCAmelCase_					)					)

        # bogus requirements formats:
        # 1. whole thing
						for req in ["numpy??1.0.0", "numpy1.0.0"]:
										try:
														require_version_core(UpperCAmelCase_					)
										except ValueError as e:
														self.assertIn('''requirement needs to be in the pip package format'''       ,		str(UpperCAmelCase_					)					)
        # 2. only operators
						for req in ["numpy=1.0.0", "numpy == 1.00", "numpy<>1.0.0", "numpy><1.00", "numpy>>1.0.0"]:
										try:
														require_version_core(UpperCAmelCase_					)
										except ValueError as e:
														self.assertIn('''need one of '''       ,		str(UpperCAmelCase_					)					)







		def 					a_  (    self  :   Tuple					)       ->		List[Any]:


						'''simple docstring'''







						require_version('''python>=3.6.0'''					)

						# not matching requirements
						for req in ["python>9.9.9", "python<3.0.0"]:
										try:
														require_version_core(UpperCAmelCase_					)
										except ImportError as e:
														self.assertIn(F'''{req} is required'''       ,		str(UpperCAmelCase_					)					)
														self.assertIn(F'''but found python=={python_ver}'''       ,		str(UpperCAmelCase_					)					)
