Title: Flow models, optimal routing
1Flow models, optimal routing
- Single commodity network flows
- Max-flow/min cut
- The Ford-Fulkerson algorithm
- Minimum cost flows
2Flows in a network
- In a directed graph, if node i and node j are
joined by an arc (link), over this arc some
quantity f(i,j) (link flow) in data units/sec can
flow. - Associated with the arc connecting node i and
node j is a capacity c(i,j), so that f(i,j)
cannot exceed c(i,j). - There is a source node S, which has an external
supply of flow v. There is a sink node T, which
has a demand of flow v.
3Flows in a network example
- A network with the arc capacities as indicated
- conservation of flow (flow_out-flow_in0)
- node s f(S,1) f(S,2) v 0
- node 1 f(1,3) f(1,2) f(S,1) 0
- node 2 f(2,3) f(2,4)- f(S,2) f(1,2) 0
- node 3 f(3,T) f(3,4) f(2,3) f(1,3) 0
- node 4 f(4,T) - f(3,4) - f(2,4) 0
- v f(3,T) f(4,T) 0
4Flows in a network example (cont.)
- Arc capacity constraints f(S,1) ? 6, f(S,2) ?
8, f(1,2) ? 3, f(1,3) ? 3, f(2,3) ? 4, f(2,4) ?
2, f(3,4) ? 2, f(3,T) ? 8, f(4,T) ? 6
- A (path) flow is a collection of the link flows
f(i,j) . A feasible flow is a flow that
satisfies the flow conservation and arc
capacities constraints. - The objective is to maximize the total flow v
under the flow conservation and capacity
constraints.
3
1
3
6
8
4
3
S
T
2
v
v
8
6
2
4
2
5Flow-augmenting paths
- Consider the following feasible flow example
- The arcs in a flow network can be put into two
categories - I, the set of arcs whose flow can be increased,
these are those arcs whose flow is smaller than
its capacity, e.g. arcs S-1, 1-2, 2-6, 3-S, 4-2,
4-3 - R, the set of arcs whose flow can be reduced,
these are those arcs whose flow is non-zero, e.g.
all arcs in I and 3-2, T-4
capacity
Link flow
6Flow-augmenting paths (cont.)
- To increase the net flow from S to T, we can
- find a directed path from S to T which only
consists of arcs belonging to I then determine
the maximum increase in flow for these arcs, e.g.
the path S-1-2-T is such a path and the maximum
increase in flow without exceeding the arc
capacities is 1. This path may be called a flow
augmenting path. - find a directed path from T to S which only
consists of arcs belonging to R then determine
the maximum decrease in flow for these edges,
e.g. the path T-4-3-S is such a path and the
maximum decrease in flow is 1. This is also a
flow augmenting path. - combine the two approaches above i.e., find a
path P from S to T with the following properties - if arc(x,y) is on P and is directed from S to T
(a forward arc), then (x,y) is a member of I. - if arc(x,y) is on P and is directed from T to S
(a backward arc), then (x,y) is a member of R.
7Flow-augmenting paths (cont.)
- For the combined approach, the maximum increase
in flow is the minimum of the possible increase
in flow for those forward arcs, or the minimum
decrease in flow for those backward arcs,
whichever smaller. - e.g., in the previous example S-1-3-4-T is such a
path. The maximum increase in flow is 2 units.
Illustrating flow augmentation on S-1-3-4-T
8Residual network
- The residual network for any feasible flow is
constructed as follows. - If arc(x,y) is a member of I, then construct an
arc in the residual network from x to y and label
it with a residual capacity r(x,y) c(x,y)
f(x,y). - If arc(x,y) is a member of R, then construct an
arc in the residual network from y to x and label
it with a residual capacity r(y,x) f(x,y).
9Residual network example
3
10Flow-augmenting algorithm
- Every flow augmenting path from S to T in the
original network is a directed path from S to T
in the residual network. - A flow augmenting algorithm (finding extra flow)
can be designed as follows. - Step 1 Construct the residual network
corresponding to the current feasible flow. Label
node S with e(s) ? and p(S) 0. All other
nodes are initially unlabeled. All arcs are
unmarked. - Step 2 Select a labeled node x which has not yet
been considered. If none exits, then stop no
flow-augmenting path from S to T exits. Otherwise
go to step 3. - Step 3 If y is currently unlabeled and if (x,y)
is a member of the forward star (outgoing arc) of
x, then label node y with e(y) min e(x),
r(x,y) and p(y) x. Mark arc(x,y). If T is
labeled, then stop since a flow-augmenting path
from S to T has been found Otherwise return to
step 2.
11Flow-augmenting algorithm example
e extra flow that can be sent down the
pathp predecessor
e(2)2 p(2)1
e(1)2 p(1)S
1
2
4
1
2
1
S
T
e(S)inf.
e(T)1 p(T)2
1
3
4
3
e(3)1
e(4)1
12Cut
- If a set of arcs are removed from a connected
graph, the number of components is increased.
This set of arcs is called a disconnecting set.
- A cut is a set of arcs in a directed graph such
that each path from S to T includes an arc in
this set. Thus a cut in a network is an S-T
disconnecting set (one component containing S,
the other T) in the corresponding directed graph.
a disconnecting set
1
2
3
4
6
5
13Cut (cont.)
- The capacity of a cut is the sum of the
capacities of the forward arcs in the cut. - When the cut capacity is the smallest, the cut is
called a minimum cut. - Note that there may be more than one minimum cut
in a network.
14Cut examples
cut 2
cut 1
a
a
Cut3
1
a
c
S
T
S
T
1
1
b
T
b
S
1
1
a
1
1
3
1
1
S
T
b
d
1
a
Cap.2
1
a
4
b
Cap.2
Cap.3
S
T
S
T
b
b
- The minimum cut is (S,a), (b,T) and the
capacity is equal to 2
15Ford and Fulkerson algorithm (Maximum-flow
algorithm)
- Max-Flow/Min-Cut theorem The value of the
maximum feasible flow from S to T is equal to the
capacity of the minimum S-T cut. - This algorithm makes use of the concepts of
residual network and flow-augmenting path
discussed previously.
16Ford and Fulkerson algorithm (cont.)
- Step 1 Let S denote the source node, and let T
denote the sink node.Select any initial flow
from S to T, i.e., any set of values for f(x,y)
that satisfies conservation of flow and capacity
constraints. If no such initial flow is known,
use as the initial flow f(x,y)0 for all (x,y). - Step 2 Construct the residual network relative
to the current flow. - Step 3 Perform the flow-augmenting algorithm to
determine a flow-augmenting path if no path is
found, stop the current flow is maximum
otherwise make the maximum possible flow
augmentation along the flow-augmenting path
discovered by the flow-augmenting algorithm.
Return to Step 2.
An example in flash movie
17Minimum cost flow
- A given cost per unit C(i,j) is associated with
the arc (i,j). - Given s-t flow, find the minimum cost of the s-t
flow, where the cost of a flow is defined as the
sum of the flow over all arcs times the cost per
unit for that arc. - Find the maximum flow with a minimum cost.
18Optimal routing
- In a network, there is a set of
origin-destination (O-D) pairs. The traffic for
each pair w(i,j) is denoted rw. - The transmission capacity of link (i,j) is
denoted c(i,j) in data units/sec. The link flow
for link (i,j) is f(i,j). - Optimal routing given traffic and link
capacities, find path flows to minimize
subject to flow conservation, where Dij
is a cost function. - Example use the average number of waiting data
units in the network as cost function. On link
(i,j), are waiting. Optimal
routing finding path flows to minimize
subject to flow conservation