Jump to content

Talk:Longest path problem

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Highest-weight tour

[edit]

Please can someone add some discussion of the node equivalent of this edge path problem, or the highest-weight subpath problem, where one has to find the highest weight subpath (i.e. given node weights, not edge weights) of given length? Obviously if the subpath is a tour then it has fixed constant weight, since all nodes are visited. But if one needs a subpath of maximum weight, do you have to simply do a brute-force search? It seems that dynamic programming can't solve this problem, because optimal subproblems depend upon the path used to get to the subproblem (because nodes can't be traversed twice), so subproblems can't be reused between different paths used to reach the subproblem. —Preceding unsigned comment added by 128.30.48.28 (talk) 21:44, 2 November 2010 (UTC)[reply]

Does k=|V|?

[edit]

The page states "...we use the algorithm for the longest path problem on the same input graph and set k=|V|, the number of vertices in the graph." Yet the definition of Hamiltonian Path states that each vertex is visited once. In a simple example 2 vertices only produce 1 edge. K should equal |V| - 1 unless the original author meant Hamiltonian "Cycle" in which the path returns to the start. But this would contradict the definition of Longest Path I believe. —Preceding unsigned comment added by 71.10.229.128 (talk) 03:57, 15 December 2010 (UTC)[reply]

I think you are right. In all cases in the NP-C section, when |V| is used to describe the length of the HC, |V| - 1 should be used. I will make the edits. Dfarrell07 (talk) 04:37, 17 October 2011 (UTC)[reply]

number of k-length paths through matrix multiplication

[edit]

Similar to the concern below, I doubt if the generic decision problem is NP-complete. There is a popular method where the adjacency matrix A is repeatedly multiplied. The entry [i, j] in the k-th power of A gives the number of k-length paths from Vi to Vj. It would appear this computation is O(n^3 * logk). — Preceding unsigned comment added by Japjapjap (talkcontribs) 02:38, 21 October 2011 (UTC)[reply]

It gives you the number of length-k walks, not simple paths. Anyway, if you want to show hardness for values of k less than n, just add some isolated vertices to a hard instance of Hamiltonian path. —David Eppstein (talk) 03:38, 21 October 2011 (UTC)[reply]

Is generic problem also NP-complete?

[edit]

I understand that decision problem with k=|V| is equivalent to Hamilton cycle which is NP-complete.

But what if we ask for k < |V|, or something else in weighted graph. Obviously in some cases it is trivia (for example if k smaller than any edge which obviously will answer yes, if positively-weighted graph contains any cycle, or if it is bigger than sum of all edges or k > |V| in unweighed graph, in which answer is obviously no, as no such simple path exists).

Is there any general results about restricting k to other values? Will problem still be NP? —Preceding unsigned comment added by 91.213.255.7 (talk) 05:44, 3 February 2011 (UTC)[reply]

It is not. The longest path is NP-hard but not NP-complete (what polynomial length proof/certificate would certify no longer path exists?). Only the decision problem formulation is NP-complete. I am updating the description to be more accurate.

Longest circuit?

[edit]

The longest circuit problem is also NP-complete, should this be added to the article?--RDBury (talk) 10:36, 14 August 2013 (UTC)[reply]

certificates

[edit]

are there polinomial certificates and verifyers for longest paths? --46.114.35.147 (talk) 08:20, 4 December 2019 (UTC)[reply]

For long paths, yes. For being the longest, probably not. —David Eppstein (talk) 18:46, 4 December 2019 (UTC)[reply]

Acyclic graph algorithm

[edit]

An alternate algorithm doesn't require an initial topological sort as it computes one during the running of the algorithm. It is just a modified DFS version of topological sort: while there are unvisited nodes, run DFS on an arbitrary node and do the DP procedure of max value of children plus one. Wqwt (talk) 20:21, 30 September 2021 (UTC)[reply]