GATE Computer ScienceHardGATE CS (PYQ pattern)

A directed graph on A–K has edges A→B, B→C, C→A, C→D, D→E, E→F, F→D, G→F, G→H, H→I, I→G, B→H, E→J, K→J, K→A. Let s be its number of strongly connected components and a the minimum number of edges that must be added to make it strongly connected. What is (s, a)?

  1. A. (5, 2)
  2. B. (4, 1)
  3. C. (6, 2)
  4. D. (5, 1)

Correct answer: D. (5, 1)

SCCs: {A,B,C}, {D,E,F}, {G,H,I}, {J}, {K}: s = 5. The condensation has edges K→ABC, ABC→DEF, ABC→GHI, GHI→DEF, DEF→J, K→J, so exactly one source (K) and one sink (J). The minimum number of added edges is max(#sources, #sinks) = 1 (add J→K).

More Algorithms questions

Exams that ask this topic