Graph Shortest Paths
Finding the cheapest route with BFS, Dijkstra, and Bellman–Ford
When every edge has the same weight, breadth-first search already finds shortest paths. Dijkstra’s algorithm handles non-negative weights by always settling the closest unsettled node, in time with a heap. Bellman–Ford relaxes every edge times, which takes time but also works with negative weights.