Data Structures & AlgorithmsHardCodeforces Div 2 · ICPC regional

Directed graph on vertices A, B, C, D, E, F, G with edges F→B, E→B, G→E, C→G, E→D, F→D, F→C, F→E, G→F, C→B, G→A. How many strongly connected components does it have? Count each vertex's component, including single vertices that have no cycle through them.

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

Correct answer: C. 5

Mutual-reachability classes give 5 strongly connected components; weakly connected components ignore direction and give 1.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic