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.
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
Yes, this works for undirected acyclic graphs. Such a graph is a forest so there is exactly one path between two vertices in the same component. Since there is exactly one path, the shortest path is also the longest path, regardless of what weights you use.
For directed acyclic graphs, it fails for the reason that Eugene points out.