
def 		A						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


			if not isinstance(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE							):
						raise ValueError('Input series is not valid, valid series - [1, 2/3, 2]'							)
			if len(SCREAMING_SNAKE_CASE							) == 0:
						raise ValueError('Input list must be a non empty list'							)
			if len(SCREAMING_SNAKE_CASE							) == 1 and series[0] != 0:
						return True
			UpperCAmelCase__		:Union[str, Any] 		=    []
			UpperCAmelCase__		:Any 		=    len(SCREAMING_SNAKE_CASE							)
			for i in range(0     ,						SCREAMING_SNAKE_CASE							):
						if series[i] == 0:
									raise ValueError('Input series cannot have 0 as an element'							)
						rec_series.append(1 / series[i]							)
			UpperCAmelCase__		:Dict 		=    rec_series[1] - rec_series[0]
			for index in range(2     ,						SCREAMING_SNAKE_CASE							):
						if rec_series[index] - rec_series[index - 1] != common_diff:
									return False
			return True




def 		A						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


			if not isinstance(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE							):
						raise ValueError('Input series is not valid, valid series - [2, 4, 6]'							)
			if len(SCREAMING_SNAKE_CASE							) == 0:
						raise ValueError('Input list must be a non empty list'							)
			UpperCAmelCase__		:Dict 		=    0
			for val in series:
						answer += 1 / val
			return len(SCREAMING_SNAKE_CASE							) / answer


if __name__ == "__main__":
						import doctest

						doctest.testmod()







from __future__ import annotations

from queue import Queue


class 	UpperCamelCase__       :

						'''simple docstring'''



						def __init__(  self	)  ->None:
									UpperCAmelCase__		:dict[int, list[int]] 		=    {}


						def    A__       (  self	)  ->None:
									for i in self.vertices:
												print(A  , ' : '  , ' -> '.join([str(A	) for j in self.vertices[i]]	)	)


						def    A__       (  self  , A  , A	)  ->None:
									if from_vertex in self.vertices:
												self.vertices[from_vertex].append(A	)
									else:
												UpperCAmelCase__		:Union[str, Any] 		=    [to_vertex]


						def    A__       (  self  , A	)  ->set[int]:
									UpperCAmelCase__		:str 		=    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(A	)
									queue.put(A	)

									while not queue.empty():
												UpperCAmelCase__		:List[str] 		=    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(A	)
																		visited.add(A	)
									return visited


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

						testmod(verbose=True)

						__snake_case					:							Any           =							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]





