1

I know,that "normal" Dijkstra's algorithm won't work for graph with negative edge's since once it visits the edge and processes it,it's weight will not be revised.However,I have hard time proving this formally.I don't even know where to start.

Tabris
  • 37
  • 1
  • 5
  • I think the main issue is not negative edges, but negative cycles. If there is a negative cycle in the graph, then there is no "shortest path" since you can get paths with arbitrarily large negative values by going around the negative cycle many times. Of course, if there are no negative edges, then there is no negative cycles; if there are negative edges, then it takes a more careful inspection of the graph to determine whether there are negative cycles or not. – Stef Jun 22 '21 at 08:41
  • Do you need an example of a graph with negative weights, for which Dijkstra's algorithm will work, or do you want to understand why it won't work in a general case? – Anatolii Jun 28 '21 at 18:50
  • @Anatolii Sorry for late response. I know both of those ,was just wondering if there was a formal proof for why it wouldn't work on graph with negative edges in general. – Tabris Jul 01 '21 at 07:46
  • @Tabris you don't need a formal proof for a statement if there exists at least one counter-example to it. – Anatolii Jul 01 '21 at 07:59
  • @Anatolii That's not quite true - you still need to prove that the proposed counter-example is indeed a counter-example. – Stef Jul 01 '21 at 10:01

0 Answers0