Tarjan's Algorithm and Finding Articulation Points / Cut Vertices
We will not only discuss the Tarjan's algorithm, but will also discover how Tarjan's Algorithm is actually derived and why it actually works.

Algorithms and Data Structures: TheAlgorist.com

System Design: DistributedComputing.dev

Low Level Design: LowLevelDesign.io

Frontend Engineering: FrontendEngineering.io
Let G = (V, E) be a connected, undirected graph. An articulation point of G is a vertex whose removal disconnects G. A bridge of G is an edge whose removal disconnects G. A biconnected component of G is a maximal set of edges such that any two edges in the set lie on a common simple cycle. A simple cycle is a cycle with no repeated vertex.
The concept of Articulation Point is explained in the video below. Please excuse my speech impediment while watching the video. Thank you for your patience.
IMPORTANT ANNOUNCEMENT: For the most accurate code please see the code below, rather than looking at the code discussed in the video, as I have later found a bug in the code discussed in the video. Basically the constraints discussed for "parents" apply to all ancestors as well. The corrected version is posted in this chapter, please see the code below the video.
Pseudocode:
GetArticulationPoints(i, d)
visited[i] := true
depth[i] := d
low[i] := d
childCount := 0
isArticulation := false
for each ni in adj[i] do
if not visited[ni] then
parent[ni] := i
GetArticulationPoints(ni, d + 1)
childCount := childCount + 1
if low[ni] ≥ depth[i] then
isArticulation := true
low[i] := Min (low[i], low[ni])
else if ni ≠ parent[i] then
low[i] := Min (low[i], depth[ni])
if (parent[i] ≠ null and isArticulation) or (parent[i] = null and childCount > 1) then
Output i as articulation point
Working Solution:
Java code:
This is a Premium content.
Please subscribe to Algorithms course to access the code.
Python code:
This is a Premium content.
Please subscribe to Algorithms course to access the code.
Time Complexity:
Same as the DFS we are doing to compute Articulation points: O(E + V), where E = total number of edges in the given connected undirected graph, and V = total number of vertices in the given connected undirected graph.More on Tarjan's Algorithm:
Instructor:
If you have any feedback, please use this form: https://thealgorists.com/Feedback.