Data Structures & AlgorithmsVery hardProduct-company placement

A directed graph on A–H has edges A→B, A→C, A→G, B→E, E→G, F→A, F→B, F→C, F→E, H→B, H→D. 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. 8 SCCs, 7 edges
  2. B. 8 SCCs, 3 edges
  3. C. 7 SCCs, 3 edges
  4. D. 8 SCCs, 2 edges

Correct answer: B. 8 SCCs, 3 edges

The SCCs are A | B | C | D | E | F | G | 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