I have a directed graph with two weights between vertices, time and cost. The goal is to minimize time while keeping the cost under a maximum value given by the user. I was told to modify the Bellman-Ford algorithm by maintaining an ordered list based on cost instead of a single distance for each vertex of the graph. I am able to correctly implement the Bellman-Ford algorithm when only considering time as a factor, however what modifications to the algorithm do I need to keep cost under a maximum value as well?

0 Answers