Breadth First Search algorithm in general terms


****************************************************

Input :
     Un weighted graph
     Beginning vertex -v
Output :
     The visited vertices.
Data structures used :Queue to store the vertices
****************************************************

ALGORITHM:

1)Lable vertex v as reached.
2)Initialize Q to be a queue with only v in it.
3)while Q is not empty repeate through steps 4 , 5 & 6.
4)Delete a vertex w from the queue.
5)for all vertices u adjacent from w repeate through steps 6.
6)if u has not been labeled add u to the queue Q , lable u as reached.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s