0% found this document useful (0 votes)
3 views1 page

BFS Algorithm Implementation in Python

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

BFS Algorithm Implementation in Python

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#Name : Tushar Santosh Hingmire

#[Link] : 2060
#Batch : AS4
graph ={
'5' : ['3','7'],
'3' : ['2','4'],
'7' : ['8'],
'2' : [],
'4' : ['8'],
'8' : [],
}
visited =[]
queue =[]
def bfs(visited,graph,node):
[Link](node)
[Link](node)

while queue:
m = [Link](0)
print(m,end=" ")

for neighbour in graph[m]:


if neighbour not in visited:
[Link](neighbour)
[Link](neighbour)

print("path of the following algorithm is :")


bfs(visited,graph,'5')

You might also like