Question: IE 2 1 0 8 3 . ( a ) Write a Python function to perform a Breadth - First Search ( BFS ) traversal
IE
a Write a Python function to perform a BreadthFirst Search BFS traversal of the graph starting from a startvertex. The inputs of the function are a graph and the starting vertex. Your function should return a list of vertices visited in the BFS order.
Marks
b Write a Python function to check if there exists a path from a startvertex to a targetvertex in a graph.
Marks
c You are given a graph in Figure in which the vertices are denoted by letters ABCDEF and the edges are represented by lines connecting the vertices. Write down the adjacency list in Python.
Marks
d Write a Python program to use the function in part a to return a list of vertices visited in the BFS order for the graph in part c and the starting vertex A Write down the result of running this program.
Marks
e Write a Python program to use the function in part b to check if there exists a path from A to F in the graph in part c Write down the result of running this program.
Marks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
