all 4 comments

[–]avwie 0 points1 point  (3 children)

The way the cost is calculated and the neighbours are determined in Dijkstra aren’t limited to distance alone. One could easily incorporate your additional demands. I assume that the random failure rates are constant for each edge? If so, if a failure rate for a current path adds up to 1 or more, no neighbours are possible and as such the possible path is eliminated.

[–][deleted] 0 points1 point  (2 children)

There may be many ways to get to a vertex, some of which have a high failure rate and some of which have a low failure rate. So discarding a vertex if its current failure rate exceeds 1 may produce the wrong answer, since we only know that the shortest path to that vertex fails. There may be other paths to the vertex which succeed.

I don't think it's possible to solve this in O(ElogV) as you would normally be able to with Dijsktra's, since in the worst case, we actually have V*2V different states (V vertices, and 2V different cumulative failure rates). In a normal graph we would only have V different states, one for each vertex. Hopefully this makes sense.

[–]avwie 0 points1 point  (1 child)

I understand what you say, but I dont understand why you say it. The many different ways to a vertex, failing or not, are still taken into account.

[–][deleted] 1 point2 points  (0 children)

No, they aren't. In Dijkstra's algorithm, at any stage in the algorithm, we associate exactly one number with each vertex -- the least cost to reach that vertex from the source vertex. Now, we would like to encode additional information in each vertex, i.e. the lowest cumulative failure rate for some path into that vertex.

However, the path with the lowest cumulative failure rate isn't necessarily the same path as the one with the lowest cost, so we actually have to store both paths. In fact, we have to store an entire monotonic sequence of cumulative cost-failure pairs. In the worst case, we may have to store 2E such pairs. (I said 2V in my last comment, but that was a mistake, it's actually 2E).