advertisement

CS330 Introduction to Algorithms November 5, 2012 Spanning trees, single source shortest paths Kruskal's algorithm for nding minimum weight spanning trees is a greedy-type algorithm, where at every iteration a set of connected components of the graph is maintained. In every step we add an edge of minimum weight that connects two disjoint components. Prim's algorithm is another greedy-type algorithm for nding minimum weight spanning trees. We start building a tree in the graph from an arbitrary node. In every step we add a minimum weight edge to the tree that connects the current tree to a node that is not part of the tree yet. 1. Put the following growth rates in non-decreasing order. √ Θ(n!), Θ(n100! ), Θ((log n)100! ), Θ(nn ), Θ( n!) 2. Find a minimum total weight spanning tree in the graph in Figure 1 using one of the above algorithms. 3. Show an example of a graph and its minimum weight spanning tree, such that traversing the tree form node u to v is not always the shortest paths between u and v . (Hint: consider a simple cycle.) 4. Find the length of all shortest paths form node A to all other nodes in Figure 2. (You don't have to use a certain algorithm, just use your best judgement.) Draw the edges that are used in at least one of the shortest paths. What can you say about the properties of this graph?