Network Flow
By:Daniel Pham,
Anthony Huber, Shaazan Wirani
Questions
1. What is a network flow?
2. What is the Big O notation of the Ford-Fulkerson method?
3. How to test if the Hungarian algorithm is optimal?
Anthony Huber
Computer Science senior
Hololens research under Dr. Huang
Hometown: Elizabethton, TN
Interests:
Guitar
Video games with friends and family
Swimming
Daniel Pham
Computer Science senior
Interests:
Gaming
Working out
Hometown: Nashville, TN
Shaazan Wirani
Major: Computer Science
Minor: Mathematics
Originally from India
Interests:
Sports: Football and Basketball
Spending time with my family
Chattanooga, TN
Outline
History of Flow Network
Overview of Flow Network
Definitions of the Algorithms with Applications
Implementations
Open Issues
References
Discussion
History
Ford-Fulkerson Method: First published in
1956 by:
Lester Randolph Ford Jr.
Delbert Ray Fulkerson
Assignment Problem:
1955: Harold Kuhn → Matrix implementation
1987: Harold Gabow and Robert Tarjan
Maximum flow:
1986: Andrew Goldberg and Robert Tarjan
Minimum Cost Circulation:
1972: Jack Edmonds and Richard Karp
1987: Andrew Goldberg, Robert Tarjan and
Orlin
1988: Ravindra Ahuja, Andrew Goldberg, Orlin,
and Robert Tarjan
Generalized Flow:
1989: Vaidya
Network Flow
What is Network Flow:
A network flow 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.
● A → B → D → E : Sending 2 Mb/s
● We get two new Graphs
Residual Graph and Augmenting Graph
Ford-Fulkerson for Maximum Flow
Greedy algorithm that starts from an empty flow and as long is it can find an
augmenting path, updates the current solution
Each augmenting path can be found in → O(E) time
To find the maximum flow, increasing the flow by an integer 1 for each flow,
but is bounded by the total number of flows which is f → O(f E)
Edmonds-Karp Algorithm
Variation of the Ford-Fulkerson method
The difference between these two methods are that augmenting path is
defined.
O(f E) → Ford-Fulkerson Method
O(V E2) → Edmonds - Karp Method
The augmenting path is the shortest path that has available capacity (the
shortest path in the residual graph)
This path can be found with a BFS
Maximum Bipartite matching
A Bipartite Graph is a graph whose vertices can be divided into two disjoint
sets U and V such that each edge connects a vertex U in one of V
Example :
The Assignment Problem
A general problem layout:
The problem instance has a number of agents and a number of tasks. Any agent can be
assigned to perform any task, incurring some cost that may vary depending on the agent-
task assignment. It is required to perform all tasks by assigning exactly one agent to each
task and exactly one task to each agent in such a way that the total cost of the assignment
is minimized.
The algorithm applies to a given NxN cost matrix to find the optimal assignment.
1. Subtract the smallest entry in each row from all the entries in the row
2. Subtract the smallest entry in each column from all the entries in the column
3. Draw lines through the appropriate rows using the least number of
horizontal and vertical lines to covering the 0’s of the matrix
4. Test for optimality : if the minimum number of lines is N -->found
5. Determine the smallest entry not covered by any line and subtract it from
The Hungarian Algorithm
Example: Matrix Implementation
Example 2: A construction company has four large bulldozers located at four
different garages. The bulldozers are to be moved to four different construction
sites.
How should the bulldozers be moved to the construction sites in order to
minimize the total distance traveled?
Step 1: Subtract the smallest entry in each row from all the entries in the row
Step 2: Subtract the smallest entry in each column from all the entries in the column
Step 3: Draw lines through the appropriate rows using the least number of horizontal and vertical lines to covering the 0’s of the matrix
Step 4: Test for optimality
If the number of vertical and horizontal lines equals N → then the optimized
matrix is found.
Since the minimal number of lines is less than 4, we have to
proceed to Step 5.
Step 5: Determine the smallest entry not covered by any line and subtract it from each uncovered row and add it to each covered column. Then return to step 3
After 2 more iterations
1: Diagonal: 80 + 55 + 95 + 45 = 275
D1 + C2 + B3 + A4
2: Another way: 75 + 65 + 90 + 45 = 275
B1 + D2 + C3 + A4
3: NonZero: 90 + 85 + 90 + 115 = 380
A1 + B2 + C3 + D4
Algorithms/Methods
Ford-Fulkerson
Edmonds-Karp
Maximum Bipartite Matching
Assignment / Hungarian Algorithm
Generalized Network Flow
Ford-FulkersonMore of a method than an algorithm
Find the maximum flow through a graph.
The following is the simple idea of the Ford-Fulkerson algorithm:
1) Start with initial flow as 0.
2) While there is an augmenting path from source to sink.
Add this path-flow to flow.
3) Return flow.
Edmonds-Karp algorithm defines a way to find the augmenting path.
Use BFS finding shortest path with available capacity.
Edmonds-Karp
source
sink
Maximum Bipartite Matching
With a bipartite graph on input, find the maximum matching.
Add a source and sink. Connect the source with all applicants, and connect all jobs with the sink.
Every edge is marked with a capacity of 1.
Using Edmonds-Karp algorithm, find the maximum flow.
Assignment
The problem instance has a number of agents and a number of tasks. Any agent
can be assigned to perform any task, incurring some cost that may vary
depending on the agent-task assignment. It is required to perform all tasks by
assigning exactly one agent to each task and exactly one task to each agent in
such a way that the total cost of the assignment is minimized.
Hungarian Algorithm
Step 0)
A. For each vertex from left part (workers), find the minimal outgoing edge and subtract its weight from all weights
connected with this vertex. This will introduce 0-weight edges (at least one).
B. Apply the same procedure for the vertices in the right part (jobs). Actually, this step is not necessary, but it decreases
the number of main cycle iterations.
Step 1)
A. Find the maximum matching using only 0-weight edges (for this purpose you can use max-flow algorithm, augmenting
path algorithm, etc.).
B. If it is perfect, then the problem is solved. Otherwise find the minimum vertex cover V (for the subgraph with 0-weight
edges only), the best way to do this is to use Köning’s graph theorem (According to this resource).
Step 2) Adjust the weights using the following rule where V is the set of vertices in the vertex cover:
Step 3) Repeat Step 1 until solved.
Time complexity: O(n^4)
Generalized Network Flow
Generalized network flow models are
achieved when the edges have an
associated gain or loss. Most real world
networks will have this behavior. For
example: voltage transportation, water
canal evaporation, currency exchange,
shipping losses, etc.
Implementations
A Ford-Fulkerson algorithm(Red)
Edmonds Karp algorithm(Black)
MIT’s algorithm (Purple)
- At 750 nodes, over 8 times better
- than the other two
Implementations: Ford-Fulkerson/Edmonds Karp
Greedy algorithm checks all paths to find an augmenting path, updates the
total flow
Checks a path, then tries to find a path that maximizes the flow
Takes more time as the size of the graph increases
Recent years, the size of graphs being studied increased
Implementations: MIT’s Algorithm
Finding an efficient way to move through a network (i.e. transportation of
materials, internet traffic) becomes increasingly problematic as the size of
the network increases
Reduces the number of operations
Take less unnecessary actions
Implementations: MIT’s Algorithm
Finds areas of the graph that create a “bottleneck” effect
MIT professors and graduate students viewed the graph like an electric resistor
Divides the graph into clusters of well connected nodes
The paths between these clusters, are the paths that create a “bottleneck”
Focus on higher level problems/structures, less on unimportant decisions
MIT’s algorithm is based off of max flow, with almost linear time operation
According to an MIT representative, the amount of time it would take to solve a problem is
almost directly proportional to number of nodes in the network
Scales well/increases efficiency
Open Issues
Multi-commodity flow problem
Multiple sinks/sources
Real world applications of the algorithms
Correctness of different algorithms(i.e. returning incorrect max flow, preferences)
Optimization
The time to compute
Open Issues: multi-commodity flow
Multiple sources/sinks
How do we know which source to choose first?
Algorithms are already time consuming on large graphs with one source/sink
Even more costly on time and computation to check all paths in a large graph with multiple
sources/sinks
How can this be addressed?
Open Issues: multi-commodity flow
Supersource - vertex connecting all sources
Supersink - vertex connecting all sinks
Not a realistic approach
Infinite amount of flow from one point
Open Issues: Real World Applications
Algorithms don’t take the constraints of the real world
How do we factor cost/efficiency while maximizing flow?
Physical design of the path
Long path with higher capacity vs short path lower capacity
Long path length 10 with 2 capacity or short path length 1 and 1 capacity
References
http://www.geeksforgeeks.org/ford-fulkerson-algorithm-for-maximum-flow-problem/
http://www.geeksforgeeks.org/maximum-bipartite-matching/
http://www.cs.cornell.edu/~eva/network.flow.algorithms.pdf
https://en.wikipedia.org/wiki/Assignment_problem
https://en.wikipedia.org/wiki/Hungarian_algorithm
http://news.mit.edu/2013/new-algorithm-can-dramatically-streamline-solutions-to-the-max-flow-problem-0107
https://lucatrevisan.wordpress.com/2011/02/04/cs261-lecture-9-maximum-flow/
https://en.wikipedia.org/wiki/Ford–Fulkerson_algorithm
Discussions
Any Questions?
Questions
1. What is a network flow?
2. What is the Big O notation of the Ford-Fulkerson method?
3. How to test if the Hungarian algorithm is optimal?
Thank You
Top Related