Data Structures & AlgorithmsModerateGATE CS · Product Company SDE

Problem: An undirected connected graph has 9 vertices and 13 edges. What is the cyclomatic number (the number of independent cycles, computed as edges minus vertices plus connected components)?

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

Correct answer: D. 5

For a connected graph, cycle rank equals m − n + 1. Using m − n alone forgets the component term that a connected graph adds back.

More Coding Interview Problems questions

Exams that ask this topic