Given an undirected graph, return all articulation points (cut vertices). Removing an articulation point increases the number of connected components. Pattern focus: Articulation Points. Use DFS entry times and low-link values to identify vertices whose removal disconnects the graph.
n = number of vertices, edges = undirected edges [u, v]
sorted list of articulation points
Example 1:
Input:
n = 5 edges = [[1,2],[2,3],[3,1],[3,4],[4,5]]
Output:
[3,4]
Explanation:
Vertices 3 and 4 are cut vertices.
Example 2:
Input:
n = 4 edges = [[1,2],[1,3],[1,4]]
Output:
[1]
Explanation:
The center of a star is the only articulation point.
Example 3:
Input:
n = 3 edges = [[1,2],[2,3],[3,1]]
Output:
[]
Explanation:
A cycle has no articulation points.