Changes in lemon/dfs.h [287:bb40b6db0a58:281:e9b4fbe163f5] in lemon-1.0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/dfs.h
r287 r281 556 556 /// 557 557 ///This method runs the %DFS algorithm from the root node 558 ///in order to compute the DFS path to \c t.558 ///in order to compute the DFS path to \c dest. 559 559 /// 560 560 ///The algorithm computes 561 ///- the %DFS path to \c t,562 ///- the distance of \c t from the root in the %DFS tree.561 ///- the %DFS path to \c dest, 562 ///- the distance of \c dest from the root in the %DFS tree. 563 563 /// 564 564 ///\pre init() must be called and a root node should be 565 565 ///added with addSource() before using this function. 566 void start(Node t)567 { 568 while ( !emptyQueue() && G->target(_stack[_stack_head])!= t )566 void start(Node dest) 567 { 568 while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest ) 569 569 processNextArc(); 570 570 } … … 596 596 } 597 597 598 ///Runs the algorithm from the given sourcenode.598 ///Runs the algorithm from the given node. 599 599 600 600 ///This method runs the %DFS algorithm from node \c s … … 620 620 621 621 ///This method runs the %DFS algorithm from node \c s 622 ///in order to compute the DFS path to node \c t623 /// (it stops searching when \c t is processed)624 /// 625 /// \return \c true if \c t is reachable form \c s.622 ///in order to compute the DFS path to \c t. 623 /// 624 ///\return The length of the <tt>s</tt>--<tt>t</tt> DFS path, 625 ///if \c t is reachable form \c s, \c 0 otherwise. 626 626 /// 627 627 ///\note Apart from the return value, <tt>d.run(s,t)</tt> is … … 632 632 /// d.start(t); 633 633 ///\endcode 634 boolrun(Node s,Node t) {634 int run(Node s,Node t) { 635 635 init(); 636 636 addSource(s); 637 637 start(t); 638 return reached(t) ;638 return reached(t)?_stack_head+1:0; 639 639 } 640 640 … … 1522 1522 /// 1523 1523 /// This method runs the %DFS algorithm from the root node 1524 /// in order to compute the DFS path to \c t.1524 /// in order to compute the DFS path to \c dest. 1525 1525 /// 1526 1526 /// The algorithm computes 1527 /// - the %DFS path to \c t,1528 /// - the distance of \c t from the root in the %DFS tree.1527 /// - the %DFS path to \c dest, 1528 /// - the distance of \c dest from the root in the %DFS tree. 1529 1529 /// 1530 1530 /// \pre init() must be called and a root node should be added 1531 1531 /// with addSource() before using this function. 1532 void start(Node t) {1533 while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )1532 void start(Node dest) { 1533 while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest ) 1534 1534 processNextArc(); 1535 1535 } … … 1560 1560 } 1561 1561 1562 /// \brief Runs the algorithm from the given sourcenode.1562 /// \brief Runs the algorithm from the given node. 1563 1563 /// 1564 1564 /// This method runs the %DFS algorithm from node \c s. … … 1584 1584 1585 1585 /// This method runs the %DFS algorithm from node \c s 1586 /// in order to compute the DFS path to node \c t1587 /// (it stops searching when \c t is processed).1588 /// 1589 /// \return \c true if \c t is reachable form \c s.1586 /// in order to compute the DFS path to \c t. 1587 /// 1588 /// \return The length of the <tt>s</tt>--<tt>t</tt> DFS path, 1589 /// if \c t is reachable form \c s, \c 0 otherwise. 1590 1590 /// 1591 1591 /// \note Apart from the return value, <tt>d.run(s,t)</tt> is … … 1596 1596 /// d.start(t); 1597 1597 ///\endcode 1598 boolrun(Node s,Node t) {1598 int run(Node s,Node t) { 1599 1599 init(); 1600 1600 addSource(s); 1601 1601 start(t); 1602 return reached(t) ;1602 return reached(t)?_stack_head+1:0; 1603 1603 } 1604 1604
Note: See TracChangeset
for help on using the changeset viewer.