I have a graph G = (V, E)
where each edge is bidirectional with positive weight. I want to find the shortest path from vertex s
to vertex t
using at least k
edges but less than 20. No vertex may be repeated in a path.
I am aware of this problem: Dijkstra's algorithm to compute shortest paths using k edges?
That problem wants to find the shortest paths using at most k
edges.
My current idea is to create the product graph via V' = V x {0, 1, 2, ..., 20}
and then ignore any shortest paths from (s, 0)
to (t, n)
where n < k
. However, because the product construction essentially duplicates nodes, I am not aware of a way to ignore duplicate vertices in the path-finding algorithm.
P.S. If k
were very large, say, k = |V|
, wouldn't this be the Hamiltonian path problem and therefore NP-complete?