


def     _SCREAMING_SNAKE_CASE      (					SCREAMING_SNAKE_CASE					,     SCREAMING_SNAKE_CASE					,     SCREAMING_SNAKE_CASE					,     SCREAMING_SNAKE_CASE			):
  A_ :							Optional[Any]							=   [False] * len(_lowercase			)
  A_ :							Optional[Any]							=   []
  queue.append(_lowercase			)
  A_ :							Any							=   True

  while queue:
    A_ :							Optional[Any]							=   queue.pop(0			)
    for ind in range(len(graph[u]			)			):
      if visited[ind] is False and graph[u][ind] > 0:
        queue.append(_lowercase			)
        A_ :							Dict							=   True
        A_ :							Any							=   u

  return visited[t]


def     _SCREAMING_SNAKE_CASE      (					SCREAMING_SNAKE_CASE					,     SCREAMING_SNAKE_CASE					,     SCREAMING_SNAKE_CASE			):
  A_ :							List[Any]							=   [-1] * (len(_lowercase			))
  A_ :							int							=   0
  while bfs(_lowercase					,     _lowercase					,     _lowercase					,     _lowercase			):
    A_ :							Optional[Any]							=   float('''Inf'''			)
    A_ :							int							=   sink

    while s != source:
      # Find the minimum value in select path
      A_ :							str							=   min(_lowercase					,     graph[parent[s]][s]			)
      A_ :							Dict							=   parent[s]

    max_flow += path_flow
    A_ :							List[str]							=   sink

    while v != source:
      A_ :							Optional[Any]							=   parent[v]
      graph[u][v] -= path_flow
      graph[v][u] += path_flow
      A_ :							List[Any]							=   parent[v]
  return max_flow


UpperCamelCase														=      [
    [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],
]

UpperCamelCase														=      0, 5







print(ford_fulkerson(graph, source, sink))











__UpperCamelCase:	str = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

__UpperCamelCase:	Tuple = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : dict[int, list[int]]   ,    _lowercase     : int   ,    _lowercase     : list[bool]			)   ->							list[int]:




		'''simple docstring'''
		lowercase__					:      str      =		True
		lowercase__					:      int      =		[]

		for neighbour in graph[vert]:
				if not visited[neighbour]:
						order += topology_sort(_lowercase   ,    _lowercase   ,    _lowercase			)

		order.append(_lowercase			)

		return order


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : dict[int, list[int]]   ,    _lowercase     : int   ,    _lowercase     : list[bool]			)   ->							list[int]:




		'''simple docstring'''
		lowercase__					:      Union[str, Any]      =		True
		lowercase__					:      Optional[Any]      =		[vert]

		for neighbour in reversed_graph[vert]:
				if not visited[neighbour]:
						component += find_components(_lowercase   ,    _lowercase   ,    _lowercase			)

		return component





def       SCREAMING_SNAKE_CASE__  (       _lowercase     : dict[int, list[int]]			)   ->							list[list[int]]:




		'''simple docstring'''
		lowercase__					:      Optional[int]      =		len(_lowercase			) * [False]
		lowercase__					:      dict[int, list[int]]      =		{vert: [] for vert in range(len(_lowercase			)			)}

		for vert, neighbours in graph.items():
				for neighbour in neighbours:
						reversed_graph[neighbour].append(_lowercase			)

		lowercase__					:      Dict      =		[]
		for i, was_visited in enumerate(_lowercase			):
				if not was_visited:
						order += topology_sort(_lowercase   ,    _lowercase   ,    _lowercase			)

		lowercase__					:      Dict      =		[]
		lowercase__					:      Optional[Any]      =		len(_lowercase			) * [False]

		for i in range(len(_lowercase			)			):
				lowercase__					:      List[Any]      =		order[len(_lowercase			) - i - 1]
				if not visited[vert]:
						lowercase__					:      Tuple      =		find_components(_lowercase   ,    _lowercase   ,    _lowercase			)
						components_list.append(_lowercase			)

		return components_list


