I had a problem finding the fastest path that does not exceed a given cost.
Let's say I have the indicated maximum cost and 4 entries.
// specified cost 10 // end point 5 //(start point) (finish point) (time) (cost) 2 5 50 5 3 5 20 9 1 2 30 5 1 3 30 7
I have to decide whether it is possible to get from point (1) to (5) (it is impossible when there is no path that is <= what we have, or when there is no connection between 1-5) and if so, what will be the most quick way to get there.
The output for such data will be:
80 // fastest time 3 1 // number of points that (1 -> 2) -> (2 -> 5)
Keep in mind that if there is a record that you can move 1-> 2
1 2 30 5
This does not allow you to move 2 <-1 .
source share