




from __future__ import annotations

from queue import Queue


class       SCREAMING_SNAKE_CASE_							:



	"""simple docstring"""


	def __init__(				self		:	Optional[Any]  )  ->					None:







						"""simple docstring"""







						__UpperCamelCase				:  dict[int, list[int]]								=			{}






	def 				lowerCamelCase__    (				self		:	Dict  )  ->					None:







						"""simple docstring"""







						for i in self.vertices:
											print(lowerCAmelCase				,    """ : """				,    """ -> """.join([str(lowerCAmelCase  ) for j in self.vertices[i]]  )  )






	def 				lowerCamelCase__    (				self		:	str				,    lowerCAmelCase		:	int				,    lowerCAmelCase		:	int  )  ->					None:







						"""simple docstring"""







						if from_vertex in self.vertices:
											self.vertices[from_vertex].append(lowerCAmelCase  )
						else:
											__UpperCamelCase				:  int								=			[to_vertex]






	def 				lowerCamelCase__    (				self		:	int				,    lowerCAmelCase		:	int  )  ->					set[int]:







						"""simple docstring"""







						__UpperCamelCase				:  Any								=			set()

						# create a first in first out queue to store all the vertices for BFS
						__UpperCamelCase				:  Queue								=			Queue()

						# mark the source node as visited and enqueue it
						visited.add(lowerCAmelCase  )
						queue.put(lowerCAmelCase  )

						while not queue.empty():
											__UpperCamelCase				:  Optional[Any]								=			queue.get()

											# loop through all adjacent vertex and enqueue it if not yet visited
											for adjacent_vertex in self.vertices[vertex]:
																if adjacent_vertex not in visited:
																					queue.put(lowerCAmelCase  )
																					visited.add(lowerCAmelCase  )
						return visited


if __name__ == "__main__":
	from doctest import testmod

	testmod(verbose=True)

	a__		    =    Graph()
	g.add_edge(0, 1)
	g.add_edge(0, 2)
	g.add_edge(1, 2)
	g.add_edge(2, 0)
	g.add_edge(2, 3)
	g.add_edge(3, 3)

	g.print_graph()
	# 0  :  1 -> 2
	# 1  :  2
	# 2  :  0 -> 3
	# 3  :  3

	assert sorted(g.bfs(2)) == [0, 1, 2, 3]












a__		    =    {
    "kilogram": 1,
    "gram": pow(10, 3),
    "milligram": pow(10, 6),
    "metric-ton": pow(10, -3),
    "long-ton": 0.00_0984_2073,
    "short-ton": 0.00_1102_3122,
    "pound": 2.20_4624_4202,
    "stone": 0.15_7473_1728,
    "ounce": 35.2_7399_0723,
    "carrat": 5000,
    "atomic-mass-unit": 6.0_2213_6652e26,
}

a__		    =    {
    "kilogram": 1,
    "gram": pow(10, -3),
    "milligram": pow(10, -6),
    "metric-ton": pow(10, 3),
    "long-ton": 1016.0_4608,
    "short-ton": 907.184,
    "pound": 0.45_3592,
    "stone": 6.3_5029,
    "ounce": 0.028_3495,
    "carrat": 0.0002,
    "atomic-mass-unit": 1.6_6054_0199e-27,
}





def 							A__   (snake_case      :		str		,  snake_case      :		str		,  snake_case      :		float							)    ->	float:
					if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
										__UpperCamelCase				:  Any								=			(
										    F'''Invalid \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
										    F'''Supported values are: {", ".join(snake_case							)}'''
										)
										raise ValueError(snake_case							)
					return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
	import doctest

	doctest.testmod()






