I have to implement a flight map's adjacency list for a airline service and I'm having a lot of trouble understanding how to implement this. I have the readFlightMap method already. Which reads in the data and then calls upon the method below in my 2nd for loop which handles the adjacency list file:
// Inserts information into the flight map to record the fact that the
// adjCity is adjacent to aCity.
// Precondition: aCity and adjCity are valid cities that are served
// by the airline.
// Postcondition: The map will have changed to record the given information
public void insertAdjacent(City aCity, City adjCity)
{
}
My instructor told me to implement a array of linked lists to solve this problem, but this is the picture he showed us in class:
An Array of LinkedLists:
In the | |, the original city positions, then followed by their Adj list.
| Q | -> X<br/>
| X | -> No Adj<br/>
| R | -> X<br/>
| P | ->R ->W<br/>
| W | ->S<br/>
| S | ->T<br/>
| T | ->W<br/>
| Y | ->R ->Z<br/>
| Z | ->No Adj<br/>
I've searched all over google about how to implement this, but I have not discovered anything that helps. He gave us a ADTList based class, but it only has simple things like add, remove, size, etc and it does not handle the implementation that he suggested to us.
I'm lost.