I am looking for an algorithm to find the path between two nodes with a minimum cost and a maximum length, given the maximum cost in a non-oriented weighted full graph. Weights are not negative.
I am currently using DFS and it is rather slow (lots of nodes and maximum length too). I already discard all impossible nodes in each DFS iteration.
Can someone point me to a well-known algorithm to better handle this problem?
To clarify: ideally, the algorithm should look for a path to the minimum cost, but it is allowed to add value if it means visiting more nodes. This should end when he concludes that it is impossible to reach more than n nodes without crossing the cost constraint, and it is impossible to reach n nodes with less cost.
Update
Graph example. We need to go from A to B. To limit costs, the value is set to 5:
This path is (red) approved, but the algorithm should continue to search for better solutions

This is better because although the cost is increased to 4, it contains 1 more node

Here the path contains 3 nodes, so it is much better than before, and the cost is acceptable 5

Finally, this solution is even better, because the path also contains 3 nodes, but with a cost of 4, with less than before.

Images of hope better explain text
algorithm graph
Inuart
source share