Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am trying to understand the formula, but I am a bit in doubt how exactly you define edges and nodes.

Edges seem to be every possible exit from a statement and nodes seem to be statements, is this definition wrong?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Think of nodes as statement blocks that do not have control flow statements and edges as individual paths that lead to other statement blocks because of control flow statements.

For example:

print "A"
if(dayOfWeek = DayOfWeek.Monday)
  print "B"
print "C"

Would have three nodes, print "A", print "B" and print "C" And three edges A to B, B to C and A to C.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.