Implementing the breadth first search algorithm on Graphs to find the shortest path from one node to another