Limited shortest path algorithm branch and bound solution c++ implementation