Download presentation

Presentation is loading. Please wait.

Published byPiper Stowe Modified over 3 years ago

1
CYCLOMATIC COMPLEXITY 1

2
Invented by Thomas McCabe (1974) to measure the complexity of a program ’ s conditional logic Cyclomatic complexity of graph G equals #edges - #nodes + 2 V(G) = e – n + 2 Also corresponds to the number of linearly independent paths in a program 2

3
CONVERTING CODE TO GRAPH 3 if expression1 then statement2 else statement3 end if statement4 switch expr1 case 1: statement2 case 2: statm3 case 3: statm4 end switch statm5 (a) (b) do statement1 while expr2 end do statement3 (c) CODEFLOWCHARTGRAPH TF expr1 ? statm4 statm2statm3 2 13 expr1 ? statm5 statm3 statm2statm4 n1 n2n3 n4 n1 n2n4 n5 n3 T F expr2 ? statm3 statm1 n1 n2 n3

4
EXAMPLE PATHS 4 if expression1 then statement2 end if do statement3 while expr4 end do if expression5 then statement6 end if statement7 n1 n3 n2 n4 n5 n7 n6 e1 e2 e3 e4 e5 e6 e7 e8 e9 Paths: P1 = e1, e2, e4, e6, e7, e8 P2 = e1, e2, e4, e5, e4, e6, e7, e8 P3 = e3, e4, e6, e7, e8, e10 P4 = e6, e7, e8, e10, e3, e4 P5 = e1, e2, e4, e6, e9, e10 P6 = e4, e5 P7 = e3, e4, e6, e9, e10 P8 = e1, e2, e4, e5, e4, e6, e9, e10 V(G) = e – n + 2 = 9 – 7 + 2 = 4

5
EXAMPLE 1 5

6
6 V=e-n+2=11-9+2=4

7
7

8
8

Similar presentations

OK

Software Test Metrics When you can measure what you are speaking about and express it in numbers, you know something about it; but when you cannot measure,

Software Test Metrics When you can measure what you are speaking about and express it in numbers, you know something about it; but when you cannot measure,

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on advertising techniques Ppt on unity in diversity slogans Ppt on commerce education in india Ppt on law of conservation of mass Ppt on operation research game theory Ppt on ancient indian mathematicians and their contributions Ppt on traction rolling stock manufacturers Download ppt on respiration in animals Ppt on lines in fashion design Download ppt on area of circle