Machine-translated by Google. Questions are authored in English.
Top

Discussion

Cyclometric 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\)

Answer: B

The cyclomatic complexity of a flow graph G with e edges and n vertices is V(G) = e - n + 2, option (B). It equals the number of linearly independent paths through the program and is the minimum number of test cases needed to cover every independent path. For example, a single decision gives a graph with 4 nodes and 4 edges, so 4 - 4 + 2 = 2 paths. The general formula for a graph with p connected components is e - n + 2p, and a single procedure has p = 1. The forms e+n-2, e+n+2 and e-n-2 give wrong values, for instance e+n-2 would give 6 for the one decision graph, which is more than its 2 paths.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.