I have asked this question in StackOverflow. I was asked to move in here. so here it is:
I need some clarifications and inputs regarding Dijkstra's algorithmDijkstra's algorithm vs breadth first searchbreadth first search in directed graphs, if these are correct.
Dijkstra's Dijkstra's algorithm finds the shortest path from Node A to Node F in a weightedweighted graph regardless of if there is a cycle or not (as long as there are no negative weights)
but for that, All paths from A to all other Nodes in the graph are calculated and we grab the path from A to all other Nodes in the graph are calculated and we grab the path from toAF to by reversing the sequences of nodes inFprev` by reversing the sequences of nodes in prev.
BFS: finds the shortest path from node Node A to node Node F in a non-weighted graph, but if fails if a cycle detected.
however, BFSBFS just calculates the path from Node A to Node F and not necessarily all path from Node A. if Node F is reached early, it just returns the path.
