Software → Software Design
Cyclomatic Complexity
A control-flow metric that estimates the number of linearly independent execution paths through code.
Cyclomatic Complexity
Cyclomatic Complexity estimates the number of independent paths through a function or program from its control-flow graph. Branches such as if, loops, and case alternatives generally increase the score.
Practical use
The metric can highlight code that needs more test cases or simplification. A rising score often signals nested decision logic, but thresholds should be interpreted in context. Splitting a function purely to lower the number can hide complexity rather than remove it.
Testing connection
Independent paths suggest a lower bound on the distinct control-flow cases worth considering. The metric does not account for data combinations, integration behavior, concurrency, or semantic difficulty.