ISRO Scientist/Engineer CSE 2023Information Systems and Software Engineering › Software Testing and Complexity Metrics
ISRO Scientist/Engineer CSE 2023 PYQ: McCabe's cyclomatic complexity number of a program control graph 'G' with e edges, $n$ nodes and $p$…
McCabe's cyclomatic complexity number of a program control graph 'G' with e edges, $n$ nodes and $p$ disconnected paths is defined as
- A$\mathrm{n}-\mathrm{e}+2 \mathrm{p}$
- B$\mathrm{e}-\mathrm{n}+2+\mathrm{p}$
- C$e-n+2 p$Correct answer
- D$\mathrm{n}-\mathrm{e}+\mathrm{p}$
Answer
(C) $e-n+2 p$
Approach
Recall the standard definition of McCabe's cyclomatic complexity for a control flow graph with e edges, n nodes, and p connected components (disconnected paths). The formula is V(G) = e - n + 2p.
Reviewed by ISRO IQ Editorial Team.