Parametric shortest path algorithm