Ford-fulkerson algorithm on capacities

Assignment Help Data Structure & Algorithms
Reference no: EM13532802

Write code that finds a maximum flow in a directed graph, using the Ford-Fulkerson algorithm on capacities given as matrix void maximum flow(int n, int s, int t, int *capacity, int *flow)

Your function has the following arguments:
- n: the number of vertices of the graph,
- s: the start vertex,
- t: the target vertex
- capacity: the matrix of edge capacities.
- flow: the matrix used to return the maximum flow.

The vertices are numbered from 0 to n-1, so s and t are numbers in that range. capacity, flow are a pointers to n × n matrices of nonnegtive integers; the array element capacity[i][j] is the capacity of the edge from i to j, and can be accessed as *(capacity + i*n + j). Your function should return in the matrix flow the flow values of the maximum flow from s to t. The flow variable of your function points to space allocated for the flow matrix.

Your function will need the following auxiliary arrays:

- an n × n matrix to hold the current flow,

- an n × n matrix to hold the current residual capacities,

- an array to maintain which vertices are already visited in the search of an augmenting path from s to t with positive residual capacity.

You have to allocate the auxiliary arrays. You can use either BFS or DFS for the search of the augmenting path.

Reference no: EM13532802

Questions Cloud

Critically explore any particular aspect of international : Critically explore any particular aspect of international
What is the final temperature of the water mixture : A person tries to heat up the bath water by adding 6.0 L of water at 70ºC to 60 L of water at 30ºC. What is the final temperature of the water mixture
Compare the phytomastigophora with the zoomastigophora : Compare the Phytomastigophora with the Zoomastigophora -- that is, explain how they are similar and how they differ from one another.
What is the difference between tests produced by difflugia : What is the difference between the tests produced by Difflugia and those produced by foraminiferans? How do Amoeba differ from Difflugia and in what ways are they the same?
Ford-fulkerson algorithm on capacities : Write code that finds a maximum flow in a directed graph, using the Ford-Fulkerson algorithm on capacities given as matrix void maximum flow(
What is the change in velocity of the train : A train travels due south at 60 m/s. It reverses its direction and travels due north at 60 m/s. What is the change in velocity of the train
What is the new velocity of the aircraft : A jet airliner moving initially at 300 mi/h due east enters a region where the wind is blowing at 100 mi/h in a direction 28.0° north of east. What is the new velocity of the aircraft
Evaluate the height from which the ball was thrown : A ball is tossed from an upper-story window of a building. The ball is given an initial velocity of 8.90 m/s at an angle of 16.0° below the horizontal. Find the height from which the ball was thrown
What is the free-fall acceleration on the planet : An astronaut on a strange planet finds that she can jump a maximum horizontal distance of 19.0 m if her initial speed is 2.80 m/s. What is the free-fall acceleration on the planet

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd