I read about Graph algorithms and I came across these two algorithms.
I searched a lot about this, but did not get a satisfactory answer!
I have doubts, what is the difference between Dijkstra's algorithm and BFS when finding the shortest path?
when using BFS to find the shortest path in a graph, what we do is
We find all connected vertices, add them to the queue and maintain the distance from the source to this vertex. Now, if we find a path from the source to this peak with an even smaller distance, then we will update it!
This is the same thing that we do in Dijkstra's algorithm! then what is the difference between dijkstra and bfs? And then why are the time complexity of these algorithms different from each other?
If anyone can explain this with pseudo code, then I will be very grateful!
I know something is missing! Please help!
algorithm graph
harrythomas Aug 22 '14 at 2:46 a.m. 2014-08-22 14:46
source share