Cyclomatic Complexity Calculator
Calculate McCabe complexity from control-flow graph counts for one or more separate modules.
Formula
M = E − N + 2P; each of P components has one entry and one exit.
How to use
- Count graph edges E and nodes N.
- Enter the number of separate components P.
- Read the sum of independent path counts.
Examples
- E = 15, N = 14, P = 1 gives M = 3.
Frequently asked questions
What is a component?
A connected module flow graph with one entry and exit; use P = 1 for a single module.
Does the tool inspect source code?
No. Supply graph counts yourself; numerical checks cannot establish graph structure.
Which counts are rejected?
Counts must be integers with P ≥ 1, N ≥ P and E ≥ N − P.
Sources
Updated: