Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

I'm trying to compute an (s-t) maximum flow through a network which includes a number of arc pairs ((u,v), (v,u)) that have equal, negative capacities (weights). I'm not aware of any efficient algorithms that solve this problem directly, so I am trying to think of a way to transform the problem so that it can be passed to standard max-flow algorithms that assume all arc capacities are non-negative.

The only hint I could find online was a question in a 1999 homework assignment which asks students to "Show how to reduce the problem of maximum flow with possibly negative capacities to two maximum flow problems both with nonnegative capacities." (The original can be seen here: http://www.cs.cmu.edu/afs/cs/academic/class/15750-s99/www/homeworks/hw4.ps )

How can this be done?

Edit #1: I should explain the origin of these ((u,v),(v,u)) pairs. What I am really trying to do is solve an s-t maximum flow in a graph that is essentially undirected. By "essentially undirected" I mean a graph that is undirected except for arcs with source s and target in the undirected graph, and arcs with source in the undirected graph and target t. Of course, this kind of "partially directed" graph must be translated into a normal directed graph for any s-t max flow algorithm. To do this, I am applying the standard transformation of replacing every undirected edge (u<->v) (with weight c) with a pair of directed arcs (u->v) and (v->u) with weight c. Since the original graph sometimes has negative edge weights, these ((u,v),(v,u)) pairs with equal negative weights arise.

share|improve this question
Can you clarify the problem? I assume that an arc with capacity -7 needs to have a flow of -7 or less, right? But can an arc with positive capacity get a negative flow? –  Stefan Geschke Mar 26 '11 at 8:17
Ok, I have just read the problem in the link. Still not so clear. If you have an arc pair $\{(u,v),(v,u)\}$, both with the same negative capacity, what would be an admissible flow on these arcs? Or is one capacity positive and the other negative, of the same absolute value, so that you essentially specify your flow at this arc? –  Stefan Geschke Mar 26 '11 at 8:21
If arcs ${(u,v),(v,u)}$ both have capacities of -7, isn't this the same as saying that both arcs must have positive flows of at least 7 units? –  Brian Borchers Mar 26 '11 at 14:20
add comment

2 Answers 2

up vote 2 down vote accepted

The correspondence between max flow with lower capacities and max flow with negative capacities as described in the linked homework problem is based on the convention that $f(u,v)=-f(v,u)$ for all arc pairs $\{(u,v),(v,u)\}$. http://computingscience.nl/docs/vakken/an/an-maxflow.ppt contains a reduction of max flow with lower capacities to the solution of two standard max flow problems, thus solving the homework question. If I understand your problem correctly, it is a bit more complicated: A weight of $-7$ on an (undirected) edge $\{u,v\}$ means that you want to send at least 7 units of flow either from $u$ to $v$ or from $v$ to $u$. As far as I can see, for this problem the standard transformation of replacing the edge by an arc pair does not work. In the standard case only one of the arcs $(u,v)$ and $(v,u)$ is used in an optimal solution, and its flow value can be used as the value for the undirected edge. But how would you transfer $f(u,v)=-9$, $f(v,u)=-12$ back to the undirected model?

Practically, the first thing I would try is to write the original problem as a mixed integer program (I guess you have to model the choices for the arc directions with binary variables) and throw it into a general purpose solver (Cplex, Gurobi, http://zibopt.zib.de, http://www.coin-or.org/ ).

share|improve this answer
add comment

Thanks everyone for your comments. Unfortunately, I now realize that I was trying to do the impossible. As Brian's comment suggests, I can't have a net flow of +7 in both directions between a pair of nodes. As Kali points out, a choice must be made at every such arc-pair that leads to a combinatorial explosion.

I came to the realization yesterday: by the duality of max-flow and min-cut, if I could solve a max-flow problem with negative edge weights then I could solve a min-cut problem with negative edge weights. However, since I can translate any (NP-complete) max-cut problem into a min-cut problem by negating all the edge weights, I can't expect to solve such problems in P-time.

I see now (thanks to Kali) that the homework question makes the (standard) assumption of what I think is called "skew symmetry". The problem I have is incompatible with this and therefore isn't merely a network flow problem with negative edge weights.

share|improve this answer
If you are just interested in the solution to your problem (and not in obtaining it by a provably polynomial algorithm) I still recommend to simply try solving the MIP. –  Thomas Kalinowski Mar 28 '11 at 1:33
Yes, I will probably do this. Since the negative capacity edge pairs are static and reasonably limited in number, an MIP solver is probably going to do a reasonable job. I can also make use of suboptimal solutions, so I agree it is a good way forward. –  Fumiyo Eda Mar 28 '11 at 6:26
@Fumiyo, What did you end up doing? I have been working on this problem to come to the same conclusion you did regarding the incompatibility of negative undirected weights with the standard "skew symmetry" assumption. I suspected from the beginning this problem would be NP-hard. Did you find a good approximation? –  SchighSchagh May 3 at 6:21
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.