Reputation: 49
McCabe's cyclomatic complexity measure is computed as follows:
V = e - n + 2
where e = number of edges; n = number of nodes
Why 2 is added to (e-n) in order to obtain the result?
Upvotes: 0
Views: 226
Reputation: 1441
It seems to be similar to Euler's formula for planar graphs, and since I'm no fan of McCabe, I suppose they use it to seem more science-y.
I say similar because I don't see how, in the question, if 'n' is the number of nodes, why that would be different from the number of vertices.
Upvotes: 1