> I'm wondering, how can one convert a shortest path problem to a longest path
> problems... I've tried to make each weight become its additive inverse, then
> add a constant to make them all positive, but this is apparently wrong,
> since for longer paths, more constants are added. I conjecture there is no
> way...
>
Your algorithm had to fail, because the LONGEST PATH problem is
known to be NP-Complete (see garey/johnson). Thus it can't be
solved by an application of Dijkstra's algorithm which is in P
(unless P=NP)
[ Moderator's note: the longest path problem in general is NP-complete,
but for acyclic directed graphs it is in P, and can be solved by
dynamical programming - in fact this is exactly what the "critical
path method" is all about.
- Robert Israel ]
Regards,
Marcus Raitner
--
--------------------------------------------------------------
Marcus Raitner
Lst. Prof. Brandenburg rai...@fmi.uni-passau.de
Uni Passau, D-94030 Passau ++49/851/509-3034, FAX: 3032
But in general, where you are trying to solve the longest path problem where
there are cycles with positive sum (or conversely the shortest path problem where
there are cycles with negative sum) finding the longest walk (respectively
shortest walk) won't do (indeed it will be infinite) won't do. Dynamic methods
don't seem to work because you have to keep track of what nodes paths have
visited in the past. And so things get NP-complete.