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

  Create a flowchart to show the process that will allow the

1.create a flowchart to show the process that will allow the implementation of stack push and pop operations.2.create a

  Create algorithm to read arbitrary number of data record

Create the algorithm to read arbitrary number of data records, each containing name, age, and code. Code of 1 will indicate female, a code of 2 will indicate male.

  Arrays & more loops practice

Write a program ArraysAndLoops and implement the following in the main method:

  Design a circular double linked list

Design a circular double linked list, for which the following operations should be implemented

  Develop modified versions of the quicksort and mergesort

Using the recursive algorithm, described in the previous section, develop an iterative function with the same functionality as the recursive nextPermutation function. Recall, that the iterative function should not contain recursive calls - it uses..

  Research and implement the sieve of eratosthenes

Research and implement the Sieve of Eratosthenes (also called prime sieve) algorithm. Researching and implementing algorithms is something I did frequently while consulting and any programmer must be able to do this

  Which includes and algorithm that takes an array

Write an application which includes and algorithm that takes an array, selects the high and low integer from the array of integers with each pass and builds a new array of integers by inserting the high and low selection with each pass. Your ..

  Effective address-addressing mode of instruction is direct

Evaluate the effective address if the addressing mode of the instruction is (a) direct; (b) immediate; (c) relative; (d) register indirect.

  Find capacity of a particular airplane type

Consider the entities and their attributes. You should 1st determine what entities want to track. Next determine what attributes are required for each entity, and what relations exist between these entities.

  Create algorithm to read file of employee records

Create the algorithm which will read the file of employee records and produce the weekly report of gross earnings for those employees.

  Use a circular linked list to implement the queue

use a circular linked list to implement the queue data structure as described in java

  Program to create huffman codes

Write a C++ program to create Huffman codes. Program input is a file called freq.txt (make up your own file for testing) that contains data on the characters in some cleartext file in the form of each character's non-zero frequency of occurrence i..

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