How many shortest paths are there between points in a grid with missing points and blocked paths?

1.3k Views Asked by At

there. I encountered a problem finding out the number of shortest paths between points on a grid with missing points or blocked paths, as shown in the following picture (e.g. C and D in question 1 and those in question 2).

I've found the answer to the question about the number of shortest paths on a full gird on StackExchange (Thanks!). But I don't know how to deal with the shortest path issue on grids with missing points and blocked path. How to caculate the shortest paths on "abnormal" grids? Thank you very much for your help! enter image description here

1

There are 1 best solutions below

6
On BEST ANSWER

The algorithm being used in 2B is as follows.

  1. Label the initial point with the number 1.

  2. Consider the points which are just one line away (in a correct direction) from one or more previously labelled points. For each such point, $P$ say, add the labels of the adjacent labelled points and make this total the label for $P$.

  3. Repeat step 2 until you reach the end point.

Check this out with the helpfully completed example 2B from your exercise.