t7 - CS3230 Tutorial 7 1. Consider the following undirected...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS3230 Tutorial 7 1. Consider the following undirected graph. G = ( V,E ), where the set of vertices is { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 } , and the edges and their weights are given as follows: wt (1 , 2) = 3, wt (1 , 5) = 2, wt (1 , 4) = 10, wt (2 , 3) = 4, wt (2 , 5) = 9, wt (3 , 5) = 6, wt (3 , 6) = 5, wt (4 , 5) = 4, wt (4 , 7) = 4, wt (5 , 6) = 3, wt (5 , 7) = 6, wt (5 , 8) = 2, wt (5 , 9) = 6, wt (6 , 9) = 6, wt (7 , 8) = 8, wt (7 , 10) = 3, wt (8 , 9) = 8, wt (8 , 10) = 3, wt (8 , 11) = 5, wt (8 , 12) = 7, wt (9 , 12) = 4, wt (10 , 11) = 5, wt (11 , 12) = 2 (a) Use Prim’s algorithm to find a minimal spanning tree for the graph. Start with node 1. (b) Use Kruskal’s algorithm to find a minimal spanning tree for the graph. For each of above show your working by giving how the array D and set Rem are modified in each round/loop of the algorithm. 2. Does Dijkstra’s algorithm work if the weights can be negative?...
View Full Document

Page1 / 2

t7 - CS3230 Tutorial 7 1. Consider the following undirected...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online