# Is the "Bidirectional Dijkstra" algorithm optimal?

In some sites they say the bidirectional Dijkstra's algorithm is optimal, e.g., this, and this. Also there is some software that uses this algorithm (for example this DBMS). But some posts express doubts about the optimality of this algorithm, such this, and this. Which one is correct? Is the bidirectional Dijkstra's algorithm optimal or not?

• A question to ask yourself: optimal in which sense? Commented Mar 3, 2016 at 17:43
• @Raphael Optimal when it outputs the shortest path not generate near-optimal solution in some cases. in my comment to Mr. "Yuval Filmus" answer, I mentioned an example. Commented Mar 3, 2016 at 17:48

• Thanks. Consider this simple graph (with nodes A,B,C,D,E). The edges of this graph and their weights are: "A->B:1","A->C:6","A->D:4","A->E:10","D->C:3","C->E:1". when I use Dijkstra algorithm for this graph in both sides: in forward it finds B after A and then D, in backward it finds C after E and then D. in this point, both sets have same vertex and an intersection. Does this is the termination point or It must be continued? because this answer (A->D->C->E) is incorrect. How can I find the termination of algorithm? Commented Mar 3, 2016 at 17:15