Halstead's Metrics
Halstead's Metrics
while (i<10) {
System.out.printf("i is %d", i);
if (i%2 == 0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
V(G) = 2 enclosed area + 1 = 3
IF A = 10 THEN
IF B > C THEN
A=B
ELSE
A=C
ENDIF
ENDIF
Print A
Print B
Print C
The Cyclomatic
complexity is
calculated using
the above control
flow diagram that
shows seven
nodes(shapes) and
eight edges (lines),
hence the
cyclomatic
complexity is 8 - 7
+2=3