Dijkstra's SPF Algorithm

Dijkstra's SPF Algorithm

Dijkstra's algorithm finds the shortest path from one node to all other nodes.
  • Single-source - one node is chosen to be the start
  • Does not work on graphs with negative edges
 
notion image

1. Set initial distances for all nodes

Source is 0 all others set to infinity
notion image