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

  Program that prompts the user to enter the weight of person

The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly.

  Matching program that takes input from a text file

need to make a string matching program that takes input from a text file and outputs that match (if there is one) asked from the user. i have done this part , the only problem is that , with the output match , i also need to print some words before a..

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  In this program you will implement a simple reverse polish

in this program you will implement a simple reverse polish notation rpn calculator. rpn is a notation in which

  Use the top-down modular approach to design program

Use the top-down modular approach and pseudocode to design a suitable program to solve it. Where appropriate, use defensive programming techniques.

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Write a program that will read in 4 test scores per line

Write a program that will read in 4 test scores per line. Print the total number of points earned, your program should work for any number of lines of data.

  Write a complete c program to do the following1 the main

write a complete c program to do the following1. the main program will read in a parameter value n read this in main.

  Display the average and save the average to the file

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.

  Write a program that prompts the user to input the masses

Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies.

  Implement the vector class using inheritance

Is it better to implement the Vector class using inheritance (is-a relationship) or composition (has-a relationship). In other word, which one of the following gives a better implementation?

  Using an appropriatenbspcnbspsyntax write the code required

using an appropriatenbspcnbspsyntax write the code required to analyse and display the data as per the problem

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