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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -