Cyclomatic Complexity Calculator

Calculate McCabe cyclomatic complexity from control flow graph counts or binary decisions in one routine.

Result
—

How to calculate

For a control flow graph, subtract its nodes from its edges and add twice its connected components. For a single connected routine with binary decisions, add one to the decision count.

Worked example

Use Given Control flow graph counts · Edges 9 · Nodes 8 · Connected components 1. The result is 3.

Input and result notes

Enter numbers using the same units. Rounded results are marked with ≈.

McCabe’s original complexity measure paper

Related calculators