implement k shortest paths