I have recently started practicing graph theory problems. I recently encountered this problem : BANKROB
Even after having gone through the problem statement several times, I am unable to understand how the given output for the sample cases has been computed. I will be grateful to you, if you can please explain the sample test cases.
To understand the solutions, it helps to visualize the data that's depicted. (Of course, you'll have the computer program do this entirely differently.) Based on the input, the roads basically look like this:
To cut off all paths from 1-10, just remove the choke points at 5 and 6.
However, to cut off from 5-10 (assuming all the roads are bidirectional), you can't just remove 7 and 8 - the robbers can backtrack from 5-3-6-9-10. So you have to cut off 7, 8 and 9.
Thus, for the first example, there are 2 places to cut off, but in the second, there are 3.