Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional

A directed graph has the vertices D, E, H, I, K, N, O and the arcs N→E, N→D, K→N, K→O, E→O, I→N, I→E, H→K, O→N. How many strongly connected components does it have (maximal sets in which every vertex can reach every other)?

  1. A. 1
  2. B. 6
  3. C. 5
  4. D. 2

Correct answer: C. 5

Mutual reachability splits the vertices into 5 classes, each a strongly connected component (single vertices count too). Weakly connected components give 1, and counting only components with at least two vertices gives 1.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic