Homework 4, What does this algorithm do.

Short Description:

In this homework you will evaluate an algorithm to
  1. Trace an algorithm.
  2. Describe the task accomplished by this algorithm.
  3. Argue that the algorithm is correct and discuss performance

This assignment is worth 40 points.

Goals

When you finish this homework, you should have:

Formal Description

Unknown(G = (V,E), s)
// G is a directed graph.
// s ∈ V
// H is a Heap the key is cost.
  1. For each vertex in V
  2. v.parent = unknown
  3. v.cost = ∞
  4. v.status = unknown
  5. H.Insert(v)
  6. EndFor
  7. s.cost = 0
  8. H.DecreaseKey(s)
  9. s.parent = null;
  10. s.status = discovered
  11. While H.Size() > 0
  12. u = H.ExtractMin()
  13. u.status = finished
  14. For each v $\in$ U.Adj()
  15. If v.status ≠ finished
  16. If v.cost > u.cost + w(u,v)
  17. v.parent = u
  18. v.cost = u.cost+w(u,v);
  19. H.DecreaseKey(v)
  20. v.status = discovered
  21. EndIf
  22. EndIf
  23. EndFor
  24. EndWHile
This assumes that the function DecreaseKey has been implemented on the heap. This function requires that the heap be augmented by an an index array. This will allow an item to be located in O(1). After the item is located, its cost is adjusted and HeapifyUp() is called on it. DecreaseKey is $O(\log n)$.

  1. [10 points] Trace this algorithm with the following undirected weighted graph pictured below.
  2. [10 points] What does this algorithm do?
  3. [10 points] The purpose of this algorithm is to find a tree which connects all nodes where the sum of the weights of the edges of the tree is minimized.
  4. [10 points] What is the performance of this algorithm?

Discussion

Please reference any sources you used to accomplish this homework.

Required Files

A word document.

Submission

Submit the assignment to the D2L folder Homework 4 by the due date.