Flow network

A flow network is a graph where:

  • is a set of nodes
  • is a set of edges (links)
  • For each , is the capacity of edge If , then for convenience we define
  • There are two distinguished nodes: source and sink where
Link to original

Example

Goal of a maximum flow problem

We want to find (design) a maximum flow from the source to the sink:

  • flow of the maximum total amount, while flow on each edge is not greater than capacity of the edge
  • continuous flow of the maximum total rate, while rate of flow on each edge is not greater than the capacity of this edge

Slide 4-5: problem of representatives and reduction to maximum-flow

Other flow problems

  • Flow-feasibility problem: find a feasible flow that satisfies edge capacities and specified supply / demand values at the nodes. This problem is ‘equivalent’ to maximum flow problem.
  • Minimum-cost flow & multi-commodity flow problems

Flows

We assume that if , then .

If there are ‘antiparallel’ edges, we can convert the network into an equivalent with no antiparallel edges by adding an additional vertex:

Flow

A flow is a function where is the flow on edge with properties:

  • Capacity constraints: for each edge ,
  • Flow conservation: for each node :
    • The total flow into is equal to total flow out of
    • i.e. net flow into is equal to
Link to original

Maximum-flow problem

The value of a flow is the net flow from the source, (which is equal to the net flow into the sink due to flow conservation).

Value of a flow / flow conservation condition

Maximum flow problem

The maximum flow problem is where for a given flow network, we find the flow of the maximum possible value (maximises net flow from source).

Link to original

Saturated edge

For a given flow , if then we say that saturates edge and edge is a saturated edge.

Link to original

Flows to paths

A flow can be ‘decomposed’ into at most paths from to and cycles, where is the number of edges in .

Example: decompose following flow into paths

The algorithm works by selecting and removing (from current flow) ‘maximal’ path flows. Each path removes all remaining flow from at least one edge, so at most paths.

The algorithm can be extended to the case where there are flow cycles.

One flow path (or cycle) can be found in time, and there are at most paths / cycles selected, so total running time is . (less than the time needed to find maximum flow)

Flow-feasibility problem

In the Flow-Feasibility problem, we are given an input where and are sets of nodes and edges; for each is the capacity of edge ; for each , indicates the supply / demand at node .

  • : supply of units at
  • : demand of units at
  • : ‘transitional’ node; flow only passes through

We assume , total supply equals demand.

And hence we want to find a feasible flow that is a flow within edge capacities and such that for each node , the net flow from equals (flow convervation property).

Reduction from flow-feasibility to maximum-flow problem

For a given input of the flow-feasibility problem, we construct the input where:

  • where and are new nodes
  • E' = E \cup \{ (s,v): v \in V, d(v) > 0 \} \cup \{ (u,t): u \in V, d(u) < 0 \}$$ Create edges from st$.
  • Set the capacity of the edges equal to the supply / demand of the respective nodes.

Hence compute a maximum flow in :

  • A maximum flow in saturates all edges outgoing from iff there is a feasible flow in .
  • If a maximum flow in saturates all edges outgoing from , then we can remove added nodes / edges to get a feasible flow in .
  • If is a feasible flow in , then saturate all edges outgoing from / incoming to to get a maximum flow in .

Residual capacity & networks

Residual capacity of an edge

Let be a flow in a flow network . The residual capacity of an edge is defined as

Link to original

Residual capacity of a reverse edge

If for an edge , , then the residual capacity of a reverse edge is defined as

The positive residual capacity of reverse edge represents possibility of decreasing the current positive flow .

Link to original

Residual edge

If , then is a residual edge. Let denote the set of all residual edges, .

Link to original

Residual network

The residual network of induced by flow is the flow network where are the residual capacities and is the set of residual edges.

Link to original

A residual path is a simple path in the residual network . The augmenting path is a residual path from to .

The residual capacity of an augmenting path is the maximum amount of flow that can be sent along path :

Let be an augmenting path in . The (path) flow in is: The value of flow is .

Example: increase flow using residual network

Input network and flow of value Residual network Flow of value in residual network Input network and flow of values .

Augmenting current flow by flow in residual network

If is a flow in and is a flow in the residual network , then we can augment by to get a new greater flow in . The new flow in is defined in the following way: This definition of works also if both and are positive. : the value of flow (net flow from source) is equal to sum of values of flows and .

General approach to finding maximum flow

Start with zero flow and keep iteratively increasing flow by flows in residual network:

  1. Construct residual network
  2. Find a non-zero flow in If there is none, exit
  3. (augmentation)

Most max-flow algorithms follow this general approach.

Ford-Fulkerson method

Fold-Fulkerson method

def ford_fulkerson(G): # G = (V, E, c, s, t)
	f = zero flow # f(u, v) = 0 for each (u, v) in E
	
	while True:
		G_f = # (1) construct residual network
		P = # (2) find an augmenting path in G_f (DFS)
		if P is None:
			return f
		
		f = f ^ f_p # (3) path augmentation

Running time of Fold-Fulkerson method

Given is the number of nodes, and is the number of edges.

The running time of one iteration is :

  • construct : or if incremental
  • search to find augmenting path:
  • update the flow:

Number of iterations depends on selection strategy in step (2).

Number of iterations in Ford-Fulkerson

The number of iterations in Ford-Fulkerson method depends on strategy of selecting an augmenting path in each iteration. If the algorithm is run on a network such that all edge capacities are integral:

  • Residual capacities are integral throughout the computation, so the value of the current flow in increases in each iteration by some integer, at least .
  • If denotes a maximum flow, then the number of iterations is at most .
  • Hence total running time is (does not depend on selection strategy).

No general bound on number of iterations which would depend only on size of network ( and ).

Cuts

A cut in a network : . That is, a cut is a partitioning of the set of nodes into two disjoint sets and such that the source node is in the set and the sink node is in the set .

The capacity of a cut is the sum of the capacities of the edges from to :

If is a flow, then the net flow across the cut is: For each cut , , that is, the net flow across the cut is equal to the net flow into the sink .

Example of a cut

For this cut and flow :

Theorem 1. Max-flow Min-cut theorem

For any flow and any cut : (the net flow across a cut cannot be greater than the capacity of this cut).

Therefore, the value of a maximum flow is not greater than the minimum capacity of a cut.

This cut is a minimum capacity cut, , so the maximum value of flow for t his network is not greater than .

Theorem 2.

For a flow in , the following three conditions are equivalent. a. is a maximum flow in b. there is no augmenting path in the residual network c. for some cut in ,

We can prove this by showing implications

  • : assume is a maximum flow in If there is an augmenting path, then the flow cannot be maximum because we can use such a path to increase the value of the flow.

  • : assume no augmenting path in Let be the set of nodes reachable from in the residual network is not in

    All edges from to are saturated. All edges from to have zero flow.

    Therefore, .

  • : let be a cut as in but there is no flow of value greater than so is a maximum flow

Theorem 1 follows from Theorem 2

, so for a maximum flow , there is a cut such that

1 item under this folder.