31 QVector< double > * result = NULL;
32 if ( resultCost != NULL )
38 result =
new QVector<double>();
42 result->insert( result->begin(), source->
vertexCount(), std::numeric_limits<double>::infinity() );
43 ( *result )[ startPointIdx ] = 0.0;
45 if ( resultTree != NULL )
48 resultTree->insert( resultTree->begin(), source->
vertexCount(), -1 );
53 QMultiMap< double, int > not_begin;
54 QMultiMap< double, int >::iterator it;
56 not_begin.insert( 0.0, startPointIdx );
58 while ( !not_begin.empty() )
60 it = not_begin.begin();
61 double curCost = it.key();
62 int curVertex = it.value();
63 not_begin.erase( it );
67 QgsGraphArcIdList::iterator arcIt;
68 for ( arcIt = l.begin(); arcIt != l.end(); ++arcIt )
71 double cost = arc.
property( criterionNum ).toDouble() + curCost;
73 if ( cost < ( *result )[ arc.
inVertex()] )
76 if ( resultTree != NULL )
78 ( *resultTree )[ arc.
inVertex()] = *arcIt;
80 not_begin.insert( cost, arc.
inVertex() );
84 if ( resultCost == NULL )
98 QVector<int> source2result( tree.size(), -1 );
101 source2result[ startVertexIdx ] = treeResult->
addVertex( source->
vertex( startVertexIdx ).
point() );
105 if ( tree[ i ] != -1 )
114 if ( tree[ i ] != -1 )