Refactored graph to have an  adjacencyList