CBSE NET JUNE 2013 PAPER II
Cyclomatic complexity of a flow graph G with n vertices and e edges is
A)V(G)=e+n-2
B)V(G)=e-n+2
C)V(G)=e+n+2
D)V(G)=e-n-2
Ans: (B)
Explanation:
To solve above problem, first remember these 3 rules to compute the cyclomatic complexity.
1. The number of regions correspond to the cyclomatic complexity.
2. Cyclomatic complexity V(G) for a flow graph G, is defined as,
V(G)=E-N+2
where E=Number of flow graph edges
N=Number of flow graph nodes
3.Cyclomatic complexity,V(G) for a flow graph G, is defined as,
V(G)=P+1
where P=Number of predicate nodes contained in flow graph G.
Now come to the solution for above problem,
According to rule 2, the formula for Cyclomatic Complexity V(G)=E-N+2 where E is no of edges, N is no of vertices.