fix k-shortest paths algorithm