






def 	lowerCAmelCase_		(lowercase__						:       list[int]     ,					lowercase__						:       list[int]     ,					lowercase__						:       int       )		->    bool:


				'''simple docstring'''




				return not any(
				    neighbour == 1 and colored_vertices[i] == color
				    for i, neighbour in enumerate(lowercase__       )       )





def 	lowerCAmelCase_		(lowercase__						:       list[list[int]]     ,					lowercase__						:       int     ,					lowercase__						:       list[int]     ,					lowercase__						:       int       )		->    bool:


				'''simple docstring'''




				if index == len(lowercase__       ):
								return True

				# Recursive Step
				for i in range(lowercase__       ):
								if valid_coloring(graph[index]     ,					lowercase__     ,					lowercase__       ):
												# Color current vertex
												lowerCAmelCase__      			=						i
												# Validate coloring
												if util_color(lowercase__     ,					lowercase__     ,					lowercase__     ,					index + 1       ):
																return True
												# Backtrack
												lowerCAmelCase__      			=						-1
				return False





def 	lowerCAmelCase_		(lowercase__						:       list[list[int]]     ,					lowercase__						:       int       )		->    list[int]:


				'''simple docstring'''




				lowerCAmelCase__      			=						[-1] * len(lowercase__       )

				if util_color(lowercase__     ,					lowercase__     ,					lowercase__     ,					0       ):
								return colored_vertices

				return []













import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey
class  lowerCAmelCase_       :




							def __init__(   self     :   Union[str, Any] ,							SCREAMING_SNAKE_CASE_     :   Optional[Any] ,							SCREAMING_SNAKE_CASE_     :   int ,							SCREAMING_SNAKE_CASE_     :   int	):
											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	) * 255
											)




							def 						__snake_case					(   self     :   List[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 						__snake_case					(   self     :   Any ,							SCREAMING_SNAKE_CASE_     :   int	):
											return int(self.ratio_x * x	)




							def 						__snake_case					(   self     :   List[str] ,							SCREAMING_SNAKE_CASE_     :   int	):
											return int(self.ratio_y * y	)


if __name__ == "__main__":
			_UpperCAmelCase				,   _UpperCAmelCase			:		List[str]   				=    800, 600
			_UpperCAmelCase			:		Tuple   				=    imread("image_data/lena.jpg", 1)
			_UpperCAmelCase			:		str   				=    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()





