
Please show your complete solution. Thank you!
First, represent each problem by drawing a weighted graph. Label the vertices and indicate the weight of each edge. Then solve the problem.
Recall: Greedy
1. Choose a vertex to start at, then travel along the connected edge that has the smallest weight. (If two or more edges have the same weight, pick anyone.)
2. After arriving at the next vertex, travel along the edge of the smallest weight that connects to a vertex not yet visited. Continue this process until you have visited all vertices.
3. Return to the starting vertex.
QUESTION
2. The prices for traveling between five cities in Manila by bus are given in the table.
Represent the travel costs between cities using a weighted graph.
Use the greedy algorithm to find a low-cost route that starts and ends in Baclaran and visits each city. Trace the route. What is the cost for taking this route?
Baclaran | Quiapo | Caloocan | Quezon City | Cubao | |
Baclaran | 0 | 16 | 25 | 49 | 74 |
Quiapo | 16 | 0 | 20 | 50 | 72 |
Caloocan | 25 | 20 | 0 | 35 | 59 |
Quezon City | 49 | 50 | 35 | 0 | 40 |
Cubao | 74 | 72 | 59 | 40 | 0 |

Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 5 images

- Mark Zuckerberg, the CEO of Facebook, has hired you to lead the Facebook Algorithms Group. He has asked you to use various graph algorithms to analyze the world's largest social network. The Facebook Graph has 2.8 billion vertices, with each vertex being a Facebook user. Two vertices are connected provided those two users are "friends". The first decision you need to make is how you want to model the Facebook graph. Determine whether you should use an adjacency-list representation or an adjacency-matrix representation.arrow_forwardThere are many applications of Shortest Path Algorithm. Consider the problem of solving a jumbled Rubik's Cube in the fewest number of moves. I claim that this problem can be solved using a Shortest Path Algorithm. Determine whether this statement is TRUE or FALSE. NOTE: if you want to check if this statement is TRUE, think about how the Rubik's Cube Problem can be represented as a graph. What are the vertices? Which pairs of vertices are connected with edges? What is your source vertex and what is your destination vertex? How would Dijkstra's Algorithm enable you to find the optimal sequence of moves to solve a jumbled cube in the fewest number of moves?arrow_forwardDon't need to solve question 1. Use the graph in question 1 to solve question 3 part (a). Thanks!arrow_forward
- a) Which edges would you keep for the minimum-weight spanning tree? (Indicate as vertex-vertex — eg. “K-P”... if there were vertices K and P.) b) Describe the algorithm you used to determine the minimum-weight spanning tree above. Did you face any challenges in applying this algorithm?arrow_forwardAlert dont submit AI generated answer.arrow_forwardWith a given graph below, run the Bellman-Ford Algorithm to find the shortest path from node s to all nodes. For example, (0, 100, 23, 300, 50) for (node 1, node 2, node 3, node 4, node 5)arrow_forward
- 3. Given the graph below. Illustrate Dijkstra algorithm to find the shortest path from vertex s as the source. G 10 15 2 2 5 darrow_forwardBuild the d table for the following graph if you use the breadth first search and start from node s. Remember that we use the alphabetical order rule Assume the blanks/boxes are for the following nodes. Each blank/box is for one node. starting from node r followed by s, t, u, v, w, x, and y, respectively. S t и V W yarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





