Given a directed and weighted graph without negative edges in it with n nodes, a source and a destination, what is the shortest path from source to the destination when we are allowed to visit at most k nodes?
Can someone suggest better ways I can use to solve this problem?
my accepted solution to the problem
Thanks in advance!!
I think if k is small you can do Bellman Ford alghoritm except you do first loop k-1 times (n-1 in original)
It would be nice if you could give us a link to the problem.
updated
Do what Wgmlgz said, run K+1 iterations of Bellman-Ford