2,494 views
0 votes
0 votes

I have few doubts related to Longest distance problem.  From Wikipedia -->

The NP-hardness of the unweighted longest path problem can be shown using a reduction from the Hamiltonian path problem: a graph G has a Hamiltonian path if and only if its longest path has length n − 1, where n is the number of vertices in G. Because the Hamiltonian path problem is NP-complete, this reduction shows that the decision version of the longest path problem is also NP-complete. In this decision problem, the input is a graph G and a number k; the desired output is "yes" if G contains a path of k or more edges, and no otherwise.[1]

If the longest path problem could be solved in polynomial time, it could be used to solve this decision problem, by finding a longest path and then comparing its length to the number k. Therefore, the longest path problem is NP-hard. It is not NP-complete, because it is not a decision problem.[2]

In weighted complete graphs with non-negative edge weights, the weighted longest path problem is the same as the Travelling salesman path problem, because the longest path always includes all vertices.[3] 

However, it has a linear time solution for directed acyclic graphs, which has important applications in finding the critical path in scheduling problems.

Means in some special cases Longest path problem comes under P-class. 

So my doubts are -->

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
2
Akriti sood asked Dec 26, 2016
1,215 views
how can we find longest path between any pair of vertices in a garph??
0 votes
0 votes
0 answers
4
srestha asked Aug 26, 2018
698 views
What are the asymptotic running times for INSERT, EXTRACT-MIN, and DECREASE-KEY of Floyd Warshall and Bellman Ford Algorithm?