A structural approach to measure software complexities is proposed on the basis of the Control Flow Graphs (CFG) of a given software system known as the McCabe cyclomatic complexity [McCabe, 1976].
a) The McCabe cyclomatic complexity of a software system S, Cm(S), is determined by the number of regions contained in a corresponding connected CFG (Gcf), r(Gcf), i.e.:
Cm(S) = r(Gcf) = e - n + 2
where e is the number of edges in Gcf representing branches and cycles, and n the number of nodes in Gcf.
b) Euler’s theorem states that, for any connected planar graph G, the following relations holds:
n – e + r = 2
where n is the number of nodes, e the number of edges, and r the number of regions.
What may be observed when comparing the above ideas?