Counting Shortest Paths in a Square Grid

In summary, there is a concise, easily calculable way to count the sum of all paths from the lower left corner of a square of integer size to the upper right corner, including partial paths. This can be done using the formula (m+n) choose n, where m and n represent the coordinates of the upper right corner. For a 10x10 grid, there are 1111111111 paths in the triangle bounded by the line y = x + 10.
  • #1
Bartholomew
527
0
Is there a concise, easily calculable way to count the sum of all the paths from the lower left corner of a square of integer size to the upper right corner where you only move up or right in steps of 1 unit, PLUS all the partial paths? i.e. if you have a city with roads in a 10x10 grid (100 intersections/corners) how many shortest paths are there from one corner of the grid to any other intersection or corner on the grid?
 
Physics news on Phys.org
  • #2
Bartholomew said:
Is there a concise, easily calculable way to count the sum of all the paths from the lower left corner of a square of integer size to the upper right corner where you only move up or right in steps of 1 unit, PLUS all the partial paths? i.e. if you have a city with roads in a 10x10 grid (100 intersections/corners) how many shortest paths are there from one corner of the grid to any other intersection or corner on the grid?

Why stop there? There's an easy solution for any point on a grid like that.


To get to the point m,n from 0,0 there are (m+n) choose n paths.
 
  • #3
I know that. Adding them all up concisely is a harder problem.
 
  • #4
It's easy to sum the paths in the triangle bounded by (and including) the line y = x + 10--that's 2^10 - 1 since each diagonal row of intersections/corners (with negative slope) in that triangle corresponds to a row of Pascal's triangle, so you get 2^0 + 2^1 + ... + 2^9 which is 1111111111 in binary.
 
Last edited:

Related to Counting Shortest Paths in a Square Grid

1. How do you define a shortest path in a square grid?

A shortest path in a square grid is the most direct route from one point to another, measured by the number of steps it takes to reach the destination. In a square grid, this is usually calculated using the Manhattan distance, where the distance between two points is the sum of the absolute differences of their x and y coordinates.

2. What is the algorithm used for counting shortest paths in a square grid?

The most commonly used algorithm for counting shortest paths in a square grid is called Dijkstra's algorithm. This algorithm uses a technique called "greedy search" to find the shortest path from a starting point to all other points in the grid.

3. Can the number of shortest paths in a square grid be greater than 1?

Yes, it is possible for there to be more than one shortest path in a square grid. This can occur when there are multiple paths with the same length, all of which are the shortest possible route between two points. In these cases, all of these paths would be considered the shortest path.

4. How can obstacles be accounted for when counting shortest paths in a square grid?

Obstacles can be accounted for by treating them as "blocked" cells in the grid. This means that the shortest path cannot pass through these cells and the algorithm will have to find an alternative route. Some algorithms, such as A* search, also take into account the presence of obstacles when determining the shortest path.

5. Are there any limitations to counting shortest paths in a square grid?

One limitation to counting shortest paths in a square grid is that it assumes movement can only occur in the four cardinal directions (up, down, left, right). If diagonal movement is allowed, this can significantly increase the number of possible paths and make the calculation more complex. Additionally, the size of the grid and the number of obstacles can also impact the efficiency of the algorithm and make it more difficult to calculate the shortest paths.

Similar threads

Replies
2
Views
1K
  • General Discussion
Replies
1
Views
1K
  • Math Proof Training and Practice
Replies
23
Views
618
Replies
2
Views
2K
  • Electrical Engineering
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Special and General Relativity
Replies
5
Views
985
  • Precalculus Mathematics Homework Help
Replies
5
Views
1K
Replies
2
Views
2K
Back
Top