mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
Merge pull request #98 from moun3imy/patch-1
Update Breadth_First_Search.py
This commit is contained in:
commit
efb77ad7c1
|
@ -15,10 +15,10 @@ class GRAPH:
|
|||
|
||||
def bfs(self,s):
|
||||
queue=[s]
|
||||
self.visited[s]=1
|
||||
while len(queue)!=0:
|
||||
x=queue.pop(0)
|
||||
print(x)
|
||||
self.visited[x]=1
|
||||
for i in range(0,self.nodes):
|
||||
if self.graph[x][i]==1 and self.visited[i]==0:
|
||||
queue.append(i)
|
||||
|
|
Loading…
Reference in New Issue
Block a user