weight-constraint shortest path BFS problem

116 views Asked by At

I have been asked about a shortest-path problem and was asked to solve it with BFS algorithm.

Given a mountain with v pavilions and e mountain tracks. Each track has a walking time te(time for both directions are the same), and each pavilion is recognized as v1, v2...,vn. One can walk at most w hours and need to take a rest in a pavilion. The resting time is two hours and one can go on climbing after the rest. Find out the shortest climb with shortest time by designing an algorithm of O((v+e)*w2).

I know that we can transform a weighted graph by splitting the nodes in order to apply BFS on it. However, on how to applying the constraint of at most w hours is still a mystery to me. I was wondering if it could solve with BFS. Can someone explain to me? Thank you very much in advance!

0

There are 0 answers