dfs(gdict' 'when the above code is executedit produces the following resulta breadth first traversal also called breadth first search (bfs)this algorithm traverses graph breadth ward motion and uses queue to remember to get the next vertex to start searchwhen dead end occurs in any iteration please visit this link in our website to understand the details of bfs steps for graph we implement bfs for graph in python using queue data structure discussed earlier when we keep visiting the adjacent unvisited nodes and keep adding it to the queue then we start deque only the node which is left with no unvisited nodes we stop the program when there is no next adjacent node to be visited import collections class graphdef __init__(self,gdict=none)if gdict is nonegdict {self gdict gdict def bfs(graphstartnode)track the visited and unvisited nodes using queue seenqueue set([startnode])collections deque([startnode]while queuevertex queue popleft(marked(vertexfor node in graph[vertex]if node not in seenseen add(nodequeue append(nodedef marked( )print(