Take the code you wrote for the ford-fulkerson algorithm

Assignment Help C/C++ Programming
Reference no: EM13550445

Take the code you wrote for the Ford-Fulkerson algorithm for the maximum flow on a directed graph with capacities, and implement scaling on top of this code. You write a function

void maximum flow scale(int n, int s, int t, int *capacity, int *flow)

with the same arguments as the function maximum flow in Homework 3:

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

Scaling is a method to speed up the Ford-Fulkerson Algorithm for flows with large integer capacities. You construct a sequence of auxiliary capacities CAPi

from the original

capacities CAP0 by halving all capacities (integer division: rounding downward). Let CAPk be the last of these matrices which is not all zero. You solve first the problem with capacities

CAPk with your Ford-Fulkerson code; then you take the flow you found, double all flow values,and take that as initial flow for the capacities CAPk−1, and solve the problem for those capacities. You continue this doubling until you are back at the original 

capacities. Since each step has a cut of size at most n − 1, each of the intermediate flow problems can augment at most n − 1 times, and there are only log(MaximumCapacity) many intermediate problems.

Reference no: EM13550445

Questions Cloud

Wave speed for transverse traveling waves on the string : A string on a musical instrument vibrates in its fundamental mode with nodes on either end. The length of the vibrating segment is 0.39 m. The maximum transverse velocity at a point in the middle of the string is 3.8 m/s and the maximum transverse ac..
What is moment of inertia of each rod about axis of rotation : A ceiling fan consists of a small cylindrical disk with 5 thin rods coming from the center. The disk has mass md = 3.3 kg and radius R = 0.22 m. The rods each have mass mr = 1.2 kg and length L = 0.76 m. 1) What is the moment of inertia of each rod a..
What is the moment of inertia of the whole ceiling fan : A ceiling fan consists of a small cylindrical disk with 5 thin rods coming from the center. The disk has mass md = 3.3 kg and radius R = 0.22 m. The rods each have mass mr = 1.2 kg and length L = 0.76 m.3) What is the moment of inertia of the whole c..
Time value of money practice problems : Time Value of Money Practice Problems, Calculate the total dollars accumulated at the end of thirty years if you invest $1,000 per year starting today at 8% per year.
Take the code you wrote for the ford-fulkerson algorithm : Take the code you wrote for the Ford-Fulkerson algorithm for the maximum flow on a directed graph with capacities, and implement scaling on top of this code. You write a function
Determine the maximum compression of the spring mounted : The 30-Mg freight car A and 15-Mg freight car B are moving toward each other with the velocities VA= 20 km/h to the right and VB= 10 km/h to the left. the spring constant on car A is k= 3MN/m.
Calculate the couple c a that must be supplied by the : The table lamp consists of two uniform arms, each weighing 0.8 lb, and a 2-lb bulb fixture. If ? = 16? , calculate the couple C A that must be supplied by the friction in joint A.
Determine which of the following statements is true : The velocity and pressure are given at two points in the flow field. Assume that the two points lie in a horizontal plane and that the fluid density is uniform in the flow field and is equal to 1000 kg/m^3. assume steady flow. Then, given these data,..
What are the spcs83 coordinates and convergence angle : What are the SPCS83 coordinates and convergence angle for a station in the Colorado Central zone with geodetic coordinates of 39° 44’ 40.74141”N, 105° 00’ 07.48466”W

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Performs a binary search instead of a linear search.

Modify the following program so it performs a binary search instead of a linear search. Use the selection sort algorithm to sort the array before the binary search is performed.

  In this assignment you have to implement and test a public

in this assignment you have to implement and test a public transport fare ticketing system. you will need to

  What constructors do and when they are executed

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  Write a program that calculates the average rainfall

Write a program that asks the user to enter five floating-point numbers. The program should create a file and save all five numbers to the file.

  Question 1 what basic differences exist between the

question 1 what fundamental differences exist between object-oriented and relational database systems?question 2

  Calculate and display the number of units of electricity

The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.

  Directiontechnical paper memory managementthe intent of

directiontechnical paper memory managementthe intent of this paper is to provide you with an in depth knowledge of how

  What are the primary differences between object-oriented

1. what is instruction explosion?2. what are the primary differences between object-oriented programming languages and

  Design is known, what advantages does keeping

Given that the design is known, what advantages does keeping the source code unavailable give the company and those who purchase the software? What disadvantages does it cause?

  Develop a class airborne location

develop a class AirborneLocation that represents the location of airplanes with respect to a reference radar location. Each AirborneLocation object should include data member for aircraftID (integer),

  Write a program that uses joptionpanes to perform

For example, if the distance of travel is 30 kilometers, the time of travel is 2 hours, then the speed is 30/2 = 15 (kilometers per hour).

  This program will simulate the game of hearts

This program will simulate the game of Hearts, which is a four-player trick-taking game using any ordinary deck of playing cards. Each player is dealt thirteen cards. Whoever is dealt the Two of Clubs must lead it to the first trick. Each person p..

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