I'm studying for an exam on software testing and in my notes I found this:

Many more paths than branches. A pragmatic compromise will be needed

I cannot understand the difference between paths and branches; each time I work out the paths and branches of a graph I end up with the same number. Thanks!


1 Answer 1


I do not know the exact definitions used by your class, so I am saying this with caution. A branch normally correspnds to a graph edge that allows control to pass from one node to another in the graph. A path is a succession of edges connected to each other, with possible repetition and representing the successive parts traversed by the control. So a branch will be a element of the program structure, a static entity. The path represent a fragment of computation.

If you say more about what you understood, I may be able to tell you whether it makes sense.

  • $\begingroup$ Well from what you're saying I think that a branch is a point in a program where execution can take two or more different paths such as an if-then-else statement, with a path being the flow of execution taken if that particular condition is met. I also have written that a path is "a sequence of branches". $\endgroup$ Jun 3, 2013 at 8:24
  • $\begingroup$ Answer and Comment corrected (I was saying vertex for edge ... sorry) ...Well, I checked a bit, and it seems that some people talk about branch only when the possible flow branches, i.e., can take different edges. Typically this is a conditionnal. Other Use that word also for edges that will just go to another node (corresponding approximately to a goto statement - but that does not seem essential). A path can indeed be defined as a sequence of branches since it defines uniquely a computation fragment, independently of nodes that have several in edges and a single out edge. $\endgroup$
    – babou
    Jun 3, 2013 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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