Re: Finding longest path in graph between two vertices



On Jun 13, 2:52 pm, Tim Frink <plfr...@xxxxxxxx> wrote:
Hi,

I have a directed graph with weighted edges (weights are all positive).

Now, I'm looking for an efficient algorithm to find the longest path
between two given vertices.

My idea was to negate all edge weights and than to run
a) a topological sort and than a relaxation to find the critical path
or
b) Bellman-Ford Algorithm (due to the weight negation it should find not
the shortest but longest path).

Are these algorithms suited for the longest-path problem? And if so,
which one is more efficient?
Or do you know any faster approach?

others have given very good advice
but i just wanted to answer your specific questions

a) relaxation is not guaranteed to give you the minimum
but can regularly come pretty close quickly

a topological sort with exhaustive search will guarantee
but returns you to the NP-hard times mentioned elsewhere

b) bellman-ford is only applicable if you have
no negative total weight cycles

if you want to allow such cycles
you must add rules to the definition of path
that exclude repeatedly traversing the loop
or revisiting vertices
or whatever works for your circumstance

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

.



Relevant Pages

  • Finding longest path between two vertices
    ... I have a directed graph with weighted edges (weights are all positive). ... I'm looking for an efficient algorithm to find the longest path ...
    (comp.theory)
  • Finding longest path in graph between two vertices
    ... I have a directed graph with weighted edges (weights are all positive). ... I'm looking for an efficient algorithm to find the longest path ...
    (sci.math)
  • Re: Problem on an nxn grid
    ... "See Spot Run" in the vocabulary of Graph Theory. ... Gibbons's "Algorithmic Graph Theory" gives a pseudo-code ... parts of the Edmonds algorithm (such as the Hungarian ... All weights are assumed to be ...
    (sci.math)
  • Re: Finding longest path in graph between two vertices
    ... I have a directed graph with weighted edges (weights are all positive). ... I'm looking for an efficient algorithm to find the longest path ...
    (sci.math)
  • RE: [REPORT] cfs-v4 vs sd-0.44
    ... The definition for proportional fairness assumes that each thread has a ... threads have fixed weights throughout the interval. ... approximate this ideal scheduler (often referred to as Generalized ... The goal of a proportional-share scheduling algorithm is to minimize the ...
    (Linux-Kernel)