lemon/belmann_ford.h
changeset 1857 2e3a4481901e
parent 1816 19ee9133a28c
child 1858 a5b6d941ed52
equal deleted inserted replaced
10:5ebb83858e08 11:9fc26109b2ce
   428 	_mask->set(_process[i], false);
   428 	_mask->set(_process[i], false);
   429       }
   429       }
   430       std::vector<Node> nextProcess;
   430       std::vector<Node> nextProcess;
   431       std::vector<Value> values(_process.size());
   431       std::vector<Value> values(_process.size());
   432       for (int i = 0; i < (int)_process.size(); ++i) {
   432       for (int i = 0; i < (int)_process.size(); ++i) {
   433 	values[i] = _dist[_process[i]];
   433 	values[i] = (*_dist)[_process[i]];
   434       }
   434       }
   435       for (int i = 0; i < (int)_process.size(); ++i) {
   435       for (int i = 0; i < (int)_process.size(); ++i) {
   436 	for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
   436 	for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
   437 	  Node target = graph->target(it);
   437 	  Node target = graph->target(it);
   438 	  Value relaxed = OperationTraits::plus(values[i], (*length)[it]);
   438 	  Value relaxed = OperationTraits::plus(values[i], (*length)[it]);
   551     /// \endcode
   551     /// \endcode
   552     void run(Node s) {
   552     void run(Node s) {
   553       init();
   553       init();
   554       addSource(s);
   554       addSource(s);
   555       start();
   555       start();
       
   556     }
       
   557     
       
   558     /// \brief Runs %BelmannFord algorithm with limited path length 
       
   559     /// from node \c s.
       
   560     ///    
       
   561     /// This method runs the %BelmannFord algorithm from a root node \c s
       
   562     /// in order to compute the shortest path with at most \c len edges 
       
   563     /// to each node. The algorithm computes
       
   564     /// - The shortest path tree.
       
   565     /// - The distance of each node from the root.
       
   566     ///
       
   567     /// \note d.run(s, len) is just a shortcut of the following code.
       
   568     /// \code
       
   569     ///  d.init();
       
   570     ///  d.addSource(s);
       
   571     ///  d.limitedStart(len);
       
   572     /// \endcode
       
   573     void run(Node s, int len) {
       
   574       init();
       
   575       addSource(s);
       
   576       limitedStart(len);
   556     }
   577     }
   557     
   578     
   558     ///@}
   579     ///@}
   559 
   580 
   560     /// \name Query Functions
   581     /// \name Query Functions