Groups
Category
Level
BellmanโFord finds single-source shortest paths even when some edge weights are negative.
Dijkstraโs algorithm can be adapted to track the second shortest path by keeping the best and second-best distances per vertex.