What is difference between BFS and Dijkstra's algorithms when looking for shortest path?

Breadth-first search is just Dijkstra's algorithm with all edge weights equal to 1.

Dijkstra's algorithm is conceptually breadth-first search that respects edge costs.

The process for exploring the graph is structurally the same in both cases.


Blockquote while using BFS for finding shortest path in a graph what we do is We discover all the connected vertices, add them in the queue and also maintain the distance from source to that vertex. Now if we find a path from source to that vertex with still less distance then we update it!

We do not maintain a distance in BFS. It is for discovery of nodes. So we put them in a general queue and pop them. unlike in Dijikstra where we put accumulative weight of node (after relaxation) in a priority queue and pop the min distance.

So BFS would work like dijikstra in equal weight graph because.

complexity varies because of the use of simple queue and priority queue.