
import math

class    lowerCAmelCase__     :






		def __init__(		self		:							Optional[int]							,			SCREAMING_SNAKE_CASE__		:							Any=0  )     ->							Any:  # a graph with Node 0,1,...,N-1
						__lowerCamelCase    					=	n
						__lowerCamelCase    					=	[
						    [math.inf for j in range(0							,			SCREAMING_SNAKE_CASE__  )] for i in range(0							,			SCREAMING_SNAKE_CASE__  )
						]  # adjacency matrix for weight
						__lowerCamelCase    					=	[
						    [math.inf for j in range(0							,			SCREAMING_SNAKE_CASE__  )] for i in range(0							,			SCREAMING_SNAKE_CASE__  )
						]  # dp[i][j] stores minimum distance from i to j






		def  __A       (		self		:							Optional[Any]							,			SCREAMING_SNAKE_CASE__		:							Any							,			SCREAMING_SNAKE_CASE__		:							List[Any]							,			SCREAMING_SNAKE_CASE__		:							Optional[int]  )     ->							Optional[Any]:
						__lowerCamelCase    					=	w






		def  __A       (		self		:							Tuple  )     ->							int:
						for k in range(0							,			self.n  ):
										for i in range(0							,			self.n  ):
														for j in range(0							,			self.n  ):
																		__lowerCamelCase    					=	min(self.dp[i][j]							,			self.dp[i][k] + self.dp[k][j]  )







		def  __A       (		self		:							Any							,			SCREAMING_SNAKE_CASE__		:							Optional[int]							,			SCREAMING_SNAKE_CASE__		:							int  )     ->							Dict:
						return self.dp[u][v]


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE__   :			Any												=    Graph(5)
					graph.add_edge(0, 2, 9)
					graph.add_edge(0, 4, 10)
					graph.add_edge(1, 3, 5)
					graph.add_edge(2, 3, 7)
					graph.add_edge(3, 0, 10)
					graph.add_edge(3, 1, 2)
					graph.add_edge(3, 2, 1)
					graph.add_edge(3, 4, 6)
					graph.add_edge(4, 1, 3)
					graph.add_edge(4, 2, 4)
					graph.add_edge(4, 3, 9)
					graph.floyd_warshall()
					graph.show_min(1, 4)
					graph.show_min(0, 3)





import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey

class    lowerCAmelCase__     :






		def __init__(		self		:							Any							,			SCREAMING_SNAKE_CASE__		:							List[str]							,			SCREAMING_SNAKE_CASE__		:							int							,			SCREAMING_SNAKE_CASE__		:							int  )     ->							Dict:
						if dst_width < 0 or dst_height < 0:
										raise ValueError('''Destination width/height should be > 0'''  )

						__lowerCamelCase    					=	img
						__lowerCamelCase    					=	img.shape[1]
						__lowerCamelCase    					=	img.shape[0]
						__lowerCamelCase    					=	dst_width
						__lowerCamelCase    					=	dst_height

						__lowerCamelCase    					=	self.src_w / self.dst_w
						__lowerCamelCase    					=	self.src_h / self.dst_h

						__lowerCamelCase    					=	__lowerCamelCase    					=	(
						    np.ones((self.dst_h, self.dst_w, 3)							,			np.uinta  ) * 2_55
						)






		def  __A       (		self		:							List[Any]  )     ->							str:
						for i in range(self.dst_h  ):
										for j in range(self.dst_w  ):
														__lowerCamelCase    					=	self.img[self.get_y(SCREAMING_SNAKE_CASE__  )][self.get_x(SCREAMING_SNAKE_CASE__  )]






		def  __A       (		self		:							str							,			SCREAMING_SNAKE_CASE__		:							int  )     ->							int:
						return int(self.ratio_x * x  )







		def  __A       (		self		:							str							,			SCREAMING_SNAKE_CASE__		:							int  )     ->							int:
						return int(self.ratio_y * y  )


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE__							,    SCREAMING_SNAKE_CASE__   :			List[str]												=    800, 600
					SCREAMING_SNAKE_CASE__   :			int												=    imread("image_data/lena.jpg", 1)
					SCREAMING_SNAKE_CASE__   :			Union[str, Any]												=    NearestNeighbour(im, dst_w, dst_h)
					n.process()

					imshow(
					    F'Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}', n.output
					)
					waitKey(0)
					destroyAllWindows()



