graph - shortest path with dynamic edge cost (algorithm) -
i'm looking algorithm can find shortest path between 2 nodes in undirected graph cost dynamic. dynamic, mean cost on edge dependent on next (future) step. example, in graph that:
i'm looking shortest path "a" "e" cost of "a" "b" depends on next step. if go c 7 , if go d 9.
my question is: there algorithm solves problem?
reduce problem 'regular' shortest path problem
create dummy vertices b1,b2 (instead of b
), , edges:
(a,b1,7), (b1,c,6), (a,b2,9), (b2,d,5)
the rest of edges , vertices remain were.
now, run regular shortest path algorithm (dijkstra / bellman ford) source target.
(repeat process 'conditional' weight edges).
Comments
Post a Comment