Re: Finding longest path between two vertices
- From: tchow@xxxxxxxxxxxxx
- Date: 15 Jun 2007 14:42:22 GMT
In article <f4u1sr$sic$1@xxxxxxxxxxxxxxxx>,
Robby Goetschalckx <robby@xxxxxxxxxxxxxxxxx> wrote:
Tim Frink wrote:
Do you see any problems with my suggestion of negating the edge weights
and than search the shortest path?
Not that I know of, at least if the algorithm is able to handle negative
weights. You always have to beware of loops, but in the case of loops
the problem is ill-defined.
Assume that a "path" by definition has no loops, so that the problem is not
ill-defined.
*Logically*, there is no problem with negating the edge weights and then
finding the path with the lowest weight.
*Algorithmically*, there is a serious problem. Dijkstra requires
nonnegative weights, and Bellman-Ford will not give the right answer if
there are cycles with total negative weight. This is not just a silly
technicality that can be fixed with an easy tweak, because as I noted
elsewhere, if you could find the longest path between two vertices then
you could in particular solve the Hamiltonian path problem.
Here again is a suggested starting point:
http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK4/NODE176.HTM
--
Tim Chow tchow-at-alum-dot-mit-dot-edu
The range of our projectiles---even ... the artillery---however great, will
never exceed four of those miles of which as many thousand separate us from
the center of the earth. ---Galileo, Dialogues Concerning Two New Sciences
.
- References:
- Finding longest path between two vertices
- From: Tim Frink
- Re: Finding longest path between two vertices
- From: Robby Goetschalckx
- Re: Finding longest path between two vertices
- From: Tim Frink
- Re: Finding longest path between two vertices
- From: Robby Goetschalckx
- Finding longest path between two vertices
- Prev by Date: Re: Finding longest path between two vertices
- Next by Date: conversion to floating point
- Previous by thread: Re: Finding longest path between two vertices
- Next by thread: Re: Finding longest path between two vertices
- Index(es):
Relevant Pages
|