
"""simple docstring"""





def       lowerCamelCase__		(			__snake_case,     __snake_case	)							->		bool:


					"""simple docstring"""





					_UpperCamelCase							 =  len(__snake_case	)
					_UpperCamelCase							 =  [[False] * (required_sum + 1) for _ in range(arr_len + 1	)]

					# for each arr value, a sum of zero(0) can be formed by not taking any element
					# hence True/1
					for i in range(arr_len + 1	):
										_UpperCamelCase							 =  True

					# sum is not zero and set is empty then false
					for i in range(1,     required_sum + 1	):
										_UpperCamelCase							 =  False

					for i in range(1,     arr_len + 1	):
										for j in range(1,     required_sum + 1	):
															if arr[i - 1] > j:
																				_UpperCamelCase							 =  subset[i - 1][j]
															if arr[i - 1] <= j:
																				_UpperCamelCase							 =  subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

					return subset[arr_len][required_sum]


if __name__ == "__main__":
				import doctest

				doctest.testmod()








"""simple docstring"""





class     _UpperCAmelCase:



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






							'''simple docstring'''
							_UpperCamelCase							 =  {}



		def 						UpperCAmelCase							(					self)       ->       None:






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



		def 						UpperCAmelCase							(					self				,		__a				,		__a)       ->       None:






							'''simple docstring'''
							# check if vertex is already present,
							if from_vertex in self.vertex:
												self.vertex[from_vertex].append(__a)
							else:
												# else make a new vertex
												_UpperCamelCase							 =  [to_vertex]



		def 						UpperCAmelCase							(					self)       ->       None:






							'''simple docstring'''
							# visited array for storing already visited nodes
							_UpperCamelCase							 =  [False] * len(self.vertex)

							# call the recursive helper function
							for i in range(len(self.vertex)):
												if not visited[i]:
																	self.dfs_recursive(__a				,		__a)




		def 						UpperCAmelCase							(					self				,		__a				,		__a)       ->       None:






							'''simple docstring'''
							# mark start vertex as visited
							_UpperCamelCase							 =  True

							print(__a				,		end=''' ''')

							# Recur for all the vertices that are adjacent to this node
							for i in self.vertex:
												if not visited[i]:
																	self.dfs_recursive(__a				,		__a)


if __name__ == "__main__":
				_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()
				print("""DFS:""")
				g.dfs()

				# OUTPUT:
				# 0  ->  1 -> 2
				# 1  ->  2
				# 2  ->  0 -> 3
				# 3  ->  3
				# DFS:
				#  0 1 2 3






