Cyclomatic complexity: Difference between revisions

Content deleted Content added
inserted missing volume in the reference
Explanation in terms of algebraic topology: Clarified notation for fundamental group as a free product rather than a direct product. Added stipulation that the control graph be connected in the relevant discussion.
Tags: Mobile edit Mobile web edit
Line 86:
:<math>M = b_1(\tilde G) = \operatorname{rank}H_1(\tilde G).</math>
 
It can also be computed via [[homotopy]]. If one considers thea (connected) control-flow graph as a 1-dimensional [[CW complex]] called <math>X</math>, then the [[fundamental group]] of <math>X</math> will be <math>\pi_1(X) =\cong \Z^{*n}</math>. The value of <math>n+1</math> is the cyclomatic complexity. The fundamental group counts how many loops there are through the graph, up to homotopy, and hence aligns with what we would intuitively expect.
 
This corresponds to the characterization of cyclomatic complexity as "number of loops plus number of components".