Question: It is start with node O Explain , why this nodes are visited in this graph for getting this traversal order : O H R

It is start with node O

Explain , why this nodes are visited in this graph for getting this traversal order : O H R S T C N V A G I B D E F J K L M P Q U

for BFS

graph = {

'A': ['B', 'D'],

'B': ['E', 'F'],

'C': ['A', 'G', 'I'],

'D': ['J'],

'E': ['K', 'L'],

'F': ['M'],

'G': [],

'H': ['T','C'],

'I': [],

'J': ['P', 'Q'],

'K': [],

'L': [],

'M': [],

'N': [],

'O': ['H', 'R', 'S'],

'P': [],

'Q': ['U'],

'R': ['N'],

'S': ['V'],

'T': [],

'U': [],

'V': []

}

next is for DFS : O H C A B E K L F M D J P Q U G I N R S V T

graph = {

'A': ['B', 'D'],

'B': ['E', 'F'],

'C': ['A', 'G', 'I'],

'D': ['J'],

'E': ['K', 'L'],

'F': ['M'],

'G': [],

'H': ['C'],

'I': ['N'],

'J': ['P', 'Q'],

'K': [],

'L': [],

'M': [],

'N': [],

'O': ['H', 'R', 'S'],

'P': [],

'Q': ['U'],

'R': [],

'S': ['V','T'],

'T': [],

'U': [],

'V': []

}

based on this picture

It is start with node O Explain , why this nodes are

\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!