Open williamfiset opened 5 years ago
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.
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
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.