# Can Inverse of weights(1/weight,not negation) be used to find the longest path between two points by using dijkstra's algorithm?

Considering that there no cycles in the graph.

I have seen the posts where the negation of the weights is suggested and to use Bellman-ford. But I was wondering if the inverse is possible.

• Have you tried working through a few examples by hand? I think you should be able to work out the answer on your own. – D.W. May 2 '17 at 7:52
• Hint: $1/a + 1/b \neq 1/(a+b)$. – Yuval Filmus May 2 '17 at 9:40