Max flow problem

40
Mohammad Mohsin Ul Haq Abdul Mujeeb Dalal Mohamad Aymen Mir 8 th June 2016 Max Flow Problem

Transcript of Max flow problem

Page 1: Max flow problem

Mohammad Mohsin Ul HaqAbdul Mujeeb Dalal

Mohamad Aymen Mir

8th June 2016

Max Flow Problem

Page 2: Max flow problem

About Max Flow Problem Flow Network Examples Problem Definition Solution Naïve Greedy Algorithm Residual Graph Ford-Fulkerson Algorithm

Overview

Page 3: Max flow problem

Max Flow Problem

an optimization theory problem

involves finding a feasible flow through a single-source, single-sink flow network that is maximum

can be used to solve multi-source, multi-sink problem by combining them into single, super-source and super-sink respectively

Page 4: Max flow problem

Flow Network

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 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

Page 5: Max flow problem

Examples

Flow networks can be used to model: traffic in a road system, fluids in pipes, currents in an electrical circuit, packet traffic in computer networks,

etc...

Page 6: Max flow problem

Problem Definition

Formally, an instance of the maximum flow problem is specified by the following ingredients: a directed graph G, with vertices V and directed edges E; a source vertex s Є V ; a sink vertex t Є V ; a nonnegative and integral capacity ue for each edge e Є

E.

Page 7: Max flow problem

A simple Max Flow problem

Page 8: Max flow problem

Solution

Page 9: Max flow problem

Representation of solution flows

Page 10: Max flow problem

Solution of Max Flow Problem

Given an input, the feasible solutions are the flows in the network. While we can depict a flow in terms of several paths, for algorithms, it works better to just keep track of the amount of flow on each edge. Formally, a flow is a nonnegative vector {fe}eЄE , indexed by the edges of G, that satisfies two constraints: Capacity constraints: fe ≤ ue for every edge e Є E; Conservation constraints: for every vertex v other than s

and t,amount of flow entering v = amount of flow exiting v

Page 11: Max flow problem

Objective

The objective is to compute a maximum flow - a flow with the maximum-possible value, meaning the total amount of flow that leaves s. This is the same as the total amount of flow that enters t.

Page 12: Max flow problem

Algorithms for calculating max flow

Following algorithms may be used to calculate the solution for the Max Flow Problem: Greedy algorithm Ford-Fulkerson algorithm

Page 13: Max flow problem

A Naïve Greedy Algorithminitialize fe = 0 for all e Є E

repeat

search for an s-t path P such that fe < ue for every e Є P

// takes O(|E|) time using BFS or DFS

if no such path then

halt with current flow {fe}eЄE

else

let ∆ = mineЄP(ue – fe)

for all edges e of P do

increase fe by ∆

Page 14: Max flow problem

Shortcoming of Greedy Algorithm

Even if there exists a max flow solution, the algorithm may terminate with a non-maximum flow solution. For example:

Page 15: Max flow problem

Residual Graphs

The second idea is to extend the naïve greedy algorithm by allowing “undo” operations.

Given a graph G and a flow f in it, we form a new flow network Gf that has the same vertex set of G and that has two edges for each edge of G.

An edge e = (v,w) of G that carries flow fe and has capacity ue spawns a “forward edge” (u, v) of Gf with capacity ue - fe (the room remaining) and a “backward edge” (w, v) of Gf with capacity fe (the amount of previously routed ow that can be undone).

Page 16: Max flow problem

Residual Graph for previous problem

Page 17: Max flow problem

Ford – Fulkerson Algorithm (that same Ford!)

The only difference from the Greedy algorithm is the use of residual graph:

initialize fe = 0 for all e Є E

repeat

search for an s-t path P in the current residual graph Gf such that fe < ue for every e Є P

// takes O(|E|) time using BFS or DFS

if no such path then

halt with current flow {fe}eЄE

else

let ∆ = mineЄP(e’s residual capacity in Gf)

Page 18: Max flow problem

Ford – Fulkerson Algorithm (Cntd…)// augment the flow f using the path Pfor all edges e of G whose corresponding forward edge is in P do

increase fe by ∆for all edges e of G whose corresponding reverse edge is in P do

decrease fe by ∆

It can be proved that the Ford-Fulkerson Algorithm is guaranteed to terminate with a maximum flow.

Page 19: Max flow problem

COMPLEXITY & OPTIMALITY OF FORD FULKERSONMAX FLOW & NETWORK OPTIMISATIONIMPLEMENTATION IN TECHNOLOGY 

By Abdul Mujeeb Dalal

Next Up

Page 20: Max flow problem

Ford Fulkerson

Page 21: Max flow problem

Optimality Conditions For Max FlowLet f be a flow in a graph G.The following are

equivalent: (1) f is a maximum flow of G; (2) there is an (s,t)cut such that the value of f equals the

capacity of (A,B); (3) there is no s-t path (with positive residual capacity) in

the residual network Gf . In Other Words If f is a flow in G such that the residual

network Gf has no s-t path, then the flow is a maximum .

Page 22: Max flow problem

Use in Computer Networks

TECHNOLOGY IMPACT MODERN LFESTYLE ADVANCING CIVILIZATION FLOURISHING NETWORKS

Page 23: Max flow problem

Network Optimization

COST VS PROFIT SUPPLY VS DEMAND NETWORK

OPTIMISATION

Page 24: Max flow problem

Implementation Example

ADDRESSING THE CHALLENGES IN CLOUD COMPUTING TOO

Page 25: Max flow problem

Implementation Example

Page 26: Max flow problem

Implementation Example

Page 27: Max flow problem

Implementation Example

Page 28: Max flow problem

Sensor Network

Page 29: Max flow problem

Required Characteristics

SensingConnectivityRobustness

Page 30: Max flow problem

Sensor node placement

Page 31: Max flow problem

Trivial Router Placement

Page 32: Max flow problem

Trivial reuse placement

Page 33: Max flow problem

Clustering Sensors

Page 34: Max flow problem

Redundancy for robustness

Page 35: Max flow problem

Introducing Redundancy

Optimal redundancy

Page 36: Max flow problem

Algorithm

Page 37: Max flow problem

Undirected Graph to Directed Graph

Page 38: Max flow problem

Implementation

Page 39: Max flow problem

Introduce New links

Page 40: Max flow problem

THE END!