# Flow network

In graph theory, a flow network (also known as a transportation network) is a directed graph where each edge has a capacity and each edge receives a flow. The amount of flow on an edge cannot exceed the capacity of the edge. Often in Operations Research, a directed graph is called a network. The vertices are called nodes and the edges are called arcs. A flow must satisfy the restriction that the amount of flow into a node equals the amount of flow out of it, unless it is a source, which has only outgoing flow, or sink, which has only incoming flow. A network can be used to model traffic in a road system, circulation with demands, fluids in pipes, currents in an electrical circuit, or anything similar in which something travels through a network of nodes.

## Definition

Let ${\displaystyle G=(V,E)}$ be a finite directed graph in which every edge ${\displaystyle \ (u,v)\in E}$ has a non-negative, real-valued capacity ${\displaystyle \ c(u,v)}$. If ${\displaystyle \ (u,v)\not \in E}$, we assume that ${\displaystyle \ c(u,v)=0}$. We distinguish two vertices: a source ${\displaystyle \ s}$ and a sink ${\displaystyle \ t}$. A flow in a flow network is a real function ${\displaystyle \ f:V\times V\rightarrow \mathbb {R} }$ with the following three properties for all nodes ${\displaystyle \ u}$ and ${\displaystyle \ v}$:

 Capacity constraints: ${\displaystyle \ f(u,v)\leq c(u,v)}$. The flow along an edge cannot exceed its capacity. Skew symmetry: ${\displaystyle \ f(u,v)=-f(v,u)}$. The net flow from ${\displaystyle \ u}$ to ${\displaystyle \ v}$ must be the opposite of the net flow from ${\displaystyle \ v}$ to ${\displaystyle \ u}$ (see example). Flow conservation: ${\displaystyle \ \sum _{w\in V}f(u,w)=0}$, unless ${\displaystyle \ u=s}$ or ${\displaystyle \ u=t}$. The net flow to a node is zero, except for the source, which "produces" flow, and the sink, which "consumes" flow.

i.e. Flow conservation implies: ${\displaystyle \ \sum _{(u,v)\in E}f(u,v)=\sum _{(v,z)\in E}f(v,z)}$, for each vertex ${\displaystyle \ {v\in V\setminus \{s,t\}}}$

Notice that ${\displaystyle \ f(u,v)}$ is the net flow from ${\displaystyle \ u}$ to ${\displaystyle \ v}$. If the graph represents a physical network, and if there is a real flow of, for example, 4 units from ${\displaystyle \ u}$ to ${\displaystyle \ v}$, and a real flow of 3 units from ${\displaystyle \ v}$ to ${\displaystyle \ u}$, we have ${\displaystyle \ f(u,v)=1}$ and ${\displaystyle \ f(v,u)=-1}$.

Basically we can say that flow for a physical network is flow leaving at s = ${\displaystyle \ \sum _{(s,v)\in E}f(s,v)}$

The residual capacity of an edge is ${\displaystyle \ c_{f}(u,v)=c(u,v)-f(u,v)}$. This defines a residual network denoted ${\displaystyle \ G_{f}(V,E_{f})}$, giving the amount of available capacity. See that there can be a path from ${\displaystyle \ u}$ to ${\displaystyle \ v}$ in the residual network, even though there is no path from ${\displaystyle \ u}$ to ${\displaystyle \ v}$ in the original network. Since flows in opposite directions cancel out, decreasing the flow from ${\displaystyle \ v}$ to ${\displaystyle \ u}$ is the same as increasing the flow from ${\displaystyle \ u}$ to ${\displaystyle \ v}$. An augmenting path is a path ${\displaystyle \ (u_{1},u_{2},\dots ,u_{k})}$ in the residual network, where ${\displaystyle \ u_{1}=s}$, ${\displaystyle \ u_{k}=t}$, and ${\displaystyle \ c_{f}(u_{i},u_{i+1})>0}$. A network is at maximum flow if and only if there is no augmenting path in the residual network ${\displaystyle \ G_{f}}$ .

So ${\displaystyle \ G_{f}}$ is constructed using graph G as follows:

1. Vertices of ${\displaystyle \ G_{f}}$ = ${\displaystyle \ V}$

2. Edges of ${\displaystyle \ G_{f}}$ = ${\displaystyle \ E_{f}}$ defined as-

