White Box – Cyclomatic complexity

What is the cyclomatic complexity of a program?

Cyclomatic complexity of a program tells us the quantitative measure of the complexity of a program.

cyclomatic complexoty of a graph
Figure: the Cyclomatic complexity of a graph

How to calculate Cyclomatic complexity?

There are three methods;

  1. Count the number of regions on the graph: 4
  2. No of edges – no. of nodes + 2: 11-9+2=4
  3. No. of predicates + 1 : 3+1=4

 Try Automatic Tool to find the pathsClick Here 

What are independent paths?

Independent path is a path that has at least one edge that has not been traversed before in the given graph.


Independent paths are;

1, 9

1, 2, 3, 8, 1, 9

1, 2, 4, 5, 7, 8, 1, 9

1, 2, 4, 6, 7, 8, 1, 9

What is the use of finding graph complexity and finding paths?

It is used in software testing.


Please Share This Article with Friends
Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "T4Tutorials.com". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....