Skip to content

# BFS-in-python Breadth-First Search is a recursive algorithm to search all the vertices of a graph or a tree. BFS in python can be implemented by using data structures like a dictionary and lists

Notifications You must be signed in to change notification settings

kb5029/Bfs-in-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

BFS-in-python

Breadth-First Search is a recursive algorithm to search all the vertices of a graph or a tree. BFS in python can be implemented by using data structures like a dictionary and lists.

ALGORITHM

  1. Start by putting any one of the graph’s vertices at the back of the queue.
  2. Now take the front item of the queue and add it to the visited list.
  3. Create a list of that vertex's adjacent nodes. Add those which are not within the visited list to the rear of the queue.
  4. Keep continuing steps two and three till the queue is empty.

OUTPUT

image

About

# BFS-in-python Breadth-First Search is a recursive algorithm to search all the vertices of a graph or a tree. BFS in python can be implemented by using data structures like a dictionary and lists

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages