Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Negative cycles in min cost max flow algorithms

Open williamfiset opened this issue 6 years ago • 2 comments

The current implementation of the Bellman Ford min-cost flow algorithms seems to only support non-negative edge costs, but in reality, they should be able to handle negative weighted edges.

williamfiset avatar Dec 04 '18 05:12 williamfiset

I will need to investigate this more to see if the initial graph should be able to handle negative edge cost or if negative edge costs simply arise as part of the residual graph.

williamfiset avatar May 04 '19 19:05 williamfiset

It seems like it works perfectly with negative cycles too. Bellman-Ford algorithm takes to care for negative edges for shortest cost calculation. And usually I saw at most places, it is implemented in a similar fashion. Maybe I'm wrong, feel free to correct me. For a more thorough reference, you can see at https://cp-algorithms.com/graph/min_cost_flow.html

jishanshaikh4 avatar Sep 20 '19 17:09 jishanshaikh4