# Build an implementation of a weighted graph ADT. Use it to compute...

## Question

Build an implementation of a weighted graph ADT.
Use it to compute the shortest distance from two nodes, source and sink.

This is a sample graph on which to run your program; it is not a tree, hence no traversals are needed. You can start developing your program, assuming that the input takes the form of a number of arcs, along with their capacity. for example, if the nodes of the graph are US/CDN airports and the arcs represent airline connections and the capacity represents the seating capacity of different aircrafts (from a boeing 737 with about 120 seats to an airbus 380 with about 500 seats) then the input file may look like:

SFO LAX 120

SFO SEA 220

LAX ORD   500

SFO EWR 320

YVR JFK 220

... etc... and an application of your program would be: how many passengers can be shipped in one day from SFO to EWR via an arbitrary number of intermediate stops...

The output of your program would indicate how many passengers to put on each flight to maximize the flow from SFO to EWR. let me think about the details, but your program should not depend on what data I come up with.

You are free to choose the graph representation that you want. I recommend but do not mandate that you use the adjacency matrix, in which entries are used to store the distance between two nodes.

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class graph {
Vector<node> vertex;
final int max_int = 9999999;
public graph() {
vertex = new Vector<>();
}
/*
@param :String name
create a new node add to vertex
return node that was create
*/
public node addNode(String name){
node n = new node(name);
return vertex.get(vertex.size() - 1);
}

/*
@param : tring sname
return node invertex that has name
return null if no node found
*/
public node getNode(String sname){

for (node object : vertex) {
if (object.name.equals(sname)) {
return object;
}
}

return null;
}...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

# 50% discount

Hours
Minutes
Seconds
\$30.00 \$15.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.