
SOF TWARE MEASUREMENT AND METRICS 159
3. Cyclomatic complexity, V (G) for a flowgraph G, is also defined as
V (G) = P + 1,
where
P = Number of predicate nodes contained in flow graphs G.
The cyclomatic complexity of Figure 6.2 (b) can be computed using each of
the algorithms just noted.
The flowgraph has four regions:
V(G) = 11 edges 9 nodes + 2 = 4
V(G) = 3 predicate nodes + 1 = 4.
Therefore, the cyclomatic complexity of the flowgraph shown is 4. The value
V (G) provides us with an upper bound for the number of independent
paths that comprise the basis set, and by implication, an upper bound
on the number of tests ...