Shortest Path finding with mutating weights in a graph

Shortest Path finding with mutating weights

Dijkstra's algo can be used to find shortest path between 2 nodes in a weighted graph.

How to find shortest paths in a graph with mutating weights ?

Assume there is a formula to find weight of an edge (u, v)

w = f(u, v, t)

where t is the number of units of time.

It takes 1 unit of time to traverse a weight of "1". Assume there is also an edge from every node to itself with a weight "1". (ie For a better result we can wait in a node for many units of time instead of going to another node.)

(For example shortes path between node 0 and 5 can be

0->0->2->2->2->4->5

ie we wait in node 0 for 2 units, in node 2 for 3 units for a better results as weights are mutating over time.)

Assume that the amount of time that it takes to traverse an edge is locked in as soon as we start to traverse it.

(ie if we traverse an edge of weight 5. It takes 5 units of time. By this time, the weights of all edges would have changed including this edge as per above formula. But for traversing this edge we can assume the weight of this edge is locked to 5).

Does anyone know whether an algorithm exists for this ?

[1246 byte] By [ratheeshpai] at [2007-9-30 21:14:07]
# 1
> Does anyone know whether an algorithm exists for this> ?Trying all acyclic paths is one, so there is an algorithm.Sylvia.
sylviae at 2007-7-7 2:46:47 > top of Java-index,Other Topics,Algorithms...
# 2

> > Does anyone know whether an algorithm exists for

> this

> > ?

>

> Trying all acyclic paths is one, so there is an

> algorithm.

>

> Sylvia.

>

Um, including all combinations of waiting time, using a branch and bound approach.

Sylvia.

sylviae at 2007-7-7 2:46:47 > top of Java-index,Other Topics,Algorithms...
# 3

If your graph is G(V, E), and you're trying to get to vertex v_end, then create a new graph G'(V', E') whereV' = (V x N) U {v_end'}

(v_end' is a new object)

E' = {((u, t), (v, t + f(u, v, t))) : (u, v) in E, t in N} U

{((u, t), (u, t + 1)) : u in V, t in N} U

{((v_end, t), v_end') : t in N}

G' is infinite, so you'll need to use a lazy graph structure. Then just use Dijkstra from (v_start, 0) to v_end'.

YATArchivist at 2007-7-7 2:46:47 > top of Java-index,Other Topics,Algorithms...
# 4
This was one of the practise problems on the TopCoder competition. Maybe someone created a page along with the solution. I think the common approach was to use the Floyd-Warshall algorithm for its simplicity.
rkippen at 2007-7-7 2:46:47 > top of Java-index,Other Topics,Algorithms...