Starting from:

$20

maxflow.java

.ANSWER Write a java program that will implement the maximum flow problem discussed in class. The program should read its input from a text file. The input will be in the form of an n x n matrix, where n is the number of nodes in the network. Specifically, input will consist of n lines where each line has a collection of n integers, with each pair of integers separated by a single space. The value in the ith row and the jth column of the matrix represents the capacity of the connection from the ith node to the jth node. A value of -1 indicates that there is no link from node i to node j. Note that the matrix represents a directed network. The output of the program should be the maximum flow that can be produced by the input network. This can be computed from the sum of the outgoing flows from the source or the incoming flows of the sink. The first node will be the network’s source, and the last node will be the network’s sink.

More products