OR 215

OR 215
Network Flows
Spring 1998
M. Hartmann
BIDIRECTED NETWORK FLOWS
Chinese Postman Problem
Minimum Cost T-Joins
(Undirected) Shortest Path Problem
Bidirected Network Flow Problem
Application: Mesh Refinement
Reduction to Perfect b-Matching
Strongly Polynomial Algorithm
CHINESE POSTMAN PROBLEM
A postman wants to deliver mail along all the edges of an
undirected graph and return to his starting point. He may
need to traverse some edges more than once, just to get
to other edges where mail has not been delivered.
5
2
1
2
4
3
1
1
3
3
Euler’s Theorem: A graph contains a closed walk that
visits each edge exactly once (an Euler tour) if and only if
every node in the graph has an even degree.
 Which edges should be repeated by the postman to
minimize the total distance traveled?
MINIMUM COST T-JOINS
Let T be a subset of nodes with |T| even. A T-join is a set
of edges J such that |J  A(i)| is odd if and only if i T.
Suppose that cij  0 for all arcs (i,j). Then some minimum
cost T-join consists of |T|/2 edge-disjoint paths, which join
the nodes of T in pairs.
5
2
1
2
4
3
1
1
3
3
If T = N the min-cost T-join is a min-cost perfect matching.
For T  N, the min-cost T-join can be obtained by solving
a min-cost perfect matching problem on the nodes in T,
after first solving an all-pairs shortest paths problem to
determine the costs of pairing up nodes in T.
5
3
7
3
4
3
If T = { s,t } then the min-cost T-join will be a shortest path
from s to t. Of course, it would be much simpler to use
Djikstra’s algorithm to find the shortest path.
 What if some costs are negative?
