Changeset 2439:3f1c7a6c33cd in lemon-0.x for lemon
- Timestamp:
- 05/07/07 10:49:57 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3276
- Location:
- lemon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/dfs.h
r2391 r2439 565 565 /// 566 566 ///\param em must be a bool (or convertible) edge map. The algorithm 567 ///will stop when it reaches an edge \c e with \code em[e]==true \endcode. 568 /// 569 ///\warning Contrary to \ref Dfs and \ref Dijkstra, \c em is an edge map, 567 ///will stop when it reaches an edge \c e with <tt>em[e]==true<\tt>. 568 /// 569 ///\return The reached edge \c e with <tt>em[e]==true<\tt> or 570 ///\c INVALID if no such edge was found. 571 /// 572 ///\warning Contrary to \ref Bfs and \ref Dijkstra, \c em is an edge map, 570 573 ///not a node map. 571 574 template<class EM> 572 void start(const EM &em) 573 { 574 while ( !emptyQueue() && !em[_stack[_stack_head]] ) processNextEdge(); 575 Edge start(const EM &em) 576 { 577 while ( !emptyQueue() && !em[_stack[_stack_head]] ) 578 processNextEdge(); 579 return emptyQueue() ? INVALID : _stack[_stack_head]; 575 580 } 576 581 … … 1442 1447 /// with addSource() before using this function. 1443 1448 void start(Node dest) { 1444 while ( !emptyQueue() && _graph->target(_stack[_stack_head]) != dest )1449 while ( !emptyQueue() && _graph->target(_stack[_stack_head]) != dest ) 1445 1450 processNextEdge(); 1446 1451 } … … 1454 1459 /// 1455 1460 /// \param em must be a bool (or convertible) edge map. The algorithm 1456 /// will stop when it reaches an edge \c e with \code nm[e]==true \endcode. 1457 /// 1458 /// \warning Contrary to \ref Dfs and \ref Dijkstra, \c em is an edge map, 1461 /// will stop when it reaches an edge \c e with <tt>em[e]==true<\tt>. 1462 /// 1463 ///\return The reached edge \c e with <tt>em[e]==true<\tt> or 1464 ///\c INVALID if no such edge was found. 1465 /// 1466 /// \warning Contrary to \ref Bfs and \ref Dijkstra, \c em is an edge map, 1459 1467 /// not a node map. 1460 1468 template <typename EM> 1461 void start(const EM &em) { 1462 while (!emptyQueue() && !em[_stack[_stack_head]]) processNextEdge(); 1469 Edge start(const EM &em) { 1470 while ( !emptyQueue() && !em[_stack[_stack_head]] ) 1471 processNextEdge(); 1472 return emptyQueue() ? INVALID : _stack[_stack_head]; 1463 1473 } 1464 1474 -
lemon/dijkstra.h
r2391 r2439 602 602 Node nextNode() 603 603 { 604 return _heap->empty()?_heap->top():INVALID;604 return !_heap->empty()?_heap->top():INVALID; 605 605 } 606 606 … … 665 665 ///\param nm must be a bool (or convertible) node map. The algorithm 666 666 ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>. 667 /// 668 ///\return The reached node \c v with <tt>nm[v]==true<\tt> or 669 ///\c INVALID if no such node was found. 667 670 template<class NodeBoolMap> 668 voidstart(const NodeBoolMap &nm)671 Node start(const NodeBoolMap &nm) 669 672 { 670 673 while ( !_heap->empty() && !nm[_heap->top()] ) processNextNode(); 671 if ( !_heap->empty() ) finalizeNodeData(_heap->top(),_heap->prio()); 674 if ( _heap->empty() ) return INVALID; 675 finalizeNodeData(_heap->top(),_heap->prio()); 676 return _heap->top(); 672 677 } 673 678
Note: See TracChangeset
for help on using the changeset viewer.