# Cyclomatic complexity - understanding the paths issue

Also I know that cyclomatic complexity determines the number of linearly independent paths through the source code. An independent path=a path that executes at least one statement that the other paths do not execute.
But here comes the issue. Imagine a simple program with 2 IFs. Cyclomatic complexity is 3 (based on the formula). That would work if I start like this:
FALSE, FALSE; TRUE, FALSE; FALSE, TRUE; //Ok, 3 independent paths.
FALSE, FALSE; TRUE, TRUE; these 2 paths cover everything, there cannot be another independent path because all statements are already covered. But this cannot be correct as it should be 3, I just do not understand where is my mistake. I am not very good at math so please try to explain with bearing that in mind :)

-

Here is a short explanation which some may argue is not entirely correct but illustrates the point well.

There may be situations where your two paths cover everything but there are other situations where they do not. Take your example:

IF (A1) THEN (T1) ELSE (F1);
IF (A2) THEN (T2) ELSE (F2);


Now imagine a situation where T1 and T2 are not independent and that in order to run T2 always needs T1 to run before it otherwise it fails.

Imagine the coder made a bug in A2 and now it is completely independent from A1. If you only test the paths T1T2 and F1F2 you will never find this bug because it only occurs in the sequence T2F1 or T1F2.

-