1,509 views

2 Answers

Best answer
2 2 votes

Cyclomatic complexity is a source code complexity measurement that is being correlated to a number of coding errors. It is calculated by developing a Control Flow Graph of the code that measures the number of linearly-independent paths through a program module.

Lower the Program's cyclomatic complexity, lower the risk to modify and easier to understand. It can be represented using the below formula:

Cyclomatic complexity = E - N + P 
where,
  E = number of edges in the flow graph.
  N = number of nodes in the flow graph.
  P = number of nodes that have exit points

I advice you to refer the ink mentioned below for a clear understanding of the above concept. It's beautifully explained here. :) 

http://www.tutorialspoint.com/software_testing_dictionary/cyclomatic_complexity.htm

selected by
2 2 votes

McCabe’s cyclomatic complexity metric V(G) = e – n + 2P.

where,
  E = number of edges in the flow graph.
  N = number of nodes in the flow graph.
  P = number of connected components
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.7k
1.7k views
radha gogia asked Jul 21, 2015
1,710 views
int isprime(int n ){for(int i=2;i<=sqrt(n) ; i++){if(n%i==0){not prime}}
0 0 votes
1 answers 1 answer
1.9k
1.9k views
2 2 votes
2 2 answers
1.7k
1.7k views
sh!va asked Jun 24, 2016
1,748 views
What is the cyclomatic complexity of given code fragment?
1 1 vote
2 2 answers
2.7k
2.7k views
shivam sharma 5 asked Aug 28, 2018
2,723 views
int zap(int n){if (n<=1) then zap =1;else zap = zap(n-3)+zap(n-1);}then the call zap(6) gives the values of zapGive the proper explanation