Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to work out the cyclomatic complexity of a method.

The bit I am stuck on is the first bit which is constructing a flow graph.

Now say if you have 5 variables, and a couple of operations (i.e. me = i;) then do you put node for each of these variables and operations, or could you count them all as one node, and then only create a new node when you come to an if or loop statement?

i.e.

1 = variable 1
|
2 = variable 2
|
3 = variable 3
|
4 = variable 4
|
5 = variable 5
|
6 = Operation 1
|
7 = Start of an if statement
\
8

Thanks
Posted

1 solution

To save me a LOT of typing, why not start here[^]. Hint: straight-line code doesn't count - it's only loops and branches that matter.
 
Share this answer
 
Comments
Willtwinny 6-May-11 3:42am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900