Changeset 1981:81c8efe92706 in lemon-0.x for lemon/dfs.h
- Timestamp:
- 02/23/06 10:03:18 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2574
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/dfs.h
r1956 r1981 574 574 } 575 575 576 ///Runs %DFS algorithm to visit all nodes in the graph. 577 578 ///This method runs the %DFS algorithm in order to 579 ///compute the 580 ///%DFS path to each node. The algorithm computes 581 ///- The %DFS tree. 582 ///- The distance of each node from the root in the %DFS tree. 583 /// 584 ///\note d.run() is just a shortcut of the following code. 585 ///\code 586 /// d.init(); 587 /// for (NodeIt it(graph); it != INVALID; ++it) { 588 /// if (!d.reached(it)) { 589 /// d.addSource(it); 590 /// d.start(); 591 /// } 592 /// } 593 ///\endcode 594 void run() { 595 init(); 596 for (NodeIt it(*G); it != INVALID; ++it) { 597 if (!reached(it)) { 598 addSource(it); 599 start(); 600 } 601 } 602 } 603 576 604 ///Runs %DFS algorithm from node \c s. 577 605 … … 652 680 ///Returns the distance of a node from the root(s). 653 681 ///\pre \ref run() must be called before using this function. 654 ///\warning If node \c v is unreachable from the root(s) then the return value655 /// of this funcion is undefined.682 ///\warning If node \c v is unreachable from the root(s) then the return 683 ///value of this funcion is undefined. 656 684 int dist(Node v) const { return (*_dist)[v]; } 657 685 … … 1441 1469 } 1442 1470 1443 /// \brief Runs %DFS algorithm from node \c s.1471 /// \brief Runs %DFSVisit algorithm from node \c s. 1444 1472 /// 1445 1473 /// This method runs the %DFS algorithm from a root node \c s. … … 1455 1483 start(); 1456 1484 } 1485 1486 /// \brief Runs %DFSVisit algorithm to visit all nodes in the graph. 1487 1488 /// This method runs the %DFS algorithm in order to 1489 /// compute the %DFS path to each node. The algorithm computes 1490 /// - The %DFS tree. 1491 /// - The distance of each node from the root in the %DFS tree. 1492 /// 1493 ///\note d.run() is just a shortcut of the following code. 1494 ///\code 1495 /// d.init(); 1496 /// for (NodeIt it(graph); it != INVALID; ++it) { 1497 /// if (!d.reached(it)) { 1498 /// d.addSource(it); 1499 /// d.start(); 1500 /// } 1501 /// } 1502 ///\endcode 1503 void run() { 1504 init(); 1505 for (NodeIt it(*_graph); it != INVALID; ++it) { 1506 if (!reached(it)) { 1507 addSource(it); 1508 start(); 1509 } 1510 } 1511 } 1457 1512 ///@} 1458 1513
Note: See TracChangeset
for help on using the changeset viewer.