Graph Theory37 sections · 1633 units
Open in Course

Articulation Point Pseudocode

(DFS with discovery and low)

Here is the articulation point detection algorithm:

timer = 0
disc = array of size n, all -1
low = array of size n
isAP = array of size n, all false

function dfs(v, parent):
    disc[v] = low[v] = timer
    timer = timer + 1
    children = 0

    for w in adj[v]:
        if w == parent:
            continue
        if disc[w] == -1:
            children = children + 1
            dfs(w, v)
            low[v] = min(low[v], low[w])
            if parent != -1 and low[w] >= disc[v]:
                isAP[v] = true
        else:
            low[v] = min(low[v], disc[w])

    if parent == -1 and children >= 2:
        isAP[v] = true

for v from 0 to n - 1:
    if disc[v] == -1:
        dfs(v, -1)

A non-root vertex vv is an articulation point if low[w] >= disc[v] for some child ww. The root is an articulation point if it has 22+ children.