Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.