Flow Networks
Summarized notes on Introduction to Algorithms, Chapter 26
- consider some source that produces material and some sink that consumes it
- flow represents the the rate at which material moves through a system
- each edge in system is a conduit for the material
- each conduit has maximum capacity
- vertices are conduit junctions and does not collect in these junctions
- rate of entry = rate of exit → flow conservation
- Maximum flow problem: compute the greatest rate at which material can be shipped from source without violating capacity constraints
Flow Networks
- directed graph
where- each edge has nonnegative capacity
- if
contains edge there is no edge in reverse direction - if
then - edges are labelled as flow/capacity → flow
capacity - self-loops are not allowed
- each edge has nonnegative capacity
- two special vertices: source
and sink - all vertices connected,
- flow in
is a real-valued function that satisfies- capacity constraint: for all
, - flow conservation: for all
:
- capacity constraint: for all
- value of flow is defined as
\(
\) - maximum flow problem: given
and and , find flow with maximum value
Antiparallel edges
- antiparallel edges violate constraint
- if antiparallel exist, transform network into an equivalent without antiparallel edges
- choose one edge and add new vertex
- replace
with and - set same capacity as original edge
- choose one edge and add new vertex
Multiple sources and sinks
- if multiple sources and sinks → convert to network with one source and sink
- add supersource
:- add directed edge
with capacity for each
- add directed edge
- add supersink
:- add directed edge
with capacity for each
- add directed edge