






'''simple docstring'''




lowerCAmelCase__          =						[
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_)							->     Any:
		# Return True if there is node that has not iterated.
		UpperCamelCase__				:					Any					=					[False] * len(lowerCamelCase_)
		UpperCamelCase__				:					List[str]					=					[s]
		UpperCamelCase__				:					Any					=					True

		while queue:
				UpperCamelCase__				:					int					=					queue.pop(0)
				for ind in range(len(graph[u])):
						if visited[ind] is False and graph[u][ind] > 0:
								queue.append(lowerCamelCase_)
								UpperCamelCase__				:					int					=					True
								UpperCamelCase__				:					Union[str, Any]					=					u

		return visited[t]







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_)							->     Tuple:
		UpperCamelCase__				:					Union[str, Any]					=					[-1] * (len(lowerCamelCase_))
		UpperCamelCase__				:					int					=					0
		UpperCamelCase__				:					List[Any]					=					[]
		UpperCamelCase__				:					int					=					[i[:] for i in graph]  # Record original cut, copy.
		while bfs(lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_):
				UpperCamelCase__				:					List[str]					=					float('Inf')
				UpperCamelCase__				:					List[Any]					=					sink

				while s != source:
						# Find the minimum value in select path
						UpperCamelCase__				:					Optional[Any]					=					min(lowerCamelCase_     ,      graph[parent[s]][s])
						UpperCamelCase__				:					str					=					parent[s]

				max_flow += path_flow
				UpperCamelCase__				:					int					=					sink

				while v != source:
						UpperCamelCase__				:					Union[str, Any]					=					parent[v]
						graph[u][v] -= path_flow
						graph[v][u] += path_flow
						UpperCamelCase__				:					Optional[Any]					=					parent[v]

		for i in range(len(lowerCamelCase_)):
				for j in range(len(graph[0])):
						if graph[i][j] == 0 and temp[i][j] > 0:
								res.append((i, j))

		return res


if __name__ == "__main__":
		print(mincut(test_graph, source=0, sink=5))












'''simple docstring'''




from ..utils import DummyObject, requires_backends







class       __lowercase					(metaclass=__lowerCamelCase    ):
	_lowerCamelCase              =  ['''torch''', '''scipy''']

	def __init__(      self   :						List[Any]  ,					*UpperCAmelCase_   :						Any  ,					**UpperCAmelCase_   :						int):
			requires_backends(self  ,					['torch', 'scipy'])

	@classmethod
	def      __UpperCamelCase							(      cls   :						Union[str, Any]  ,					*UpperCAmelCase_   :						Any  ,					**UpperCAmelCase_   :						List[Any]):
			requires_backends(cls  ,					['torch', 'scipy'])





	@classmethod
	def      __UpperCamelCase							(      cls   :						Union[str, Any]  ,					*UpperCAmelCase_   :						Optional[Any]  ,					**UpperCAmelCase_   :						Any):
			requires_backends(cls  ,					['torch', 'scipy'])




