5. Breadth first search and Dijkstra algorithm

5. Breadth first search and Dijkstra algorithm

Breadth first search

Definition: The distance between two nodes is the length of the shortest path between them

Dijkstra algorithm

Breadth-first search finds shortest paths in any graph whose edges have unit length

another implementation: