This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Graph is represented as an adjacency list | |
""" | |
def BFS(self,root): | |
visited = [False]*(len(self.nodes)) | |
queue = [] | |
queue.append(root) | |
visited[root] = True | |
while queue: |