Package org.apache.commons.collections

Examples of org.apache.commons.collections.PriorityQueue


    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 );
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.PriorityQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.