Given a undirected graph with positive and negative edge weights, does there
exist a simple cycle with negative total weight?
What if we assume the graph is planar?
For more details, see the book "Intro to Algorithms" by Leiserson et al.
(after Bellman-Ford's alg).
--Mohammad
Maybe both :-)
>Given a undirected graph with positive and negative edge weights, does there
>exist a simple cycle with negative total weight?
>
>What if we assume the graph is planar?
The Bellman-Ford algorithm (for the single-source-shortest-path problem)
is capable of detecting negative weight cycles. It seems that this should
work for simple cycles. This sounds simple; am I missing something?
--
Daniel Jimenez djim...@cs.utexas.edu
"I've so much music in my head" -- Maurice Ravel, shortly before his death.
" " -- John Cage
I think this does not solve the problem in the presence of negative
edges,
because if the weight of the edge xy in the original graph is negative,
the perfect matching can be a path from u to w plus the edges (x,y') and
(x',y).
--Mohammad
Yes, I think the poster is interested in undirected graphs.
The problem of finding a shortest path with no negative cycles is in P for
general undirected graphs, but as far as I know, you need to use matching
techniques to solve it. Presumably, if there are negative cycles, the algorithm
fails and you can recover a certificate explaining why (as in Bellman-Ford).
Cheers,
Kevin
--
Kevin Wayne I believe virtually everything I read.
35 Olden Street
Princeton, NJ 08544 -David St. Hubbins
Yes, consider the undirected graph consisting of 2 vertices and 1 negative
weight edge connecting them. Your algorithm with claim it has found a
negative cost cycle.
Regards,
Kevin
> Given a undirected graph with positive and negative edge weights, does there
> exist a simple cycle with negative total weight?
It's in P. The basic idea is to check for shortest paths and pay attention
for negative distances. Bellman-Ford checks this for single source but you could
probably run an all-pairs shortest paths algorithm and then check for negative
distances more cheaply.
> What if we assume the graph is planar?
Still in P, of course.
jef
--
Jeffrey Considine
Head Terminal/Programming Assistant
CAS Undergraduate Computer Science Lab
Boston University
Sorry, I think my last message got chopped. Anyway, the above reduction does
not seem to work for undirected graphs, because there is nothing preventing
the matching from taking both (x, y') and (y, x').
See Section 12.7 in Ahuja, Magnanti, Orlin for a cute reduction (due to
Edmonds) from the shortest path problem in undirected graphs to weighted
nonbipartite matching.
Cheers,