Question

help with alogrthms

Consider the following graph for problems 6, 7, & 8. (b f C d a

(5 points) Starting at vertex a and resolving ties by the vertex alphabetical order, traverse the graph by depth-first search

(5 points) Traverse the graph by breadth-first search and construct the corresponding breadth-first search tree. Start the 8.

Consider the following graph for problems 6, 7, & 8. (b f C d a
(5 points) Starting at vertex a and resolving ties by the vertex alphabetical order, traverse the graph by depth-first search 7. and construct the corresponding depth-first search tree
(5 points) Traverse the graph by breadth-first search and construct the corresponding breadth-first search tree. Start the 8. traversal at vertex a and resolve ties by the vertex alphabetical order.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hello, please comment if there is any more requirement from the question. I will be happy to help. Please give a thumbs up if the solution helped you.

I have considered the alphabet that comes first as of more priority. i.e. b has more priority than c in case of a tie. PLease comment if any doubts.

Aunuer 7 Tuee Awouer BFS Tee

Add a comment
Know the answer?
Add Answer to:
help with alogrthms Consider the following graph for problems 6, 7, & 8. (b f C...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question II - Graph Traversal and Minimum Spanning Trees [40 Points] Consider the following graph: B...

    Question II - Graph Traversal and Minimum Spanning Trees [40 Points] Consider the following graph: B 10 1 4 1 H 9 4 a) Traverse the graph starting from vertex A, and using the Breadth-First Search algorithm. Show the traversal result and the data structure you are using. [10 Points] b) Traverse the graph starting from vertex A, and using the Depth-First Search (Post-order) algorithm. Show the traversal result and the data structure you are using. [10 Points] c) Apply...

  • Consider the following directed graph for each of the problems: 1. Perform a breadth-first search on...

    Consider the following directed graph for each of the problems: 1. Perform a breadth-first search on the graph assuming that the vertices and adjacency lists are listed in alphabetical order. Show the breadth-first search tree that is generated. 2. Perform a depth-first search on the graph assuming that the vertices and adjacency lists are listed in alphabetical order. Classify each edge as tree, back or cross edge. Label each vertex with its start and finish time. 3. Remove all the...

  • 7.[6] Consider the graph G below: a.[3] Find a Depth-First Search tree T for the above...

    7.[6] Consider the graph G below: a.[3] Find a Depth-First Search tree T for the above graph starting with the vertex 0. Show all the vertices as they are discovered in sequence starting from 1 to the last vertex included in T. b.[3] Find a Breadth-First Search tree T for the above graph starting with the vertex 0. Show all the vertices as they are discovered in sequence starting from 1 to the last vertex included in T.

  • In Python 3 please Apply Breadth First Search (BFS) to traverse the following graph. Start your...

    In Python 3 please Apply Breadth First Search (BFS) to traverse the following graph. Start your traversal from vertex 0, and write down the order in which vertices will be visited during the traversal. 1 8 6 7 2 9 5 4 3

  • Consider the simple graph G, given the following: (assume A=0,B=1, C=2, D=3, E=4, F=5, G=6) A...

    Consider the simple graph G, given the following: (assume A=0,B=1, C=2, D=3, E=4, F=5, G=6) A 3 3 8 B D 5 ho 5 8 E F G 4 3 a) Use the Breadth-First Search algorithm to traverse G and give the traverse sequence, starting from A. Assume you always choose the candidate with the SMALLEST index among the candidates at each step. b) Use the Depth-First Search algorithm to traverse G and give the traverse sequence, starting from A....

  • 1. Consider the directed graph on the right side of the following page and complete the...

    1. Consider the directed graph on the right side of the following page and complete the exercises below. When conducting a search, be very careful (since a small error early on can result in a large deduction of marks), and whenever you have a "choice" of which adjacent vertex to consider, you must consider the vertices in numerical order from least to greatest. (10 marks total) a. Provide an adjacency list representation of this graph. b. Compute the depth-first search...

  • Consider the following directed graph, which is given in adjacency list form and where vertexes have...

    Consider the following directed graph, which is given in adjacency list form and where vertexes have numerical labels: 1: 2, 4, 6 2: 4, 5 3: 1, 2, 6, 9 4: 5 5: 4, 7 6: 1, 5, 7 7: 3, 5 8: 2, 6, 7 9: 1, 7 The first line indicates that the graph contains a directed edge from vertex 1 to vertex 2, from 1 to vertex 4, and 1 to 6, and likewise for subsequent lines....

  • 3. (8 points-7+1) Figure 4 shows an undirected graph G. Assume that the adjacency list lists the ...

    3. (8 points-7+1) Figure 4 shows an undirected graph G. Assume that the adjacency list lists the edges in alphabetical order. Figure 3: Graph for P3 (a) Apply depth first search (DFS) to graph G, and show the discovery and finish times of each vertex. In the main-loop of DFS, check the vertices in alphabetical the form dsc/fin, where dsc is the discovery time and fin is the finish time. (b) Draw the DFS tree obtained. 3. (8 points-7+1) Figure...

  • # Problem 4 problem4_breadth_first_traversal = [0,] problem4_depth_first_traversal = [0,] def bfs(g,start): start.set...

    # Problem 4 problem4_breadth_first_traversal = [0,] problem4_depth_first_traversal = [0,] def bfs(g,start): start.setDistance(0) start.setPred(None) vertQueue = Queue() vertQueue.enqueue(start) while (vertQueue.size() > 0): currentVert = vertQueue.dequeue() for nbr in currentVert.getConnections(): if (nbr.getColor() == 'white'): nbr.setColor('gray') nbr.setDistance(currentVert.getDistance() + 1) nbr.setPred(currentVert) vertQueue.enqueue(nbr) currentVert.setColor('black') class DFSGraph(Graph): def __init__(self): super().__init__() self.time = 0 def dfs(self): for aVertex in self: aVertex.setColor('white') aVertex.setPred(-1) for aVertex in self: if aVertex.getColor() == 'white': self.dfsvisit(aVertex) def dfsvisit(self,startVertex): startVertex.setColor('gray') self.time += 1 startVertex.setDiscovery(self.time) for nextVertex in startVertex.getConnections(): if nextVertex.getColor() == 'white': nextVertex.setPred(startVertex)...

  • BFS Given an undirected graph below (a) Show the shortest distance to each vertex from source ver...

    Solve (a) and (b) using BFS and DFS diagram BFS Given an undirected graph below (a) Show the shortest distance to each vertex from source vertex H and predecessor tree on the graph that result from running breadth-finst search (BFS).Choose adjacen vertices in al phabetical order b) Show the start and finsh time for each vertex, starting from source vertex H, that result from running depth-first search (DFS)Choose aljacent vertices in alphabet- ical order DFS BFS Given an undirected graph...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT