Cyclomatic Complexity Cyclomatic complexity is a source code complexity measurement that is being correlated to a number of coding errors. It is calculated by developing a Control Flow Graph of the code that measures the number of linearly-independent paths through a program module. The following steps should be followed for computing Cyclomatic complexity. Step 1 - Construction of graph with nodes and edges from the code Step 2 - Cyclomatic Complexity Calculation using formula V(G) = E - N + 2 Step 3 - Identification of independent paths Example Sum = 0; i = 1; While (i<=n){ sum += i; ++I; } Printf(“%d”,sum) If(sum>0){ printf(“Positive”); } Step 1 - Construction of graph with nodes and edges from the code Step 2 - Cyclomatic Complexity Calculation using formula V(G) = E - N + 2 Number of Node in given flow graphs is 10 Number of Edges in given flow graphs is 11 Number of nodes that have exit Points is 1. So, Cyclomatic complexity = E - N + 2*P = 11 – 10+ 2(1) = 3 Step 3 - Identification of independent paths Path 1: 1 - 2 - 3 – 7 – 8 – 10 Path 2: 1 - 2 - 3 – 7 – 8 – 9 - 10 Path 3: 1 - 2 - 3 – 4 – 5 - 6 – 7 - 8 - 10