Code will be graded on:
- 70% Code quality/Correct usage of programming concepts
- 50% Correct implementation/usage of graph ADT
- 20% Correct implementation of logic/helper methods for application
- 10% Correct answer/Program runs
- 5% Descriptive variable names
- 5% User friendliness (good prompts and outputs)
- 5% Comments (minimum required comments and human readable clarification for any unclear or unintuitive code)
- 5% Proper indentation/formatting
Throughout the semester, we’ve explored various ADTs that are very rigid in nature. Stacks, queues, binary search trees, while extremely useful, are somewhat limited in their application in real world data. The graph data structure is a very flexible ADT that can organize data into connected nodes with virtually no restrictions. Graphs give us a very useful ADT that can facilitate storage and algorithms for map-like data.
Implement and initialize a unweighted, undirected graph to store the information of possible flights between local airports.
Then write a method that will take one parameter for vertex and return a list of adjacent vertices. Write a driver program that tests a few airports to make sure the correct list of adjacent airports is returned.
Sample test code:
ArrayList<String> airportList = new ArrayList<>();
Airports airports = new Airports(airportList);
- print the adjacency list representation of
- the whole graph
- print the adjacency of selected airports printAdjacent(”PHL”); airports.printAdjacent(”ILG”);
Printing whole graph as adjacency list:
ILG IAD EWR
JFK ILG PHL EWR
Adjacency list of airport PHL
ILG IAD EWR
Adjacency list of airport ILG