Changed nodeList and edgeList to HashMap
This makes the searching easier and reduces the complexity of Assign
neighbours from O(n^2) to O(n)