



def 						UpperCamelCase      (  snake_case__			:       Tuple      )      ->	int:  # noqa: E741
   UpperCamelCase       :    str		      =      len(snake_case__      )
   UpperCamelCase       :    List[str]		      =      0
   UpperCamelCase       :    List[Any]		      =      [0] * n
   UpperCamelCase       :    str		      =      [False] * n
   UpperCamelCase       :    List[Any]		      =      [False] * n

   def dfs(snake_case__			:       Any			,	snake_case__			:       Optional[int]			,	snake_case__			:       str			,	snake_case__			:       int      ):
      if parent == root:
         out_edge_count += 1
      UpperCamelCase       :    Dict		      =      True
      UpperCamelCase       :    str		      =      at

      for to in l[at]:
         if to == parent:
            pass
         elif not visited[to]:
            UpperCamelCase       :    Dict		      =      dfs(snake_case__			,	snake_case__			,	snake_case__			,	snake_case__      )
            UpperCamelCase       :    Optional[Any]		      =      min(low[at]			,	low[to]      )

            # AP found via bridge
            if at < low[to]:
               UpperCamelCase       :    Tuple		      =      True
            # AP found via cycle
            if at == low[to]:
               UpperCamelCase       :    Tuple		      =      True
         else:
            UpperCamelCase       :    Optional[Any]		      =      min(low[at]			,	snake_case__      )
      return out_edge_count

   for i in range(snake_case__      ):
      if not visited[i]:
         UpperCamelCase       :    Any		      =      0
         UpperCamelCase       :    List[Any]		      =      dfs(snake_case__			,	snake_case__			,	-1			,	snake_case__      )
         UpperCamelCase       :    Optional[int]		      =      out_edge_count > 1

   for x in range(len(snake_case__      )      ):
      if is_art[x] is True:
         print(snake_case__      )


# Adjacency list of graph
__UpperCAmelCase			  =			{
    0: [1, 2],
    1: [0, 2],
    2: [0, 1, 3, 5],
    3: [2, 4],
    4: [3],
    5: [2, 6, 8],
    6: [5, 7],
    7: [6, 8],
    8: [5, 7],
}


compute_ap(data)




from heapq import heappop, heappush

import numpy as np






def     lowerCAmelCase_			(   _SCREAMING_SNAKE_CASE     :				np.ndarray		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				tuple[int, int]		, _SCREAMING_SNAKE_CASE     :				bool		, ):
						UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		grid.shape
						UpperCamelCase_		:							List[str]  =		[-1, 1, 0, 0]
						UpperCamelCase_		:							Dict  =		[0, 0, -1, 1]
						if allow_diagonal:
												dx += [-1, -1, 1, 1]
												dy += [-1, 1, -1, 1]

						UpperCamelCase_,UpperCamelCase_		:							List[Any]  =		[(0, source)], set()
						UpperCamelCase_		:							Any  =		np.full((rows, cols)		, np.inf			)
						UpperCamelCase_		:							List[str]  =		0
						UpperCamelCase_		:							Union[str, Any]  =		np.empty((rows, cols)		, dtype=_SCREAMING_SNAKE_CASE			)
						UpperCamelCase_		:							Optional[int]  =		None

						while queue:
												((UpperCamelCase_),(UpperCamelCase_))		:							Any  =		heappop(_SCREAMING_SNAKE_CASE			)
												if (x, y) in visited:
																		continue
												visited.add((x, y)			)

												if (x, y) == destination:
																		UpperCamelCase_		:							Tuple  =		[]
																		while (x, y) != source:
																								path.append((x, y)			)
																								UpperCamelCase_,UpperCamelCase_		:							Union[str, Any]  =		predecessors[x, y]
																		path.append(_SCREAMING_SNAKE_CASE			)  # add the source manually
																		path.reverse()
																		return matrix[destination], path

												for i in range(len(_SCREAMING_SNAKE_CASE			)			):
																		UpperCamelCase_,UpperCamelCase_		:							Optional[Any]  =		x + dx[i], y + dy[i]
																		if 0 <= nx < rows and 0 <= ny < cols:
																								UpperCamelCase_		:							Union[str, Any]  =		grid[nx][ny]
																								if next_node == 1 and matrix[nx, ny] > dist + 1:
																														heappush(_SCREAMING_SNAKE_CASE		, (dist + 1, (nx, ny))			)
																														UpperCamelCase_		:							Optional[Any]  =		dist + 1
																														UpperCamelCase_		:							List[Any]  =		(x, y)

						return np.inf, []


if __name__ == "__main__":
	import doctest

	doctest.testmod()






