0
0
DSA Cprogramming~10 mins

Articulation Points in Graph in DSA C - Execution Trace

Choose your learning style9 modes available
Concept Flow - Articulation Points in Graph
Start DFS from a node
Mark node visited, set discovery & low time
For each adjacent node
If not visited
Recurse DFS
Check articulation conditions
Mark articulation point if conditions met
Repeat for all nodes
End: All articulation points found
This flow shows how DFS visits nodes, updates discovery and low times, and identifies articulation points by checking conditions during traversal.
Execution Sample
DSA C
void APUtil(int u) {
  visited[u] = true;
  disc[u] = low[u] = ++time;
  int children = 0;
  for (int v : adj[u]) {
    if (!visited[v]) {
      children++;
      APUtil(v);
      low[u] = min(low[u], low[v]);
      if ((parent[u] == -1 && children > 1) || (parent[u] != -1 && low[v] >= disc[u])) {
        articulation_points[u] = true;
      }
    } else if (v != parent[u]) {
      low[u] = min(low[u], disc[v]);
    }
  }
}
This code runs DFS from node u, tracks discovery and low times, counts children, and marks articulation points.
Execution Table
StepOperationCurrent NodeVisited NodesDiscovery TimesLow TimesArticulation PointsStack/Call
1Start DFS0[0][0:1][0:1][][Call APUtil(0)]
2Visit neighbor 11[0,1][0:1,1:2][0:1,1:2][][Call APUtil(1)]
3Visit neighbor 22[0,1,2][0:1,1:2,2:3][0:1,1:2,2:3][][Call APUtil(2)]
4Backtrack from 21[0,1,2][0:1,1:2,2:3][0:1,1:2,2:3][][Return from APUtil(2)]
5Update low[1]1[0,1,2][0:1,1:2,2:3][0:1,1:1,2:3][][In APUtil(1)]
6Visit neighbor 33[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][][Call APUtil(3)]
7Backtrack from 31[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][][Return from APUtil(3)]
8Update low[1]1[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][][In APUtil(1)]
9Check articulation at 11[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][1][In APUtil(1)]
10Backtrack from 10[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][1][Return from APUtil(1)]
11Update low[0]0[0,1,2,3][0:1,1:2,2:3,3:4][0:1,1:1,2:3,3:4][1][In APUtil(0)]
12Visit neighbor 44[0,1,2,3,4][0:1,1:2,2:3,3:4,4:5][0:1,1:1,2:3,3:4,4:5][1][Call APUtil(4)]
13Visit neighbor 55[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1][Call APUtil(5)]
14Backtrack from 54[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1][Return from APUtil(5)]
15Update low[4]4[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1][In APUtil(4)]
16Backtrack from 40[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1,0][Return from APUtil(4)]
17Update low[0]0[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1,0][In APUtil(0)]
18Check articulation at 00[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1,0][In APUtil(0)]
19End DFS-[0,1,2,3,4,5][0:1,1:2,2:3,3:4,4:5,5:6][0:1,1:1,2:3,3:4,4:5,5:6][1,0][]
💡 All nodes visited, DFS complete, articulation points identified
Variable Tracker
VariableStartAfter Step 1After Step 5After Step 9After Step 16Final
visited[][0][0,1,2,3][0,1,2,3][0,1,2,3,4,5][0,1,2,3,4,5]
disc[-1,-1,-1,-1,-1,-1][1,-1,-1,-1,-1,-1][1,2,3,4,-1,-1][1,2,3,4,-1,-1][1,2,3,4,5,6][1,2,3,4,5,6]
low[-1,-1,-1,-1,-1,-1][1,-1,-1,-1,-1,-1][1,1,3,4,-1,-1][1,1,3,4,-1,-1][1,1,3,4,5,6][1,1,3,4,5,6]
articulation_points[][][][1][][1,0]
Key Moments - 3 Insights
Why do we update low[u] with low[v] after visiting a child v?
Because low[u] tracks the earliest visited node reachable from u or its descendants. Updating low[u] with low[v] (see step 5 and 8) helps detect if there's a back edge connecting v or its subtree to an ancestor of u.
Why is node 0 marked as an articulation point at step 18?
Node 0 is the root of DFS and has more than one child in the DFS tree (steps 1 and 16). This means removing it disconnects the graph, so it is an articulation point.
Why do we check if low[v] >= disc[u] to mark u as articulation point?
Because if low[v] (earliest reachable ancestor from v) is not less than disc[u], it means v and its subtree cannot reach an ancestor of u without going through u, so u is critical (see step 9).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table at step 9, which node is identified as an articulation point?
ANode 1
BNode 0
CNode 2
DNode 3
💡 Hint
Check the 'Articulation Points' column at step 9 in the execution table.
At which step does the DFS finish visiting all nodes?
AStep 16
BStep 19
CStep 12
DStep 5
💡 Hint
Look at the 'Operation' column for the step indicating 'End DFS' in the execution table.
If node 0 had only one child in DFS, what would happen to its articulation point status?
AIt would depend on low values of children
BIt would still be an articulation point
CIt would not be an articulation point
DIt would be marked only if it has back edges
💡 Hint
Refer to the key moment about root node articulation condition and step 18.
Concept Snapshot
Articulation Points in Graph:
- Use DFS to assign discovery and low times
- low[u] = earliest visited node reachable from u or descendants
- Node u is articulation if:
  * u is root with >1 child
  * low[v] >= disc[u] for child v
- Helps find critical nodes disconnecting graph
- Runs in O(V+E) time using DFS
Full Transcript
Articulation points are nodes in a graph which, if removed, increase the number of connected components. We find them using DFS traversal. Each node gets a discovery time and a low time. The low time tells the earliest visited node reachable from that node or its descendants. During DFS, if a child node cannot reach an ancestor of the current node, the current node is an articulation point. The root node is special: if it has more than one child, it is an articulation point. This method helps identify critical nodes that keep the graph connected. The process runs efficiently in linear time relative to nodes and edges.