我应该使用什么算法来解决 "shortest path problem"?

What algorithm for solving the "shortest path problem" should i use?

所以,我一直在研究解决 ICPC 2014(第 7 页)的 Game Strategy 问题。

这包括一个有 n 个盒子的棋盘游戏,每个盒子都有一组独特的路径,可以通往棋盘上的另一个盒子(可以有一条通往它自己的路径)。我认为图表可以很好地表示游戏,更具体地说是 有向图

graphic case representation whit n = 2

我找到了 2 种可能的算法来解决问题:

1.- A YouTube video 说我应该使用广度优先搜索

2.- Blog commenting the solution of some of the problems of that ICPC year. The author says that DP (dynamic programming) can be used. In Wikipedia's page 解释了一种称为 Dijkstra 算法 的算法,如页面所述,该算法用于 "the shortest path problem"。

这些算法中的一种是解决问题的更好方法吗?其中之一是否有更好的性能或类似的东西?

当图的边缘没有权重(如您的情况)和 Dijkstra 的 算法时,您使用广度优先搜索(不久 BFS)对于加权图。

附带说明一下,请记住,当您的边具有负值时,Dijkstra 不起作用。

考虑到复杂性,您可能对这个问题感兴趣:Why use Dijkstra's Algorithm if Breadth First Search (BFS) can do the same thing faster?