And I have the below method that reads in the above list from a txt file. This adds the list into a multi map adj_list but it is missing this part:

"Note that each path between nodes is listed only once, but each path needs to be added twice to the adjacency list. For example, the file lists a path between Columbus and Chicago on the first line. This needs to be added to the adjacency list for Columbus as a path with a destination of Chicago AND it needs to be added to the adjacency list for Chicago with a destination of Columbus"

So, my question is first is the above method a good way to go about it to start with and if it is how can I modify this method to make it add nodes to my list in both directions instead of just the order of the list?

Edit: To be clearer on what I want.

For example eventually I would have:
SanFrancisco: (LasVegas:1.0), (Seattle:2.0), (Denver:2.0)

because when reading the 3rd line, the list1 array is the Chicago array (as created during the 2nd line). Your token[0] is known (yes, there is already a Columbus entry in the map because of line 1), so you jump straight to adding the (Miame,2.0) distance to the list1 -- the Chicago list.

The following code solves both the above problem and the problem you stated by getting rid of the list outside the while loop and instead fetching the correct list from the map every single time.

public static Map<String, List<Path>> readPathsFromFile(Scanner inFile) {
Map<String, List<Path>> adj_list = new TreeMap<String, List<Path>>();
// You do not need a list here
// ArrayList<Path> list1 = new ArrayList<Path>();
while (inFile.hasNext()){ // TO- DO add parts for both ways.
String input = inFile.nextLine();
String[] token = input.split(",");
// 1.) Take care of 0 -> 1
// Try and fetch the list from your treemap saved under 0
List<Path> token0List = adj_list.get(token[0]);
// If there was no list previously saved, you have a null value now
if(token0List == null){
// since there was no list previously saved,
// create a new (empty) one and save it in the tree
token0List = new ArrayList<Path>();
adj_list.put(token[0], token0List );
}
// At this point of time, you can be sure that the token0List
// exists and is saved correctly in the tree.
// now you only need to add the 0 -> 1 path to the list
// and you are done with this part of the saving.
Path path = new Path(token[1],Double.parseDouble(token[2]));
token0List .add(path); // finish 0 -> 1
// 2.) Take care of 1 -> 0
// same procedure as 0 -> 1, only that you are swapping
// token[0] and token[1]
List<Path> token1List = adj_list.get(token[1]);
if(token1List == null){
token1List = new ArrayList<Path>();
adj_list.put(token[1], token1List );
}
Path path2 = new Path(token[0],Double.parseDouble(token[2]));
token1List .add(path2); // finish 1 -> 0
}
return adj_list;
}

Email codedump link for Reading an adjacency list from a file into a multimap