Computer Science, asked by priyankagwpbokaro, 4 months ago

(b) Apply DFS and BFS to complete graph of four vertices. List the vertices in the order they
would be visited.

Answers

Answered by sravyahema123
0

Answer:

b) Apply DFS and BFS to complete graph of four vertices. List the vertices in the order they

would be visited.

Explanation:

b) Apply DFS and BFS to complete graph of four vertices. List the vertices in the order they

would be visited.

Answered by syed2020ashaels
0
  • we have to apply DFS and BFS to complete the graph of 4 vertices.
  • Here we have to use DFS and BFS algorithm to visit 4 vertices of a graph and to list the order in which they are visited.
  • let us consider 4 vertices as GRMD and their routes
  •                      G-----.R------M\\ |\\|\\D
  • DFS is an algorithm for traversing or searching tree or graph  data             structures.The algorithm starts at the root node and explores as far as   possible along each branch before backtracking.
  • G is the source .
  • Starting from G we can visit D and after D there is no value so backtracking occurs.
  • Back tracking is the way in which the route moves to the previous vertex.
  • Then again from G we can visit R and from R we can visit M after M there is no vertex so again backtracking takes place.
  • The route is GDRM.
  • BFS algorithm is used to search a tree or graph data structure for a node that meets a set of criteria.It begins at the root of the tree or graph and investigates all nodes at the current depth level before moving on to nodes at the next depth level.
  • G is the source.
  • Starting from G we can visit R and from R we can visit M after M there is no vertex so backtracking occurs till we reach G and again from G we can visit D .
  • The route is GRMD.

#SPJ2

Similar questions