Solution:Cyclomatic complexity of a flow graph is the quantitative measure of the number of linearly independent paths in it.
for calculation of cyclomatic complexity, it is necessary to understand some parameters.
1-Region- In out case, there are 4 regions.
2-Edges- In out case, there are 9 nodes.
3-Nodes- In our case, there is 1 connected component.
5-Predicates- These are nodes that contain condition in our case, there are 3 predicates namely node 1, 2, 3, 6.
Formula- There are three ways of calculating the cyclamate complexity m,
1- m = number of regions
2- m = E - N + 2P
where
E - Number of Edges
N - Number of Nodes
P - Number of connected component
m = P + 1
3- where, P = number of predicate nodes
Calculation-
using formula 1, m = 4
using formula 2, m = 11–9+2(1) = 4
using formula 3, m = 3+1 = 4