Count articulation points · Compiler

Count articulation points

Count the articulation points of a two-way network. Test each vertex against the original network. Remove that vertex and all its incident edges and count the connected components left. It qualifies if that count exceeds the original component count. Each isolated vertex forms one component.

Input
The first line contains n m. Vertices are numbered 0 through n-1 (1 <= n <= 50, 0 <= m <= 200). Each of the next m lines contains u v for an edge joining u and v in both directions. Endpoints differ and each unordered pair occurs at most once.
Output
Print the number of qualifying vertices. A graph with no remaining vertices has zero components.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…