
def 							a		(				snake_case__:   dict   ):


				'''simple docstring'''
				lowercase_	    =   set()
				# To detect a back edge, keep track of vertices currently in the recursion stack
				lowercase_	    =   set()
				return any(
				    node not in visited and depth_first_search(snake_case__		,  snake_case__		,  snake_case__		,  snake_case__   )
				    for node in graph   )




def 							a		(				snake_case__:   dict		,  snake_case__:   int		,  snake_case__:   set		,  snake_case__:   set   ):


				'''simple docstring'''
				visited.add(snake_case__   )
				rec_stk.add(snake_case__   )

				for node in graph[vertex]:
								if node not in visited:
												if depth_first_search(snake_case__		,  snake_case__		,  snake_case__		,  snake_case__   ):
																return True
								elif node in rec_stk:
												return True

    # The node needs to be removed from recursion stack before function ends
				rec_stk.remove(snake_case__   )
				return False


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

						testmod()






from __future__ import annotations




def 							a		(				snake_case__:   list[list[int]]   ):


				'''simple docstring'''

				# preprocessing the first row
				for i in range(1		,  len(matrix[0]   )   ):
								matrix[0][i] += matrix[0][i - 1]

				# preprocessing the first column
				for i in range(1		,  len(snake_case__   )   ):
								matrix[i][0] += matrix[i - 1][0]

				# updating the path cost for current position
				for i in range(1		,  len(snake_case__   )   ):
								for j in range(1		,  len(matrix[0]   )   ):
												matrix[i][j] += min(matrix[i - 1][j]		,  matrix[i][j - 1]   )

				return matrix[-1][-1]


if __name__ == "__main__":
						import doctest

						doctest.testmod()




