I am trying to find an efficient algorithm for the following problem:
Input:
- weighted directed graph G=(V, E) in which all edges are weigthed either 1 or 2
- s,t ∈ V
- n ∈ N
Output
- shortest path from s to t that contains exactly n edges of weight 2
I have been experimenting with different modifications of Bellman-Ford, Dijkstra and even max-flow with no luck.
Is there an efficient algorithm for solving this?