I am at learning stage of cyclomatic complexity(CC). For practise, I am calculating cyclomatic complexity of 2 examples and want to confirm if my answers are correct or not...
Referring to wikipedia, CC is given by M = E − N + 2P
where:
- E = the number of edges of the graph
- N = the number of nodes of the graph
- P = the number of connected components
Please help.
Here, E = 8, N = 9 and P = 1. Hence M = 8 - 9 + (2x1) = 1.
Example 2:
Here E = 11, N = 10 and P = 1. Hence M = 10 - 11 + (2x1) = 1.
Hence for both the examples CC is 1. Please let me know if my calculation is correct or not.