Data Structures & AlgorithmsVery hardProduct-company placement

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

Correct answer: C. 8 SCCs, 2 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) = 2.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic