Bird
Raised Fist0
DSA Typescriptprogramming~5 mins

Articulation Points in Graph in DSA Typescript - Cheat Sheet & Quick Revision

Choose your learning style10 modes available
Recall & Review
beginner
What is an articulation point in a graph?
An articulation point is a vertex in a graph that, if removed along with its edges, increases the number of connected components. It is also called a cut vertex.
Click to reveal answer
intermediate
Which algorithm is commonly used to find articulation points in a graph?
Tarjan's algorithm using DFS (Depth First Search) with discovery and low time arrays is commonly used to find articulation points efficiently.
Click to reveal answer
intermediate
In Tarjan's algorithm, what does the 'low' value represent for a vertex?
The 'low' value of a vertex is the earliest discovery time reachable from that vertex or its descendants by following back edges.
Click to reveal answer
intermediate
Why is the root of DFS tree an articulation point only if it has more than one child?
Because if the root has more than one child, removing it disconnects those children subtrees, increasing connected components. If it has one or zero children, removal does not disconnect the graph.
Click to reveal answer
intermediate
What is the time complexity of finding articulation points using Tarjan's algorithm?
The time complexity is O(V + E), where V is the number of vertices and E is the number of edges, because it uses a single DFS traversal.
Click to reveal answer
What happens if you remove an articulation point from a connected graph?
AThe graph becomes a tree
BThe graph remains connected
CThe graph becomes disconnected or increases connected components
DNothing changes
In Tarjan's algorithm, which data structure is primarily used to explore the graph?
AQueue
BDepth First Search (DFS) recursion
CBreadth First Search (BFS)
DStack
What does a 'back edge' in DFS indicate?
AAn edge to a child vertex
BAn edge that forms a cycle with the root only
CAn edge to a disconnected vertex
DAn edge to a previously visited ancestor vertex
Which condition identifies a vertex u as an articulation point when u is not the root?
AIf low[v] >= disc[u] for any child v of u
BIf disc[u] > low[v] for any child v of u
CIf u has no children
DIf u is connected to all vertices
What is the initial value of discovery time for all vertices before DFS starts?
A-1 or undefined
BInfinity
C0
D1
Explain how Tarjan's algorithm finds articulation points in a graph using DFS.
Think about how discovery and low values help detect if a vertex connects different parts of the graph.
You got /5 concepts.
    Describe why the root of the DFS tree is treated differently when identifying articulation points.
    Consider how removing the root affects connectivity compared to other vertices.
    You got /4 concepts.

      Practice

      (1/5)
      1. What is an articulation point (or cut vertex) in a graph?
      easy
      A. A vertex that, when removed, increases the number of connected components
      B. A vertex with the highest degree in the graph
      C. A vertex connected to all other vertices
      D. A vertex that has no edges connected to it

      Solution

      1. Step 1: Understand the definition of articulation point

        An articulation point is a vertex that, if removed, breaks the graph into more pieces (connected components).
      2. Step 2: Compare options with definition

        Only A vertex that, when removed, increases the number of connected components matches this definition exactly.
      3. Final Answer:

        A vertex that, when removed, increases the number of connected components -> Option A
      4. Quick Check:

        Articulation point = vertex increasing components when removed [OK]
      Hint: Articulation point breaks graph connectivity when removed [OK]
      Common Mistakes:
      • Confusing articulation point with highest degree vertex
      • Thinking articulation point connects to all vertices
      • Assuming isolated vertex is articulation point
      2. Which of the following is the correct TypeScript function signature to find articulation points in an undirected graph represented as adjacency list?
      easy
      A. function findArticulationPoints(graph: number): number[]
      B. function findArticulationPoints(graph: number[][]): void
      C. function findArticulationPoints(graph: string): number[]
      D. function findArticulationPoints(graph: Map): number[]

      Solution

      1. Step 1: Identify the graph representation type

        An adjacency list is best represented as a Map from node number to array of connected nodes.
      2. Step 2: Check function signature compatibility

        function findArticulationPoints(graph: Map): number[] uses Map and returns number[] which fits the problem.
      3. Final Answer:

        function findArticulationPoints(graph: Map<number, number[]>): number[] -> Option D
      4. Quick Check:

        Adjacency list as Map with number arrays returns number array [OK]
      Hint: Use Map for adjacency list in TypeScript [OK]
      Common Mistakes:
      • Using string type for graph input
      • Returning void instead of list of articulation points
      • Passing graph as a single number
      3. Given the following TypeScript code snippet to find articulation points, what will be the output for the graph edges: [[0,1],[1,2],[2,0],[1,3]]?
      const graph = new Map();
      graph.set(0, [1, 2]);
      graph.set(1, [0, 2, 3]);
      graph.set(2, [0, 1]);
      graph.set(3, [1]);
      
      const articulationPoints = findArticulationPoints(graph);
      console.log(articulationPoints);
      medium
      A. [0, 1]
      B. [3]
      C. [1]
      D. []

      Solution

      1. Step 1: Analyze the graph structure

        The graph has a triangle between 0,1,2 and a leaf node 3 connected to 1.
      2. Step 2: Identify articulation points

        Removing node 1 disconnects node 3 from the rest, so 1 is an articulation point. Nodes 0 and 2 are part of a cycle, so not articulation points. Node 3 is a leaf, not articulation point.
      3. Final Answer:

        [1] -> Option C
      4. Quick Check:

        Only node 1 disconnects graph when removed [OK]
      Hint: Check if removing node splits graph into more parts [OK]
      Common Mistakes:
      • Thinking nodes in cycle are articulation points
      • Including leaf nodes as articulation points
      • Ignoring connectivity after removal
      4. The following TypeScript code attempts to find articulation points but has a bug. What is the bug?
      function dfs(u: number, parent: number) {
        visited[u] = true;
        disc[u] = time;
        low[u] = time;
        time++;
        let children = 0;
        for (const v of graph.get(u) || []) {
          if (!visited[v]) {
            children++;
            dfs(v, u);
            low[u] = Math.min(low[u], low[v]);
            if (parent !== -1 && low[v] >= disc[u]) {
              articulationPoints.add(u);
            }
          } else if (v !== parent) {
            low[u] = Math.min(low[u], disc[v]);
          }
        }
        if (parent === -1 && children > 1) {
          articulationPoints.add(u);
        }
      }
      medium
      A. The 'visited' array is not initialized before DFS
      B. The root node condition for articulation point is checked after the loop
      C. The variable 'time' is not incremented correctly
      D. The condition 'low[v] >= disc[u]' should be 'low[v] > disc[u]'

      Solution

      1. Step 1: Review DFS variables initialization

        The code uses 'visited' array but does not show its initialization before DFS calls.
      2. Step 2: Identify missing initialization impact

        If 'visited' is not initialized to false for all nodes, DFS may skip nodes or behave incorrectly.
      3. Final Answer:

        The 'visited' array is not initialized before DFS -> Option A
      4. Quick Check:

        Uninitialized visited array causes DFS errors [OK]
      Hint: Always initialize visited array before DFS traversal [OK]
      Common Mistakes:
      • Assuming time increments incorrectly
      • Misunderstanding root node articulation condition
      • Changing condition from >= to > incorrectly
      5. You have a network of computers represented as an undirected graph. You want to find all critical computers whose failure would split the network. The graph has 7 nodes with edges: [[0,1],[1,2],[2,0],[1,3],[3,4],[4,5],[5,3],[4,6]]. Which nodes are articulation points?
      hard
      A. [0, 2, 5]
      B. [1, 3, 4]
      C. [3, 5, 6]
      D. [1, 4, 6]

      Solution

      1. Step 1: Analyze graph components and cycles

        Nodes 0,1,2 form a triangle (cycle). Nodes 3,4,5 form another cycle. Node 6 is connected only to 4.
      2. Step 2: Identify articulation points

        Removing 1 disconnects node 3 and its cycle from 0,2. Removing 3 disconnects 4,5,6 from 1. Removing 4 disconnects node 6 from rest. So articulation points are 1, 3, and 4.
      3. Final Answer:

        [1, 3, 4] -> Option B
      4. Quick Check:

        Nodes connecting cycles and leaf nodes are articulation points [OK]
      Hint: Look for nodes connecting cycles or leaf nodes [OK]
      Common Mistakes:
      • Including nodes inside cycles as articulation points
      • Missing nodes connecting leaf nodes
      • Confusing leaf nodes as articulation points
      Recommended

      Ready to prove it?

      Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

      10 questions~5 mineasy hard