public SpanningTree createSpanningTree()

in src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java [112:130]


    public SpanningTree<V, WE, W> createSpanningTree()
    {
        MutableSpanningTree<V, WE, W> spanningTree = new MutableSpanningTree<V, WE, W>( weightOperations, weightedEdges );

        for ( WE edge : this.predecessors.values() )
        {
            VertexPair<V> vertices = graph.getVertices( edge );

            V head = vertices.getHead();
            V tail = vertices.getTail();

            addEdgeIgnoringExceptions( head, spanningTree );
            addEdgeIgnoringExceptions( tail, spanningTree );

            spanningTree.addEdge( head, graph.getEdge( head, tail ), tail );
        }

        return spanningTree;
    }