Common Problem in Finding Longest or Shortest Path in Non-acyclic Graph

In #finding the shortest path, it is quite easy to get into the so called negative-cost cycles, where one could stay in a loop forever if there is a negative weight edge in the graph.

The opposite is true, as in finding the longest path in a non-acyclic graph could result in positive-cost cycles.

Links to this page
#graph #algorithm