An implementation of breadth first search algorithm in python