HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Recalculating shortest path after changing the weights

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
afterpaththeshortestweightschangingrecalculating

Problem

I have a weighted, directed graph. I do the following. Given nodes $s$ and $t$ I compute shortest path. Then, I decrease weights of some edges and want to see if there is now another shortest path. Of course, I can recompute shortest path, but I want something faster.

For example, one approach would be to store shortest paths from $s$ to $t$ for every edge in the graph. Then, when I change the weights it takes constant time to check if the shortest path changed (even though, the first step takes much more time). The drawback is that I have to store many paths and to calculate all simple paths in advance, so I'm seeking for alternatives.

So my question is if it's possible to check if the shortest path changed after we decrease edge weights?

Edit: Apparently, this is a problem of dynamic graphs. I didn't delve into the algorithms, so, which algorithm can I use for this problem? I want to improve on running time Dijkstra algorithm.

Solution

The standard term for this kind of problem is "dynamic shortest paths" or "shortest paths in a dynamic graph". Here "dynamic" refers to the fact that the graph might be updated, and you want to update the shortest-paths information (hopefully more efficiently than re-computing it from scratch). There are many kinds of updates to the graph one can consider: deleting a vertex, inserting a vertex, deleting an edge, inserting an edge, increasing the length of an edge, decreasing the length of an edge. Your problem is the special case where we only have to deal with decreases to edge weights.

So, I suggest you search the research literature (e.g., using Google Scholar). You should find a bunch of papers that discuss algorithms for this situation.

Context

StackExchange Computer Science Q#48729, answer score: 2

Revisions (0)

No revisions yet.