Fundamentals/Find Critical Servers
← PrevNext →
Given an undirected graph, find all articulation points — vertices whose removal (along with their incident edges) would disconnect the graph or increase its number of connected components. Return the IDs in ascending order.
Input
nodeNum: total number of vertices, with IDs 0 to nodeNum - 1
edges: array of [u, v] pairs representing undirected edges
Output
A sorted list of vertex IDs that are articulation points.
Examples
Example 1
InputnodeNum = 7, edges = [[0,1],[0,2],[1,3],[2,3],[2,5],[5,6],[3,4]]
Output[2, 3, 5]
Example 2
InputnodeNum = 3, edges = [[0,1],[1,2],[0,2]]
Output[]
Constraints
1 <= nodeNum <= 10^5.
The graph may be disconnected.