




'''simple docstring'''
from cva import destroyAllWindows, imread, imshow, waitKey






def A__					(  UpperCAmelCase_						,						UpperCAmelCase_							):
						_UpperCamelCase      :	Dict				       =     img.shape[0], img.shape[1]

						def to_grayscale(UpperCAmelCase_						,						UpperCAmelCase_						,						UpperCAmelCase_							):
												return 0.2_126 * red + 0.587 * green + 0.114 * blue

						def normalize(UpperCAmelCase_							):
												return min(UpperCAmelCase_						,						2_5_5							)

						for i in range(UpperCAmelCase_							):
												for j in range(UpperCAmelCase_							):
																		_UpperCamelCase      :	Union[str, Any]				       =     int(to_grayscale(*img[i][j]							)							)
																		_UpperCamelCase      :	List[str]				       =     [
																		    normalize(UpperCAmelCase_							),
																		    normalize(greyscale + factor							),
																		    normalize(greyscale + 2 * factor							),
																		]

						return img


if __name__ == "__main__":
					# read original image
					snake_case_				:			Tuple						 =						{
					    percentage: imread('image_data/lena.jpg', 1) for percentage in (10, 20, 30, 40)
					}

					for percentage, img in images.items():
										make_sepia(img, percentage)

					for percentage, img in images.items():
										imshow(F"""Original image with sepia (factor: {percentage})""", img)

					waitKey(0)
					destroyAllWindows()







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

from queue import Queue






class 							lowercase__			:





	def __init__(				self      :       int				):







							'''simple docstring'''
							_UpperCamelCase      :	dict[int, list[int]]				       =     {}





	def 			UpperCamelCase_						(				self      :       int				):







							'''simple docstring'''
							for i in self.vertices:
													print(lowerCamelCase__				,' : '				,' -> '.join([str(lowerCamelCase__				) for j in self.vertices[i]]				)				)





	def 			UpperCamelCase_						(				self      :       Optional[Any]				,lowerCamelCase__      :       int				,lowerCamelCase__      :       int				):







							'''simple docstring'''
							if from_vertex in self.vertices:
													self.vertices[from_vertex].append(lowerCamelCase__				)
							else:
													_UpperCamelCase      :	Any				       =     [to_vertex]





	def 			UpperCamelCase_						(				self      :       int				,lowerCamelCase__      :       int				):







							'''simple docstring'''
							_UpperCamelCase      :	Dict				       =     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)

					snake_case_				:			int						 =						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]