Let E' be the set of negative cost edges, and let T' be the
set of nodes that have an odd degree in (V, E') so that E'
is a T'-join.
Lemma. J is a T-join if and only if J  E' is a (T  T')-join.
This allows us to solve a problem with non-negative costs:
c(J)
=
c(J \ E') + c(J  E')
=
c(J \ E') - c(E' \ J) + c(E' \ J) + c(J  E')
=
|c|(J  E') + c(E')
EXAMPLE
4
-2
5
-3
2
s
1
1
6
t
The set E'
of negative
cost edges
t
A min-cost
(T  T')-join
2
2
4
2
5
3
2
s
1
1
6
2
cost edges
2
4
-2
5
-3
2
t
s
1
1
6
2
2
A shortest
path from
node s to t
BIDIRECTED NETWORK FLOW PROBLEM
The node-arc incidence matrix of a network has exactly
one +1 and one -1 in each column. In a bidirected network flow problem, the constraint matrix has 0, 1,  2
entries which satisfy i |aij| = 2.
A =
2
1
-1
0
0
0
1
0
-2
-1
0
0
1
0
-1
Note: Our convention is that a positive entry corresponds
to the tail of an arc and a negative entry to the head.
loop
loop
1
2
3
Arcs can now have two tails or two heads. An arc with
aij =  2 is called a loop (there are no “directed” loops).
The minimum cost bidirected network flow problem is
minimize
subject to
cexe
 eA+(i) xe + 2 eL+(i) xe 
 eA-(i) xe  2 eL-(i) xe =




le  xe  ue
xe integer
bi
for i  N
for all edges e
for all edges e
where A+(i) is the set of edges e whose tail is node i,
A-(i) is the set of edges whose head is node i, L+(i) is the
set of loops whose tails are node i, and L-(i) is the set of
loops whose heads are node i.
The minimum cost T-join problem can be formulated as a
bidirected network flow problem:
minimize
subject to
cijxij
 jA(i) xij  2 xii
 jA(i) xij  2 xii

= 1
for all i  T

= 0
for all i  T
0  xij  1
for all edges (i,j)
xii  0
for all loops (i,i)
xij integer
for all edges/loops (i,j)
APPLICATION: MESH REFINEMENT
Given a mesh of polygons in three-dimensional space, find
a decomposition into strictly convex quadrilaterals such
that the resulting (finer) mesh is conforming (adjacent
quadrilaterals share either a node or a whole edge) and
satisfies certain local density constraints.
 The original mesh is produced by CAD applications.
 The finer mesh is used in the finite element method
(quadrilaterals are more appropriate in structural
analysis).
Question: How many additional vertices should be placed
on each edge to refine the mesh?
Lemma. A simple polygon P admits a conformal refinement into strictly convex quadrilaterals (without placing
additional vertices on the boundary of P) if and only if the
number of vertices of P is even.
Mesh refinement for a simple polygon as a bidirected
network flow problem:
Formulation of the mesh refinement problem as a bidirected network flow problem:
There are upper and lower bounds le  xe  ue on the
“dual” edges for density control. Only the “central” nodes
in polygons with an odd number of vertices have bi = 1;
all other nodes have bi = 0.
All of the “dual” edges on the boundary of the mesh are
adjacent to a special node o with a loop and bo = 0 or 1.
CORRECTNESS
Step 1: Quadrangulation of the polygon.
Step 2: Routing of the flow on loops.
Step 3: Routing of the flow on all other edges.
EXAMPLES
PERFECT b-MATCHING
The minimum cost perfect b-matching problem is
minimize
cijxij
subject to
 jA(i) xij
= bi

xij  0
for all i  N
for all edges (i,j)
xij integer
for all edges (i,j)
The integrality constraints can be dropped if we add
 iU, iU xij

 1
for all sets with b(U) odd
If b is even, the min-cost perfect b-matching problem can
be solved as a transportation problem:
4
1
+2 1
2 4
2 2
2
3
+1 2
+1 4
+1 3
1'
2'
-1
3'
'
-2
4' -1
-1
REDUCTION TO PERFECT b-MATCHING
The first step in the reduction is to remove the lower
bounds (setue = ue - le).
 What effect does this have on the b-values?
The next step is to convert the bidirected network into an
undirected graph (with loops):
i
i¯
i+
bi
bi-
bi+
Here bi+ and bi- are sufficiently large integers such that
bi+  bi- = bi.
The next step is to setue = min{ue,bi,bj} for every edge
e = (i,j) to ensure that ue <  for all edges.
The final step is to replace each edge e = (i,j) by a path of
three uncapacitated edges involving new nodes ie and je:
i
bi
ce
0
ie
je
ue
ue
0
j
bi
or if the edge is a loop e = (i,i)
ce
i
bi
ie
ue
0
0
je
ue
Note: If the original bidirected network was a directed
network (with no loops), the the final graph will be bipartite.
EXAMPLE
-1  x22  2

b1 = 5
2  x12  
1
4
2
b2 = 0
1
3
b3 = 2
Original bidirected network flow problem.

b1 = 3
3

1
4
2
1
3
b3 = 2
After removing lower bounds.
b2 = -4

b1+ = 7

1+

1¯
3+
2¯

3¯
b2+ = 3

b3+ = 3
4
b1- = 4
2+
1
b2- = 7
3
b3- = 1
After splitting nodes.
7
b1+ = 7
3
1+
b3+ = 3
4
3
b1- = 4
2+
3
3+
1¯
2¯
1
3¯
b2+ = 3
1
3
b3- = 1
After making capacities finite.
b2- = 7
STRONGLY POLYNOMIAL ALGORITHM
Theorem. Let b and b' be integral. If x' is a minimum cost
b'-matching (with respect to c), then there exists a
minimum cost b-matching x (with respect to c) such that
| x - x' |  | b - b' |1.
 How can we use this “sensitivity” result?
If we set b' = 2 b/2 then x' can be found by solving a
transportation problem, and the differencex = x - x' will
be a (b - b')-matching withxij  | b - b' |1  -|V| andx  -x'.
Ifx is a min-cost perfect (b - b')-matching (subject to the
lower bounds), thenx + x' will solve the minimum cost
perfect b-matching problem.
Removing these lower bounds yields a min-cost perfect
b''-matching problem for which | b'' |1  |V|3.
REDUCTION TO A MIN-COST
PERFECT MATCHING PROBLEM
By splitting each node i into bi copies, the minimum cost
perfect b-matching problem can be solved as a perfect
matching problem:
b1 = 1
1
b1 = 2
2
4
b4 = 2
3
b3 = 3
1
2
4
2
4
3
3
3
REFERENCES
W.J. Cook, W.H. Cunningham, W.R. Pulleyblank and A.
Schrijver, Combinatorial Optimization (Wiley, New
York, 1998).
U. Derigs, Programming in Networks and Graphs
(Springer-Verlag, Berlin, 1988).
R.H. Möhring, M. Müller-Hannermann and K. Weihe,
“Mesh Refinement via bidirected flows: modeling,
complexity and computational results,” J. ACM 44
(1997) 395-426.