create a GUI tool for Cyclomatic complexity using any language
Cyclomatic Code Complexity was first introduced by Thomas McCabe in 1976. In 1976, Thomas McCabe published a paper arguing that code complexity is defined by its control flow. Since that time, others have identified different ways of measuring complexity.
Calculating Cyclomatic Complexity:
Mathematically, it is a set of independent paths through the graph diagram. The Code complexity of the program can be defined using the formula:
V(G) = E - N + 2
Where,
E - Number of edges
N - Number of Nodes
Where P = Number of predicate nodes (node that contains condition).
Example :
i = 0;
n=4; //N-Number of nodes present in the graph
while (i<n-1) do
j = i + 1;
while (j<n) do
if A[i]<A[j] then
swap(A[i], A[j]);
end do;
i=i+1;
end do;
Flow graph for this program will be:
Computing mathematically:
Comments
Leave a comment