What is cyclomatic complexity?

Answer Posted / vidya

Cyclomatic complexity is a software metric (measurement).
It was developed by Thomas McCabe and is used to measure
the complexity of a program. It directly measures the
number of linearly independent paths through a program's
source code. It is computed using a graph that describes
the control flow of the program. The nodes of the graph
correspond to the commands of a program. A directed edge
connects two nodes if the second command might be executed
immediately after the first command.


Definition

M = E − N + 2P

where

M = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components.

"M" is alternatively defined to be one larger than the
number of decision points (if/case-statements, while-
statements, etc) in a module (function, procedure, chart
node, etc.), or more generally a system.

Separate subroutines are treated as being independent,
disconnected components of the program's control flow graph.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why you choose automated testing over manual testing?

632


What are the benefits of automated testing?

601


How does the Internal QA Audit relates with the ISO Standards level ?

1737


What is binary portability testing?

598


Enlist the priority of the testing tasks defined by the qa team in product development.

774






What is the difference between the qa and software testing?

619


How you will begin to improve the QA process?

2762


What is mr and what information does mr consists of?

613


What is the difference between quality assurance and software testing?

616


Mention what are the test artifacts involved in qa?

692


What is the difference between preventative and reactive approaches in testing?

644


Define use case testing.

628


Do you think qa's can also participate to resolve production issues?

716


What is code inspection?

576


Q. How do you select product components for validation?What are the contents of QMS?

1531