Given a weighted directed acyclic graph, how can I find the cheapest path from an Origin Vertex
to a Destination Vertex
which goes through exactly n
vertices?
Is there an efficient algorithm which accomplishes this? I know that I could use BFS to find all the possible paths between them, then filter that to get only the ones which are n
long, and then sort them by cost. However, I would like to know if there's an algorithm which does not need to consider all possible paths to generate the result.