0% found this document useful (0 votes)
24 views7 pages

Flow Network

A flow network is a directed graph with capacities on edges, defined by a source and sink vertex, where flow must adhere to specific conditions. The maximum flow problem seeks to determine the greatest flow from the source to the sink, analogous to water flow through pipes. The Ford-Fulkerson algorithm is a method to compute maximum flow by finding augmenting paths in a residual graph until no more paths exist.

Uploaded by

munnasarker010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views7 pages

Flow Network

A flow network is a directed graph with capacities on edges, defined by a source and sink vertex, where flow must adhere to specific conditions. The maximum flow problem seeks to determine the greatest flow from the source to the sink, analogous to water flow through pipes. The Ford-Fulkerson algorithm is a method to compute maximum flow by finding augmenting paths in a residual graph until no more paths exist.

Uploaded by

munnasarker010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Flow Network

In graph theory, a flow network is defined as directed graph G=(V,E) constrained


with a function c, which bounds each edge e with a non-negative integer value
which is known as capacity of the edge e with two additional vertices defined as
source S and sink T.

As shown in the flow network given below, a source vertex has all outgoing edges
and no incoming edges, more formally we can say In_degree[source]=0 and sink
vertex has all incoming edges and no outgoing edge more formally
out_degree[sink]=0.

Also, any flow network should satisfy all the underlying conditions --

 For all the vertices (except the source and the sink vertex), input flow must
be equal to output flow.
 For any given edge(Ei) in the flow network, 0≤flow(Ei)≤capacity(Ei) must
hold, we can not send more flow through an edge than its capacity.
 Total outflow from the source vertex must be equal to total inflow to the
sink vertex.

Maximum Flow Problem Introduction

The underlying image represents a flow network, where the first value of each
edge represents the amount of the flow through it (which is initially set to 0) and
the second value represents the capacity of the edge.
The maximum flow is the maximal possible value of the flow of the network
where the flow is defined as, "sum of all the flow that gets produced in source s, or
sum of all the flow that gets consumed in the sink t ".

If we try to co-relate this problem with a real-life problem, we can visualize all the
edges as water pipes, where the capacity of edge (here pipe) is the maximum
amount of water that can flow through it per unit time. Where s is analogous to the
Water plant and t is analogous to the drainage plant.

It follows the conditions necessary for a flow network that more water than pipe's
capacity can't flow through it and water inflow and outflow of water at every
vertex (house) must be equal as water can't magically disappear or appear.

Formally, Maximum flow can be defined as -

Maximum amount of flow that the network would allow to flow from source to
sink vertex.
Ford-Fulkerson Algorithm for finding Maximum Flow

This algorithm was developed by L.R. Ford and Dr. R. Fulkerson in 1956. Before
diving deep into the algorithms let's define two more things for better
understanding at later stages -

 Residual Capacity - Residual capacity of the directed edge is nothing but


capacity of the edge - current flow through the edge. If there is flow along a
directed edge u → v then reversed edge has a capacity 0 and we can say
f(v,u)=−f(u,v)
 Residual Graph - Residual graph is nothing but the same graph with the
only difference is we use residual capacities as capacities.
 Augmenting Path - It is a simple path from source to sink in a residual
graph i.e. along the edges whose capacity is 0.

In the Ford-Fulkerson method, firstly we set the flow of each edge e to 0. Then we
look if an augmenting path exists between s and t. If such a path exists then we will
increase the flow along those edges.

We repeat this process until there is at least on more augmenting path in the
residual graph. Once there are no more augmenting paths maximal flow is
achieved.

Let us see what does increasing the flow along an augmenting path means. Let X
be the minimum residual capacity found among the edges of augmenting path.

Then, for every edge (u,v) in the path we do f(u,v)+=X (Forward edges) and
f(v,u)−=X (backward edges).

Now we use the above network to demonstrate how the Ford-Fulkerson method
works.
Example

We can see that the initial flow of all the paths is 0. Now we will search for an
augmenting path in the network.

One such path is s→A→B→t with residual capacities as 7, 5, and 8. Their


minimum is 5, so as per the Ford-Fulkerson method we will increase a flow of 5
along the path.

Now, we will check for other possible augmenting paths, one such path can be
s→D→C→t with residual capacities as 4, 2, and 5 of which 2 is the minimum. So
we will increase a flow of 2 along the path.

One can easily observe from the figure that we can't increase the flow along paths
A→B and D→C as their flow has reached their maximum capacity. So to find
other augmenting paths, we must take care that these edges must not be part of the
path.

One such path can be s→D→A→C→t with residual capacitiesas2,3,3,

An augmenting path that is possible in the current residual network is s→A→C→t


with residual capacities as 2, 1, and 1 of which 1 is minimum.

So we will increase the flow of 1 along the path after which our network will look
like -

Now there are no more augmenting paths possible in the network, so the maximum
flow is the total flow going out of source or total flow coming in sink i.e.
6+4=5+5=10

Applications.

 In traffic movements, to find how much traffic can move from a City A to
City B.
 In electrical systems, to find the maximum current that could flow the wires
without causing any short circuit.
 In the water/sewage management system, to find maximum capacity of the
network.
FORD-FULKERSON (G, s, t)
1. for each edge (u, v) ∈ E [G]
2. do f [u, v] ← 0
3. f [u, v] ← 0
4. while there exists a path p from s to t in the residual network G f.
5. do cf (p)←min?{ Cf (u,v):(u,v)is on p}
6. for each edge (u, v) in p
7. do f [u, v] ← f [u, v] + cf (p)
8. f [u, v] ←-f[u,v]

example: Each Directed Edge is labeled with capacity. Use the Ford-Fulkerson algorithm to find
the maximum flow.

Solution: The left side of each part shows the residual network Gf with a shaded augmenting
path p,and the right side of each part shows the net flow f.

You might also like