Algorithms Several well-known algorithms exist for solving this problem and its variants. Dijkstra's algorithm solves the single-source shortest path problem with only non-negative edge weights. Bellman–Ford algorithm solves the single-source problem if edge weights may be negative. A* search algorithm solves for single-pair shortest path using heuristics to try to speed up the search. Floyd–Warshall algorithm solves all pairs shortest paths. Johnson's algorithm solves all pairs shortest paths, and may be faster than Floyd–Warshall on sparse graphs. Viterbi algorithm solves the shortest stochastic path problem with an additional probabilistic weight on each node.
algorithms several well-known algorithms exist for solving this problem and its variants dijkstra's algorithm solves the single-source shortest path problem with only non-negative edge weights bellman–ford algorithm solves the single-source problem if edge weights may be negative a* search algorithm solves for single-pair shortest path using heuristics to try to speed up the search floyd–warshall algorithm solves all pairs shortest paths johnson's algorithm solves all pairs shortest paths and may be faster than floyd–warshall on sparse graphs viterbi algorithm solves the shortest stochastic path problem with an additional probabilistic weight on each node