Data Structures & AlgorithmsVery hardGATE CS

A directed graph on A–H has edges B→A, B→C, C→F, C→H, D→C, E→C, E→H, F→G, F→H, G→C, H→A. How many strongly connected components does it have, and what is the minimum number of edges that must be added to make the whole graph strongly connected?

  1. A. 6 SCCs, 5 edges
  2. B. 6 SCCs, 3 edges
  3. C. 5 SCCs, 3 edges
  4. D. 6 SCCs, 2 edges

Correct answer: B. 6 SCCs, 3 edges

The SCCs are A | B | CFG | D | E | H. In the condensation DAG count sources (in-degree 0) and sinks (out-degree 0); the answer is max(sources, sinks) = 3.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic