Can I use Dijkstra's shortest path algorithm in my graph? -
i have directed graph has non-negative edges except edge(s) leave source (s). there no edges other vertices source. find shortest distance source (s) vertex (t) in graph, can use dijkstra's shortest path algorithm though edges leaving source negative?
assuming source-adjecent edges can have negative weights , there no path source of source-adjecent nodes (as mentioned in comment), can add constant c onto edges leaving source make them non-negative. subtract c final result.
on more general note, dijkstra can used solve shortest-path in graph negative edge weights (but no negative cycles) after applying johnson's reweighting algorithm (which bellman-ford, needs performed once).
Comments
Post a Comment