Given an undirected graph, count how many articulation points it contains. An articulation point is a vertex whose removal disconnects the graph. Pattern focus: Articulation Points. This is the counting version of cut-vertex detection.
n = number of vertices, edges = undirected edges [u, v]
number of articulation points
Example 1:
Input:
n = 5 edges = [[1,2],[2,3],[3,1],[3,4],[4,5]]
Output:
2
Explanation:
Vertices 3 and 4 are articulation points.
Example 2:
Input:
n = 4 edges = [[1,2],[1,3],[1,4]]
Output:
1
Explanation:
Only the center vertex is a cut vertex.
Example 3:
Input:
n = 3 edges = [[1,2],[2,3],[3,1]]
Output:
0
Explanation:
A cycle has no articulation points.