寻找最短路径最短、路径

2023-09-11 02:48:02 作者:有梦就别怕痛

有一个 M *ñ网​​格,这是填充黑色和白色。给出的开始点和结束点。只有白点可以通过,如何找到起点和终点之间的最短路径?

There’s a M*N grid, which was filled by black and white color. Given the start point and end point. Only white points could be passed, how to find the shortest path between start and end?

有什么想法会深深AP preciated。

Any thoughts will be deeply appreciated.

推荐答案

有多种算法,对于这个问题,但一些重要的算法是:

There are multiple algorithm for that matter, but some of the important algorithms are :

Dijkstra算法

贝尔曼福特

弗洛伊德沃肖尔

Floyd Warshall

即使 BFS算法可能的选择。