Algorithms and Problem-Solving Lab (15B17CI471)
EVEN 2024
Week -4 (19th Feb – 25th Feb 2024)
Assignment-5
Topic: Network Flow
Q1. Given a graph which represents a flow network where every edge has a capacity. Also given
two vertices source ‘s’ and sink ‘t’ in the graph, write a program to find the maximum possible
flow from s to t using Ford Fulkerson algorithm with following constraints:
a) Flow on an edge doesn’t exceed the given capacity of the edge.
b) Incoming flow is equal to outgoing flow for every vertex except s and t.
Q2. Given a graph which represents a flow network where every edge has a capacity. Also given
two vertices source ‘s’ and sink ‘t’ in the graph, write a program to find the maximum possible
flow from s to t using Edmond’s Karp algorithm with following constraints:
a) Flow on an edge doesn’t exceed the given capacity of the edge.
b) Incoming flow is equal to outgoing flow for every vertex except s and t.
Q3. There are M job applicants and N jobs. Each applicant has a subset of jobs that he/she is
interested in. Each job opening can only accept one applicant and a job applicant can be
appointed for only one job. Implement an efficient algorithm to find an assignment of jobs to
applicants in such that as many applicants as possible get jobs.
Q4. Given a directed graph (representing a network) and two vertices in it, source ‘s’ and
destination ‘t’. Suppose you want to send some large files from s to t but never have two files use
the same network link (to avoid congestion on the links). Implement an algorithm to find out the
maximum number of files that can be sent from s to t.
For example, for the given network, maximum two files can be sent via paths shown in blue and
red.