

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


tarting point for the Tutorial: Is the construction of the Flow Graph: Step ๏ฟฝ 1: Start writing the procedure. proc roots (1) int a, b, c; (2) D = b * b - 4 * a * c; (3) if (D < 0) (4) real = -b/2 * a ; // imaginary roots D = - D; num = pow ((double) D, (double) 0.5); image = num/(2 * a); (5) else if (D = = 0) (6) root 1 = -b/(2 * a) root 2 = root 1; (7) else if (D > 0) (8) root 1 = (-b + sqrt (d)/2 * a; root 2 = (-b - sgrt(d)/2 * a; (9) end
Step ๏ฟฝ 2: Draw the following Flow Graph Step ๏ฟฝ 3: Calculation of Cyclomatic Complexity V(G) by three methods Method ๏ฟฝ 1: V(G) = e ๏ฟฝ n + 2 ( Where ๏ฟฝe๏ฟฝ are edges & ๏ฟฝn๏ฟฝ are nodes) V(G) = 11๏ฟฝ 9 + 2 = 2 + 2 = 4 Method ๏ฟฝ 2: V(G) = P + 1 (Where P ๏ฟฝ No. of predicate nodes with out degree = 2) V(G) = 3 + 1 = 4 (Nodes 3, 5 & 7 are predicate nodes with 2 outgoing edges) Method ๏ฟฝ 3: V(G) = Number of enclosed regions + 1 = 3+1= ( Here R1, R2 & R3 are the enclosed regions and 1 corresponds to one outer region)