in short: dijkstra is like BFS, but instead of a queue, we use a priority queue to always expand the node with the smallest current distance.