Max flow problem

Post on 15-Apr-2017

30 views 0 download

Transcript of Max flow problem

Mohammad Mohsin Ul HaqAbdul Mujeeb Dalal

Mohamad Aymen Mir

8th June 2016

Max Flow Problem

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

Overview

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

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

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

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.

A simple Max Flow problem

Solution

Representation of solution flows

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

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.

Algorithms for calculating max flow

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

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 ∆

Shortcoming of Greedy Algorithm

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

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

Residual Graph for previous 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)

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.

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

By Abdul Mujeeb Dalal

Next Up

Ford Fulkerson

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 .

Use in Computer Networks

TECHNOLOGY IMPACT MODERN LFESTYLE ADVANCING CIVILIZATION FLOURISHING NETWORKS

Network Optimization

COST VS PROFIT SUPPLY VS DEMAND NETWORK

OPTIMISATION

Implementation Example

ADDRESSING THE CHALLENGES IN CLOUD COMPUTING TOO

Implementation Example

Implementation Example

Implementation Example

Sensor Network

Required Characteristics

SensingConnectivityRobustness

Sensor node placement

Trivial Router Placement

Trivial reuse placement

Clustering Sensors

Redundancy for robustness

Introducing Redundancy

Optimal redundancy

Algorithm

Undirected Graph to Directed Graph

Implementation

Introduce New links

THE END!