Let G = (V,E) be a directed graph with no positive length cycles. Modifying Dijkstra algorithm as follow, with s the source:
Initialize
d(s) = 0,d(v) = int_minfor allv in V \ {s}.In each iteration, choose a node
uwith maximumd(u).Redefine the tentative distance as: if
d(v) < d(u) + c(uv)thend(v) := d(u) + c(uv).
Is this a correct algorithm to find the length of the longest path in G starting from s ? If not, give a counter example. I have seen a similar answer to this question such as this one graph - Dijkstra for The Single-Source Longest Path but there is no appropriate counter example provided that contradicts the algorithm. Since most of the answers from other (somewhat) similar questions is the algorithm is incorrect, I am inclined to think the same but could not find a counter example.