For each edge ${\displaystyle \ (x,y)\in E}$

    (i). If ${\displaystyle \ f(x,y) make Forward edge ${\displaystyle \ (x,y)\in E_{f}}$ with capacity  ${\displaystyle \ c_{f}=c(x,y)-f(x,y)}$.
(ii). If ${\displaystyle \ f(x,y)>0,}$ make Backward edge ${\displaystyle \ (y,x)\in E_{f}}$ with capacity  ${\displaystyle \ c_{f}=f(x,y)}$.


This concept is used in Ford–Fulkerson algorithm which computes the maximum flow in a flow network.

Sometimes one needs to model a network with more than one source, a supersource is introduced to the graph.[1] This consists of a vertex connected to each of the sources with edges of infinite capacity, so as to act as a global source. A similar construct for sinks is called a supersink.[2]

## Example

A flow network showing flow and capacity

To the right you see a flow network with source labeled ${\displaystyle s}$, sink ${\displaystyle t}$, and four additional nodes. The flow and capacity is denoted ${\displaystyle f/c}$. Notice how the network upholds skew symmetry, capacity constraints and flow conservation. The total amount of flow from ${\displaystyle s}$ to ${\displaystyle t}$ is 5, which can be easily seen from the fact that the total outgoing flow from ${\displaystyle s}$ is 5, which is also the incoming flow to ${\displaystyle t}$. We know that no flow appears or disappears in any of the other nodes.

Residual network for the above flow network, showing residual capacities. Although the flow from b to a should be 1, not 3.

Below you see the residual network for the given flow. Notice how there is positive residual capacity on some edges where the original capacity is zero, for example for the edge ${\displaystyle (d,c)}$. This flow is not a maximum flow. There is available capacity along the paths ${\displaystyle (s,a,c,t)}$, ${\displaystyle (s,a,b,d,t)}$ and ${\displaystyle (s,a,b,d,c,t)}$, which are then the augmenting paths. The residual capacity of the first path is ${\displaystyle \min(c(s,a)-f(s,a),c(a,c)-f(a,c),c(c,t)-f(c,t))}$ ${\displaystyle =\min(5-3,3-2,2-1)=\min(2,1,1)=1}$. Notice that as long as there exists some path with a positive residual capacity, the flow will not be maximum. The residual capacity for some path is the minimum residual capacity of all edges in that path.

## Applications

Picture a series of water pipes, fitting into a network. Each pipe is of a certain diameter, so it can only maintain a flow of a certain amount of water. Anywhere that pipes meet, the total amount of water coming into that junction must be equal to the amount going out, otherwise we would quickly run out of water, or we would have a buildup of water. We have a water inlet, which is the source, and an outlet, the sink. A flow would then be one possible way for water to get from source to sink so that the total amount of water coming out of the outlet is consistent. Intuitively, the total flow of a network is the rate at which water comes out of the outlet.

Flows can pertain to people or material over transportation networks, or to electricity over electrical distribution systems. For any such physical network, the flow coming into any intermediate node needs to equal the flow going out of that node. This conservation constraint was formalized as Kirchhoff's current law.

Flow networks also find applications in ecology: flow networks arise naturally when considering the flow of nutrients and energy between different organizations in a food web. The mathematical problems associated with such networks are quite different from those that arise in networks of fluid or traffic flow. The field of ecosystem network analysis, developed by Robert Ulanowicz and others, involves using concepts from information theory and thermodynamics to study the evolution of these networks over time.

The simplest and most common problem using flow networks is to find what is called the maximum flow, which provides the largest possible total flow from the source to the sink in a given graph. There are many other problems which can be solved using max flow algorithms, if they are appropriately modeled as flow networks, such as bipartite matching, the assignment problem and the transportation problem. Maximum flow problems can be solved efficiently with the Relabel-to-front algorithm. The max-flow min-cut theorem states that finding a maximal network flow is equivalent to finding a cut of minimum capacity that separates the source and the sink.

In a multi-commodity flow problem, you have multiple sources and sinks, and various "commodities" which are to flow from a given source to a given sink. This could be for example various goods that are produced at various factories, and are to be delivered to various given customers through the same transportation network.

In a minimum cost flow problem, each edge ${\displaystyle u,v}$ has a given cost ${\displaystyle k(u,v)}$, and the cost of sending the flow ${\displaystyle f(u,v)}$ across the edge is ${\displaystyle f(u,v)\cdot k(u,v)}$. The objective is to send a given amount of flow from the source to the sink, at the lowest possible price.

In a circulation problem, you have a lower bound ${\displaystyle l(u,v)}$ on the edges, in addition to the upper bound ${\displaystyle c(u,v)}$. Each edge also has a cost. Often, flow conservation holds for all nodes in a circulation problem, and there is a connection from the sink back to the source. In this way, you can dictate the total flow with ${\displaystyle l(t,s)}$ and ${\displaystyle c(t,s)}$. The flow circulates through the network, hence the name of the problem.

In a network with gains or generalized network each edge has a gain, a real number (not zero) such that, if the edge has gain g, and an amount x flows into the edge at its tail, then an amount gx flows out at the head.

In a source localization problem, an algorithm tries to identify the most likely source node of information diffusion through a partially observed network. This can be done in linear time for trees and cubic time for arbitrary networks and has applications ranging from tracking mobile phone users to identifying the originating village of disease outbreaks.[3]

## References

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}

• {{#invoke:citation/CS1|citation

|CitationClass=book }}