Implemented bidirectional Dijkstra.