This preview shows pages 1–2. Sign up to view the full content.
IE170 Lab #8
Prof. Linderoth
IE 170 – Lab #8: Spanning Trees
Due Date: March 19, 2006. 11AM.
1
Description and Objectives
In this lab, we will implement the wellknown algorithm of Prim to ﬁnd minimum spanning
trees and compare its running time to Kruskal’s algorithm presented in class. Also, we will
use our code to determine the expected distance of a spanning tree of a Euclidean graph on
n
nodes.
Lab Objectives
1. Understand different graph data structures and their representation.
2. Understand how to use the Java Collections to implement graphs
3. Grasp the differences between the wellknown MST algorithms of Kruskal and Prim
4. Have Fun!
Useful Hints
•
A Reasonable template for the graph data structure has been provided.
LOOK
at this
code ﬁrst, and see if you understand what is going on in the code.
2
Prim’s Algorithm
I would suggest that we don’t get too fancy with our priority queue implementation, but
rather implement Prim’s algorithm using data structures like
HashMap<Node, Double> Q = new HashMap<Node, Double>();
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '07
 Ralphs
 Systems Engineering

Click to edit the document details