Data Structures & Algorithms / Data Structures Hamdard University
Data Structures & Algorithms / Data Structures Hamdard University
Hamdard University
LAB SESSION 14
GRAPH ALGORITHM: BREADTH FIRST SEARCH
Objectives:
To understand the concept of breadth first search algorithm.
To understand the implementation of graphs.
Breadth-first search
In graph theory, breadth-first search (BFS) is a strategy for searching in a graph when
search is limited to essentially two operations: (a) visit and inspect a node of a graph;
(b) gain access to visit the nodes that neighbor the currently visited node. The BFS
begins at a root node and inspects all the neighboring nodes. Then for each of those
neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so
on
Lab Task
1. Write a program that implements BFS algorithm for binary tree..