The node list gets generated correctly now using breadth first algorithm