From a0ea18b5bfd50e66b5c255920655b771254beff6 Mon Sep 17 00:00:00 2001 From: Shakib Hossain Date: Mon, 15 Oct 2018 23:27:36 +0600 Subject: [PATCH] Remove file fixing merge conflict --- BFS/bfs.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 BFS/bfs.py diff --git a/BFS/bfs.py b/BFS/bfs.py deleted file mode 100644 index 4ef39bbf..00000000 --- a/BFS/bfs.py +++ /dev/null @@ -1,20 +0,0 @@ -import collections - - -def bfs(graph, root): - visited, queue = set(), collections.deque([root]) - # While we still have nodes to visit - while queue: - vertex = queue.popleft() - # Add neighbours of current node to queue if they - # haven't been visited yet and mark them as visited. - for neighbour in graph[vertex]: - if neighbour not in visited: - visited.add(neighbour) - queue.append(neighbour) - - -if __name__ == '__main__': - # sample input format below - graph = {0: [1, 2], 1: [2], 2: []} - bfs(graph, 0)