longest path Algorithm

In contrast to the shortest path problem, which can be solved in polynomial time in graphs without negative-weight cycles, the longest path problem is NP-hard and the decision version of the problem, which asks whether a path exists of at least some given length, is NP-complete. In graph theory and theoretical computer science, the longest path problem is the problem of finding a simple path of maximal length in a given graph.

longest path source code, pseudocode and analysis