#C9185. Finding Articulation Points in an Undirected Graph

    ID: 53250 Type: Default 1000ms 256MiB

Finding Articulation Points in an Undirected Graph

Finding Articulation Points in an Undirected Graph

Given an undirected graph with V vertices and E edges, your task is to identify all the articulation points in the graph. An articulation point (or cut vertex) is a vertex whose removal increases the number of connected components of the graph.

Definition:

An articulation point is a vertex u such that removing u (and all edges incident on u) results in a graph with more connected components than the original. This problem uses the classic Depth-First Search (DFS) based algorithm with discovery times and low-link values.

Constraints:

  • $1 \leq V \leq 10^5$
  • $0 \leq E \leq 10^5$
  • $0 \leq u, v \leq V-1$

Example:

For example, consider a star graph with 5 vertices:

5 4
0 1
0 2
0 3
0 4

The only articulation point is vertex 0 because its removal disconnects the graph.

inputFormat

The input is given via stdin and has the following format:

V E
u1 v1
u2 v2
... 
ue ve

Where:

  • V is the number of vertices.
  • E is the number of edges.
  • Each of the next E lines contains two integers u and v denoting an undirected edge between vertices u and v.

It is guaranteed that the vertices are labeled from 0 to V-1.

outputFormat

Output the articulation points in ascending order in a single line separated by a single space. If there are no articulation points, output an empty line.

## sample
3 3
0 1
1 2
0 2