what is cyclomatic complexity? plz explain with example
Answer Posted / dheemanth kumar
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.
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.
[edit] Alternative definition
v(G) = e − n + p
G is a program's flowgraph
e is the number of edges (arcs) in the flowgraph
n is the number of nodes in the flowgraph
p is the number of connected components
[edit] Alternative way
There is another simple way to determine the cyclomatic
number. This is done by counting the number of closed loops
in the flow graph, and incrementing the number by one.
i.e.
M = Number of closed loops + 1
where
M = Cyclomatic number.
| Is This Answer Correct ? | 19 Yes | 16 No |
Post New Answer View All Answers
What is the difference between code walkthrough and code review? What is the difference between walkthrough and inspection?
how deployment phase of SDLC differs in product based and in service based company ?
. Is any graph is used for code coverage analysis?
Write the 10 high test cases for making video call/face time?? Write the test cases for credit card accessing the money transfer?? Write the test cases for file transfer from one user to other from Google Drive/drop box?
What is an error?
How can you use technology to solve problem?
what are the tests u did in entire project? when it did in the project? (means at the release build to end of project) plz explain clearly
How to do manual testing of a E-insurance project (end to end process)
What are the challenges you faced in your project (Testing) and in your company?
What is Application Performance testing and Operational performance testing
What is the difference between system testing and integration testing?
What is unit level testing?
Difference between Stakeholder and Relevant Stakeholder?
test cases on bangles???
What is the difference between Functional testing and Unit Functionality testing?