Find All Articulation Points in a Graph

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.

Input Format

n = number of vertices, edges = undirected edges [u, v]

Output Format

sorted list of articulation points

Constraints

  • 1 <= n <= 10^5
  • 1 <= edges.length <= 2 * 10^5

Examples

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.

Loading...
Find All Articulation Points in a Graph