Question: UESTION FOUR [12MARKS] a) The Dijkstra's algorithm present below uses the greedy method to compute the shortest route of a graph. Carefully study the algorithm

 UESTION FOUR [12MARKS] a) The Dijkstra's algorithm present below uses the

UESTION FOUR [12MARKS] a) The Dijkstra's algorithm present below uses the greedy method to compute the shortest route of a graph. Carefully study the algorithm and use it to compute the shortest distance/route from a source node, D. [10marks] b) Draw the minimum spanning tree for the graph using Prim's algorithm. [2marks] Algorithm: Dijkstra's-Algorithm (G, w, s) for each vertex v G.V v.d : = v. : = NIL s.d :=0 S:= Q:=G.V while Q= u:= Extract-Min (Q) S:=SU{u} for each vertex v G.adj [u] if v.d>u.d+w(u,v) v.d:=u.d+w(u,v) v.:=u UESTION FOUR [12MARKS] a) The Dijkstra's algorithm present below uses the greedy method to compute the shortest route of a graph. Carefully study the algorithm and use it to compute the shortest distance/route from a source node, D. [10marks] b) Draw the minimum spanning tree for the graph using Prim's algorithm. [2marks] Algorithm: Dijkstra's-Algorithm (G, w, s) for each vertex v G.V v.d : = v. : = NIL s.d :=0 S:= Q:=G.V while Q= u:= Extract-Min (Q) S:=SU{u} for each vertex v G.adj [u] if v.d>u.d+w(u,v) v.d:=u.d+w(u,v) v.:=u

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 Databases Questions!