src/lemon/dijkstra.h
changeset 1354 5cb32ce3236a
parent 1283 fc20371677b9
child 1359 1581f961cfaa
equal deleted inserted replaced
16:2778cf420fd5 17:af7413d09853
   597     ///\pre init() must be called and at least one node should be added
   597     ///\pre init() must be called and at least one node should be added
   598     ///with addSource() before using this function.
   598     ///with addSource() before using this function.
   599     ///
   599     ///
   600     ///\param nm must be a bool (or convertible) node map. The algorithm
   600     ///\param nm must be a bool (or convertible) node map. The algorithm
   601     ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>.
   601     ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>.
   602     template<class NM>
   602     template<class NodeBoolMap>
   603     void start(const NM &nm)
   603     void start(const NodeBoolMap &nm)
   604     {
   604     {
   605       while ( !_heap.empty() && !nm[_heap.top()] ) processNextNode();
   605       while ( !_heap.empty() && !nm[_heap.top()] ) processNextNode();
   606       if ( !_heap.empty() ) finalizeNodeData(_heap.top(),_heap.prio());
   606       if ( !_heap.empty() ) finalizeNodeData(_heap.top(),_heap.prio());
   607     }
   607     }
   608     
   608     
   952     ///The node can be given by the \ref source function.
   952     ///The node can be given by the \ref source function.
   953     void run()
   953     void run()
   954     {
   954     {
   955       if(Base::_source==INVALID) throw UninitializedParameter();
   955       if(Base::_source==INVALID) throw UninitializedParameter();
   956       Dijkstra<Graph,LengthMap,TR> 
   956       Dijkstra<Graph,LengthMap,TR> 
   957 	Dij(*(Graph*)Base::_g,*(LengthMap*)Base::_length);
   957 	dij(*(Graph*)Base::_g,*(LengthMap*)Base::_length);
   958       if(Base::_pred) Dij.predMap(*(PredMap*)Base::_pred);
   958       if(Base::_pred) dij.predMap(*(PredMap*)Base::_pred);
   959 //       if(Base::_predNode) Dij.predNodeMap(*(PredNodeMap*)Base::_predNode);
   959 //       if(Base::_predNode) Dij.predNodeMap(*(PredNodeMap*)Base::_predNode);
   960       if(Base::_dist) Dij.distMap(*(DistMap*)Base::_dist);
   960       if(Base::_dist) dij.distMap(*(DistMap*)Base::_dist);
   961       Dij.run(Base::_source);
   961       dij.run(Base::_source);
   962     }
   962     }
   963 
   963 
   964     ///Runs Dijkstra algorithm from the given node.
   964     ///Runs Dijkstra algorithm from the given node.
   965 
   965 
   966     ///Runs Dijkstra algorithm from the given node.
   966     ///Runs Dijkstra algorithm from the given node.