Breadth First Search (BFS) in Python
Tue 30 March 2021
import queue
class BreadthFirstSearch:
def __init__(self, graph):
"""
graph: Graph represntation in the form of an adjecency list.
E.g: `B <- A -> C`, graph = { 'A' : ['B','C'], }
"""
self._graph = graph
def head(self):
# NOTE: In Python 3.7.0 the insertion-order preservation nature of
# dict objects has been declared to …
Category: Snippets [Python]
Read More