I am trying to implement Dijkstra\'s algorithm which can find the shortest path between the start node and the end node. Before reach the end node there are some \'must-pass
Unfortunately this problem is reduced to TSP so dont expect a polynomial solution but if no of intermediate node are small then you can do this reasonably fast like following :-
- try every sequence of nodes to visit possible.
- say you have s->a->b->c->d
- then evaluate min(s,d) + min(d,a) + min(c,d) using dijkstra
- the sequence that has minimum distance is your answer.
Time complexity : O(k!*ElogV)
where k is no of must pass nodes