protected void calculateMSF( boolean isMin,
WeightedGraph graph )
{
PriorityQueue queue = new BinaryHeap( isMin, new WeightedEdgeComparator( graph ) );
chords = new HashSet( graph.getEdges() );
// Fill the Queue with all the edges.
Iterator edges = graph.getEdges().iterator();
while ( edges.hasNext() )
{
queue.insert( edges.next() );
}
// Fill the graph we have with all the Vertexes.
Iterator vertices = graph.getVertices().iterator();
while ( vertices.hasNext() )
{
Vertex v = (Vertex) vertices.next();
labels.put( v, new Label() );
addVertex( v );
}
// Bring the edges out in the right order.
while ( !queue.isEmpty() )
{
Edge e = (Edge) queue.pop();
if ( connectsLabels( graph, e ) )
{
addEdge( graph, e );
}