0
3
0
... | ... |
@@ -82,3 +82,4 @@ |
82 | 82 |
|
83 |
///The type of the map that indicates which nodes are reached. |
|
83 |
///The type of the map that indicates which nodes are reached. |
|
84 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
84 | 85 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
... | ... |
@@ -120,9 +121,3 @@ |
120 | 121 |
///\tparam GR The type of the digraph the algorithm runs on. |
121 |
///The default value is \ref ListDigraph. The value of GR is not used |
|
122 |
///directly by \ref Bfs, it is only passed to \ref BfsDefaultTraits. |
|
123 |
///\tparam TR Traits class to set various data types used by the algorithm. |
|
124 |
///The default traits class is |
|
125 |
///\ref BfsDefaultTraits "BfsDefaultTraits<GR>". |
|
126 |
///See \ref BfsDefaultTraits for the documentation of |
|
127 |
/// |
|
122 |
///The default type is \ref ListDigraph. |
|
128 | 123 |
#ifdef DOXYGEN |
... | ... |
@@ -152,3 +147,3 @@ |
152 | 147 |
|
153 |
///The traits class. |
|
148 |
///The \ref BfsDefaultTraits "traits class" of the algorithm. |
|
154 | 149 |
typedef TR Traits; |
... | ... |
@@ -214,3 +209,3 @@ |
214 | 209 |
|
215 |
///\name Named |
|
210 |
///\name Named Template Parameters |
|
216 | 211 |
|
... | ... |
@@ -232,2 +227,3 @@ |
232 | 227 |
///PredMap type. |
228 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
233 | 229 |
template <class T> |
... | ... |
@@ -251,2 +247,3 @@ |
251 | 247 |
///DistMap type. |
248 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
252 | 249 |
template <class T> |
... | ... |
@@ -270,2 +267,3 @@ |
270 | 267 |
///ReachedMap type. |
268 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
271 | 269 |
template <class T> |
... | ... |
@@ -289,2 +287,3 @@ |
289 | 287 |
///ProcessedMap type. |
288 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
290 | 289 |
template <class T> |
... | ... |
@@ -341,5 +340,6 @@ |
341 | 340 |
///Sets the map that stores the predecessor arcs. |
342 |
///If you don't use this function before calling \ref run(), |
|
343 |
///it will allocate one. The destructor deallocates this |
|
344 |
/// |
|
341 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
342 |
///or \ref init(), an instance will be allocated automatically. |
|
343 |
///The destructor deallocates this automatically allocated map, |
|
344 |
///of course. |
|
345 | 345 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -358,5 +358,6 @@ |
358 | 358 |
///Sets the map that indicates which nodes are reached. |
359 |
///If you don't use this function before calling \ref run(), |
|
360 |
///it will allocate one. The destructor deallocates this |
|
361 |
/// |
|
359 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
360 |
///or \ref init(), an instance will be allocated automatically. |
|
361 |
///The destructor deallocates this automatically allocated map, |
|
362 |
///of course. |
|
362 | 363 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -375,5 +376,6 @@ |
375 | 376 |
///Sets the map that indicates which nodes are processed. |
376 |
///If you don't use this function before calling \ref run(), |
|
377 |
///it will allocate one. The destructor deallocates this |
|
378 |
/// |
|
377 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
378 |
///or \ref init(), an instance will be allocated automatically. |
|
379 |
///The destructor deallocates this automatically allocated map, |
|
380 |
///of course. |
|
379 | 381 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -393,5 +395,6 @@ |
393 | 395 |
///the algorithm. |
394 |
///If you don't use this function before calling \ref run(), |
|
395 |
///it will allocate one. The destructor deallocates this |
|
396 |
/// |
|
396 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
397 |
///or \ref init(), an instance will be allocated automatically. |
|
398 |
///The destructor deallocates this automatically allocated map, |
|
399 |
///of course. |
|
397 | 400 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -409,11 +412,9 @@ |
409 | 412 |
|
410 |
///\name Execution control |
|
411 |
///The simplest way to execute the algorithm is to use |
|
412 |
///one of the member functions called \ref lemon::Bfs::run() "run()". |
|
413 |
///\n |
|
414 |
///If you need more control on the execution, first you must call |
|
415 |
///\ref lemon::Bfs::init() "init()", then you can add several source |
|
416 |
///nodes with \ref lemon::Bfs::addSource() "addSource()". |
|
417 |
///Finally \ref lemon::Bfs::start() "start()" will perform the |
|
418 |
/// |
|
413 |
///\name Execution Control |
|
414 |
///The simplest way to execute the BFS algorithm is to use one of the |
|
415 |
///member functions called \ref run(Node) "run()".\n |
|
416 |
///If you need more control on the execution, first you have to call |
|
417 |
///\ref init(), then you can add several source nodes with |
|
418 |
///\ref addSource(). Finally the actual path computation can be |
|
419 |
///performed with one of the \ref start() functions. |
|
419 | 420 |
|
... | ... |
@@ -421,6 +422,5 @@ |
421 | 422 |
|
423 |
///\brief Initializes the internal data structures. |
|
424 |
/// |
|
422 | 425 |
///Initializes the internal data structures. |
423 |
|
|
424 |
///Initializes the internal data structures. |
|
425 |
/// |
|
426 | 426 |
void init() |
... | ... |
@@ -558,7 +558,6 @@ |
558 | 558 |
|
559 |
///\brief Returns \c false if there are nodes |
|
560 |
///to be processed. |
|
561 |
/// |
|
562 |
///Returns \c false if there are nodes |
|
563 |
///to be processed |
|
559 |
///Returns \c false if there are nodes to be processed. |
|
560 |
|
|
561 |
///Returns \c false if there are nodes to be processed |
|
562 |
///in the queue. |
|
564 | 563 |
bool emptyQueue() const { return _queue_tail==_queue_head; } |
... | ... |
@@ -567,3 +566,4 @@ |
567 | 566 |
|
568 |
///Returns the number of the nodes to be processed |
|
567 |
///Returns the number of the nodes to be processed |
|
568 |
///in the queue. |
|
569 | 569 |
int queueSize() const { return _queue_head-_queue_tail; } |
... | ... |
@@ -732,6 +732,6 @@ |
732 | 732 |
///\name Query Functions |
733 |
///The |
|
733 |
///The results of the BFS algorithm can be obtained using these |
|
734 | 734 |
///functions.\n |
735 |
///Either \ref lemon::Bfs::run() "run()" or \ref lemon::Bfs::start() |
|
736 |
///"start()" must be called before using them. |
|
735 |
///Either \ref run(Node) "run()" or \ref start() should be called |
|
736 |
///before using them. |
|
737 | 737 |
|
... | ... |
@@ -743,6 +743,6 @@ |
743 | 743 |
/// |
744 |
///\warning \c t should be |
|
744 |
///\warning \c t should be reached from the root(s). |
|
745 | 745 |
/// |
746 |
///\pre Either \ref run() or \ref start() must be called before |
|
747 |
///using this function. |
|
746 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
747 |
///must be called before using this function. |
|
748 | 748 |
Path path(Node t) const { return Path(*G, *_pred, t); } |
... | ... |
@@ -753,7 +753,7 @@ |
753 | 753 |
/// |
754 |
///\warning If node \c v is not |
|
754 |
///\warning If node \c v is not reached from the root(s), then |
|
755 | 755 |
///the return value of this function is undefined. |
756 | 756 |
/// |
757 |
///\pre Either \ref run() or \ref start() must be called before |
|
758 |
///using this function. |
|
757 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
758 |
///must be called before using this function. |
|
759 | 759 |
int dist(Node v) const { return (*_dist)[v]; } |
... | ... |
@@ -764,4 +764,4 @@ |
764 | 764 |
///tree for the node \c v, i.e. it returns the last arc of a |
765 |
///shortest path from the root(s) to \c v. It is \c INVALID if \c v |
|
766 |
///is not reachable from the root(s) or if \c v is a root. |
|
765 |
///shortest path from a root to \c v. It is \c INVALID if \c v |
|
766 |
///is not reached from the root(s) or if \c v is a root. |
|
767 | 767 |
/// |
... | ... |
@@ -770,4 +770,4 @@ |
770 | 770 |
/// |
771 |
///\pre Either \ref run() or \ref start() must be called before |
|
772 |
///using this function. |
|
771 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
772 |
///must be called before using this function. |
|
773 | 773 |
Arc predArc(Node v) const { return (*_pred)[v];} |
... | ... |
@@ -778,4 +778,4 @@ |
778 | 778 |
///tree for the node \c v, i.e. it returns the last but one node |
779 |
///from a shortest path from the root(s) to \c v. It is \c INVALID |
|
780 |
///if \c v is not reachable from the root(s) or if \c v is a root. |
|
779 |
///from a shortest path from a root to \c v. It is \c INVALID |
|
780 |
///if \c v is not reached from the root(s) or if \c v is a root. |
|
781 | 781 |
/// |
... | ... |
@@ -784,4 +784,4 @@ |
784 | 784 |
/// |
785 |
///\pre Either \ref run() or \ref start() must be called before |
|
786 |
///using this function. |
|
785 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
786 |
///must be called before using this function. |
|
787 | 787 |
Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID: |
... | ... |
@@ -795,3 +795,3 @@ |
795 | 795 |
/// |
796 |
///\pre Either \ref run() or \ref init() |
|
796 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
797 | 797 |
///must be called before using this function. |
... | ... |
@@ -805,3 +805,3 @@ |
805 | 805 |
/// |
806 |
///\pre Either \ref run() or \ref init() |
|
806 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
807 | 807 |
///must be called before using this function. |
... | ... |
@@ -809,6 +809,7 @@ |
809 | 809 |
|
810 |
///Checks if a node is |
|
810 |
///Checks if a node is reached from the root(s). |
|
811 | 811 |
|
812 |
///Returns \c true if \c v is reachable from the root(s). |
|
813 |
///\pre Either \ref run() or \ref start() |
|
812 |
///Returns \c true if \c v is reached from the root(s). |
|
813 |
/// |
|
814 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
814 | 815 |
///must be called before using this function. |
... | ... |
@@ -958,4 +959,4 @@ |
958 | 959 |
/// \ref bfs() "function-type interface" of \ref Bfs algorithm. |
959 |
/// It does not have own \ref run() method, it uses the functions |
|
960 |
/// and features of the plain \ref Bfs. |
|
960 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
|
961 |
/// functions and features of the plain \ref Bfs. |
|
961 | 962 |
/// |
... | ... |
@@ -1179,3 +1180,3 @@ |
1179 | 1180 |
///\endcode |
1180 |
///\warning Don't forget to put the \ref BfsWizard::run() "run()" |
|
1181 |
///\warning Don't forget to put the \ref BfsWizard::run(Node) "run()" |
|
1181 | 1182 |
///to the end of the parameter list. |
... | ... |
@@ -1365,3 +1366,3 @@ |
1365 | 1366 |
|
1366 |
/// \name Named |
|
1367 |
/// \name Named Template Parameters |
|
1367 | 1368 |
|
... | ... |
@@ -1407,5 +1408,6 @@ |
1407 | 1408 |
/// Sets the map that indicates which nodes are reached. |
1408 |
/// If you don't use this function before calling \ref run(), |
|
1409 |
/// it will allocate one. The destructor deallocates this |
|
1410 |
/// |
|
1409 |
/// If you don't use this function before calling \ref run(Node) "run()" |
|
1410 |
/// or \ref init(), an instance will be allocated automatically. |
|
1411 |
/// The destructor deallocates this automatically allocated map, |
|
1412 |
/// of course. |
|
1411 | 1413 |
/// \return <tt> (*this) </tt> |
... | ... |
@@ -1422,12 +1424,9 @@ |
1422 | 1424 |
|
1423 |
/// \name Execution control |
|
1424 |
/// The simplest way to execute the algorithm is to use |
|
1425 |
/// one of the member functions called \ref lemon::BfsVisit::run() |
|
1426 |
/// "run()". |
|
1427 |
/// \n |
|
1428 |
/// If you need more control on the execution, first you must call |
|
1429 |
/// \ref lemon::BfsVisit::init() "init()", then you can add several |
|
1430 |
/// source nodes with \ref lemon::BfsVisit::addSource() "addSource()". |
|
1431 |
/// Finally \ref lemon::BfsVisit::start() "start()" will perform the |
|
1432 |
/// actual path computation. |
|
1425 |
/// \name Execution Control |
|
1426 |
/// The simplest way to execute the BFS algorithm is to use one of the |
|
1427 |
/// member functions called \ref run(Node) "run()".\n |
|
1428 |
/// If you need more control on the execution, first you have to call |
|
1429 |
/// \ref init(), then you can add several source nodes with |
|
1430 |
/// \ref addSource(). Finally the actual path computation can be |
|
1431 |
/// performed with one of the \ref start() functions. |
|
1433 | 1432 |
|
... | ... |
@@ -1731,13 +1730,14 @@ |
1731 | 1730 |
/// \name Query Functions |
1732 |
/// The |
|
1731 |
/// The results of the BFS algorithm can be obtained using these |
|
1733 | 1732 |
/// functions.\n |
1734 |
/// Either \ref lemon::BfsVisit::run() "run()" or |
|
1735 |
/// \ref lemon::BfsVisit::start() "start()" must be called before |
|
1736 |
/// |
|
1733 |
/// Either \ref run(Node) "run()" or \ref start() should be called |
|
1734 |
/// before using them. |
|
1735 |
|
|
1737 | 1736 |
///@{ |
1738 | 1737 |
|
1739 |
/// \brief Checks if a node is |
|
1738 |
/// \brief Checks if a node is reached from the root(s). |
|
1740 | 1739 |
/// |
1741 |
/// Returns \c true if \c v is reachable from the root(s). |
|
1742 |
/// \pre Either \ref run() or \ref start() |
|
1740 |
/// Returns \c true if \c v is reached from the root(s). |
|
1741 |
/// |
|
1742 |
/// \pre Either \ref run(Node) "run()" or \ref init() |
|
1743 | 1743 |
/// must be called before using this function. |
... | ... |
@@ -121,9 +121,3 @@ |
121 | 121 |
///\tparam GR The type of the digraph the algorithm runs on. |
122 |
///The default value is \ref ListDigraph. The value of GR is not used |
|
123 |
///directly by \ref Dfs, it is only passed to \ref DfsDefaultTraits. |
|
124 |
///\tparam TR Traits class to set various data types used by the algorithm. |
|
125 |
///The default traits class is |
|
126 |
///\ref DfsDefaultTraits "DfsDefaultTraits<GR>". |
|
127 |
///See \ref DfsDefaultTraits for the documentation of |
|
128 |
/// |
|
122 |
///The default type is \ref ListDigraph. |
|
129 | 123 |
#ifdef DOXYGEN |
... | ... |
@@ -153,3 +147,3 @@ |
153 | 147 |
|
154 |
///The traits class. |
|
148 |
///The \ref DfsDefaultTraits "traits class" of the algorithm. |
|
155 | 149 |
typedef TR Traits; |
... | ... |
@@ -232,2 +226,3 @@ |
232 | 226 |
///PredMap type. |
227 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
233 | 228 |
template <class T> |
... | ... |
@@ -251,2 +246,3 @@ |
251 | 246 |
///DistMap type. |
247 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
252 | 248 |
template <class T> |
... | ... |
@@ -270,2 +266,3 @@ |
270 | 266 |
///ReachedMap type. |
267 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
|
271 | 268 |
template <class T> |
... | ... |
@@ -289,2 +286,3 @@ |
289 | 286 |
///ProcessedMap type. |
287 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
290 | 288 |
template <class T> |
... | ... |
@@ -340,5 +338,6 @@ |
340 | 338 |
///Sets the map that stores the predecessor arcs. |
341 |
///If you don't use this function before calling \ref run(), |
|
342 |
///it will allocate one. The destructor deallocates this |
|
343 |
/// |
|
339 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
340 |
///or \ref init(), an instance will be allocated automatically. |
|
341 |
///The destructor deallocates this automatically allocated map, |
|
342 |
///of course. |
|
344 | 343 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -357,5 +356,6 @@ |
357 | 356 |
///Sets the map that indicates which nodes are reached. |
358 |
///If you don't use this function before calling \ref run(), |
|
359 |
///it will allocate one. The destructor deallocates this |
|
360 |
/// |
|
357 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
358 |
///or \ref init(), an instance will be allocated automatically. |
|
359 |
///The destructor deallocates this automatically allocated map, |
|
360 |
///of course. |
|
361 | 361 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -374,5 +374,6 @@ |
374 | 374 |
///Sets the map that indicates which nodes are processed. |
375 |
///If you don't use this function before calling \ref run(), |
|
376 |
///it will allocate one. The destructor deallocates this |
|
377 |
/// |
|
375 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
376 |
///or \ref init(), an instance will be allocated automatically. |
|
377 |
///The destructor deallocates this automatically allocated map, |
|
378 |
///of course. |
|
378 | 379 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -392,5 +393,6 @@ |
392 | 393 |
///the algorithm. |
393 |
///If you don't use this function before calling \ref run(), |
|
394 |
///it will allocate one. The destructor deallocates this |
|
395 |
/// |
|
394 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
395 |
///or \ref init(), an instance will be allocated automatically. |
|
396 |
///The destructor deallocates this automatically allocated map, |
|
397 |
///of course. |
|
396 | 398 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -408,11 +410,10 @@ |
408 | 410 |
|
409 |
///\name Execution control |
|
410 |
///The simplest way to execute the algorithm is to use |
|
411 |
///one of the member functions called \ref lemon::Dfs::run() "run()". |
|
412 |
///\n |
|
413 |
///If you need more control on the execution, first you must call |
|
414 |
///\ref lemon::Dfs::init() "init()", then you can add a source node |
|
415 |
///with \ref lemon::Dfs::addSource() "addSource()". |
|
416 |
///Finally \ref lemon::Dfs::start() "start()" will perform the |
|
417 |
/// |
|
411 |
///\name Execution Control |
|
412 |
///The simplest way to execute the DFS algorithm is to use one of the |
|
413 |
///member functions called \ref run(Node) "run()".\n |
|
414 |
///If you need more control on the execution, first you have to call |
|
415 |
///\ref init(), then you can add a source node with \ref addSource() |
|
416 |
///and perform the actual computation with \ref start(). |
|
417 |
///This procedure can be repeated if there are nodes that have not |
|
418 |
///been reached. |
|
418 | 419 |
|
... | ... |
@@ -420,6 +421,5 @@ |
420 | 421 |
|
422 |
///\brief Initializes the internal data structures. |
|
423 |
/// |
|
421 | 424 |
///Initializes the internal data structures. |
422 |
|
|
423 |
///Initializes the internal data structures. |
|
424 |
/// |
|
425 | 425 |
void init() |
... | ... |
@@ -440,7 +440,6 @@ |
440 | 440 |
/// |
441 |
///\pre The stack must be empty. (Otherwise the algorithm gives |
|
442 |
///false results.) |
|
443 |
/// |
|
444 |
///\warning Distances will be wrong (or at least strange) in case of |
|
445 |
/// |
|
441 |
///\pre The stack must be empty. Otherwise the algorithm gives |
|
442 |
///wrong results. (One of the outgoing arcs of all the source nodes |
|
443 |
///except for the last one will not be visited and distances will |
|
444 |
///also be wrong.) |
|
446 | 445 |
void addSource(Node s) |
... | ... |
@@ -508,7 +507,6 @@ |
508 | 507 |
|
509 |
///\brief Returns \c false if there are nodes |
|
510 |
///to be processed. |
|
511 |
/// |
|
512 |
///Returns \c false if there are nodes |
|
513 |
///to be processed |
|
508 |
///Returns \c false if there are nodes to be processed. |
|
509 |
|
|
510 |
///Returns \c false if there are nodes to be processed |
|
511 |
///in the queue (stack). |
|
514 | 512 |
bool emptyQueue() const { return _stack_head<0; } |
... | ... |
@@ -517,3 +515,4 @@ |
517 | 515 |
|
518 |
///Returns the number of the nodes to be processed |
|
516 |
///Returns the number of the nodes to be processed |
|
517 |
///in the queue (stack). |
|
519 | 518 |
int queueSize() const { return _stack_head+1; } |
... | ... |
@@ -639,4 +638,4 @@ |
639 | 638 |
///The algorithm computes |
640 |
///- the %DFS tree, |
|
641 |
///- the distance of each node from the root in the %DFS tree. |
|
639 |
///- the %DFS tree (forest), |
|
640 |
///- the distance of each node from the root(s) in the %DFS tree. |
|
642 | 641 |
/// |
... | ... |
@@ -665,6 +664,6 @@ |
665 | 664 |
///\name Query Functions |
666 |
///The |
|
665 |
///The results of the DFS algorithm can be obtained using these |
|
667 | 666 |
///functions.\n |
668 |
///Either \ref lemon::Dfs::run() "run()" or \ref lemon::Dfs::start() |
|
669 |
///"start()" must be called before using them. |
|
667 |
///Either \ref run(Node) "run()" or \ref start() should be called |
|
668 |
///before using them. |
|
670 | 669 |
|
... | ... |
@@ -676,17 +675,17 @@ |
676 | 675 |
/// |
677 |
///\warning \c t should be |
|
676 |
///\warning \c t should be reached from the root(s). |
|
678 | 677 |
/// |
679 |
///\pre Either \ref run() or \ref start() must be called before |
|
680 |
///using this function. |
|
678 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
679 |
///must be called before using this function. |
|
681 | 680 |
Path path(Node t) const { return Path(*G, *_pred, t); } |
682 | 681 |
|
683 |
///The distance of a node from the root. |
|
682 |
///The distance of a node from the root(s). |
|
684 | 683 |
|
685 |
///Returns the distance of a node from the root. |
|
684 |
///Returns the distance of a node from the root(s). |
|
686 | 685 |
/// |
687 |
///\warning If node \c v is not |
|
686 |
///\warning If node \c v is not reached from the root(s), then |
|
688 | 687 |
///the return value of this function is undefined. |
689 | 688 |
/// |
690 |
///\pre Either \ref run() or \ref start() must be called before |
|
691 |
///using this function. |
|
689 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
690 |
///must be called before using this function. |
|
692 | 691 |
int dist(Node v) const { return (*_dist)[v]; } |
... | ... |
@@ -696,5 +695,5 @@ |
696 | 695 |
///This function returns the 'previous arc' of the %DFS tree for the |
697 |
///node \c v, i.e. it returns the last arc of a %DFS path from the |
|
698 |
///root to \c v. It is \c INVALID |
|
699 |
/// |
|
696 |
///node \c v, i.e. it returns the last arc of a %DFS path from a |
|
697 |
///root to \c v. It is \c INVALID if \c v is not reached from the |
|
698 |
///root(s) or if \c v is a root. |
|
700 | 699 |
/// |
... | ... |
@@ -703,4 +702,4 @@ |
703 | 702 |
/// |
704 |
///\pre Either \ref run() or \ref start() must be called before using |
|
705 |
///this function. |
|
703 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
704 |
///must be called before using this function. |
|
706 | 705 |
Arc predArc(Node v) const { return (*_pred)[v];} |
... | ... |
@@ -711,4 +710,4 @@ |
711 | 710 |
///tree for the node \c v, i.e. it returns the last but one node |
712 |
///from a %DFS path from the root to \c v. It is \c INVALID |
|
713 |
///if \c v is not reachable from the root(s) or if \c v is a root. |
|
711 |
///from a %DFS path from a root to \c v. It is \c INVALID |
|
712 |
///if \c v is not reached from the root(s) or if \c v is a root. |
|
714 | 713 |
/// |
... | ... |
@@ -717,4 +716,4 @@ |
717 | 716 |
/// |
718 |
///\pre Either \ref run() or \ref start() must be called before |
|
719 |
///using this function. |
|
717 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
718 |
///must be called before using this function. |
|
720 | 719 |
Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID: |
... | ... |
@@ -728,3 +727,3 @@ |
728 | 727 |
/// |
729 |
///\pre Either \ref run() or \ref init() |
|
728 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
730 | 729 |
///must be called before using this function. |
... | ... |
@@ -738,3 +737,3 @@ |
738 | 737 |
/// |
739 |
///\pre Either \ref run() or \ref init() |
|
738 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
740 | 739 |
///must be called before using this function. |
... | ... |
@@ -742,6 +741,7 @@ |
742 | 741 |
|
743 |
///Checks if a node is |
|
742 |
///Checks if a node is reached from the root(s). |
|
744 | 743 |
|
745 |
///Returns \c true if \c v is reachable from the root(s). |
|
746 |
///\pre Either \ref run() or \ref start() |
|
744 |
///Returns \c true if \c v is reached from the root(s). |
|
745 |
/// |
|
746 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
747 | 747 |
///must be called before using this function. |
... | ... |
@@ -891,4 +891,4 @@ |
891 | 891 |
/// \ref dfs() "function-type interface" of \ref Dfs algorithm. |
892 |
/// It does not have own \ref run() method, it uses the functions |
|
893 |
/// and features of the plain \ref Dfs. |
|
892 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
|
893 |
/// functions and features of the plain \ref Dfs. |
|
894 | 894 |
/// |
... | ... |
@@ -1112,4 +1112,3 @@ |
1112 | 1112 |
///\endcode |
1113 |
|
|
1114 |
///\warning Don't forget to put the \ref DfsWizard::run() "run()" |
|
1113 |
///\warning Don't forget to put the \ref DfsWizard::run(Node) "run()" |
|
1115 | 1114 |
///to the end of the parameter list. |
... | ... |
@@ -1311,3 +1310,3 @@ |
1311 | 1310 |
|
1312 |
/// \name Named |
|
1311 |
/// \name Named Template Parameters |
|
1313 | 1312 |
|
... | ... |
@@ -1353,5 +1352,6 @@ |
1353 | 1352 |
/// Sets the map that indicates which nodes are reached. |
1354 |
/// If you don't use this function before calling \ref run(), |
|
1355 |
/// it will allocate one. The destructor deallocates this |
|
1356 |
/// |
|
1353 |
/// If you don't use this function before calling \ref run(Node) "run()" |
|
1354 |
/// or \ref init(), an instance will be allocated automatically. |
|
1355 |
/// The destructor deallocates this automatically allocated map, |
|
1356 |
/// of course. |
|
1357 | 1357 |
/// \return <tt> (*this) </tt> |
... | ... |
@@ -1368,12 +1368,10 @@ |
1368 | 1368 |
|
1369 |
/// \name Execution control |
|
1370 |
/// The simplest way to execute the algorithm is to use |
|
1371 |
/// one of the member functions called \ref lemon::DfsVisit::run() |
|
1372 |
/// "run()". |
|
1373 |
/// \n |
|
1374 |
/// If you need more control on the execution, first you must call |
|
1375 |
/// \ref lemon::DfsVisit::init() "init()", then you can add several |
|
1376 |
/// source nodes with \ref lemon::DfsVisit::addSource() "addSource()". |
|
1377 |
/// Finally \ref lemon::DfsVisit::start() "start()" will perform the |
|
1378 |
/// actual path computation. |
|
1369 |
/// \name Execution Control |
|
1370 |
/// The simplest way to execute the DFS algorithm is to use one of the |
|
1371 |
/// member functions called \ref run(Node) "run()".\n |
|
1372 |
/// If you need more control on the execution, first you have to call |
|
1373 |
/// \ref init(), then you can add a source node with \ref addSource() |
|
1374 |
/// and perform the actual computation with \ref start(). |
|
1375 |
/// This procedure can be repeated if there are nodes that have not |
|
1376 |
/// been reached. |
|
1379 | 1377 |
|
... | ... |
@@ -1393,11 +1391,10 @@ |
1393 | 1391 |
|
1394 |
///Adds a new source node. |
|
1395 |
|
|
1392 |
/// \brief Adds a new source node. |
|
1393 |
/// |
|
1396 | 1394 |
///Adds a new source node to the set of nodes to be processed. |
1397 | 1395 |
/// |
1398 |
///\pre The stack must be empty. (Otherwise the algorithm gives |
|
1399 |
///false results.) |
|
1400 |
/// |
|
1401 |
///\warning Distances will be wrong (or at least strange) in case of |
|
1402 |
/// |
|
1396 |
/// \pre The stack must be empty. Otherwise the algorithm gives |
|
1397 |
/// wrong results. (One of the outgoing arcs of all the source nodes |
|
1398 |
/// except for the last one will not be visited and distances will |
|
1399 |
/// also be wrong.) |
|
1403 | 1400 |
void addSource(Node s) |
... | ... |
@@ -1591,4 +1588,4 @@ |
1591 | 1588 |
/// The algorithm computes |
1592 |
/// - the %DFS tree, |
|
1593 |
/// - the distance of each node from the root in the %DFS tree. |
|
1589 |
/// - the %DFS tree (forest), |
|
1590 |
/// - the distance of each node from the root(s) in the %DFS tree. |
|
1594 | 1591 |
/// |
... | ... |
@@ -1617,13 +1614,14 @@ |
1617 | 1614 |
/// \name Query Functions |
1618 |
/// The |
|
1615 |
/// The results of the DFS algorithm can be obtained using these |
|
1619 | 1616 |
/// functions.\n |
1620 |
/// Either \ref lemon::DfsVisit::run() "run()" or |
|
1621 |
/// \ref lemon::DfsVisit::start() "start()" must be called before |
|
1622 |
/// |
|
1617 |
/// Either \ref run(Node) "run()" or \ref start() should be called |
|
1618 |
/// before using them. |
|
1619 |
|
|
1623 | 1620 |
///@{ |
1624 | 1621 |
|
1625 |
/// \brief Checks if a node is |
|
1622 |
/// \brief Checks if a node is reached from the root(s). |
|
1626 | 1623 |
/// |
1627 |
/// Returns \c true if \c v is reachable from the root(s). |
|
1628 |
/// \pre Either \ref run() or \ref start() |
|
1624 |
/// Returns \c true if \c v is reached from the root(s). |
|
1625 |
/// |
|
1626 |
/// \pre Either \ref run(Node) "run()" or \ref init() |
|
1629 | 1627 |
/// must be called before using this function. |
... | ... |
@@ -204,16 +204,9 @@ |
204 | 204 |
///\tparam GR The type of the digraph the algorithm runs on. |
205 |
///The default value is \ref ListDigraph. |
|
206 |
///The value of GR is not used directly by \ref Dijkstra, it is only |
|
207 |
///passed to \ref DijkstraDefaultTraits. |
|
208 |
///\tparam LM A readable arc map that determines the lengths of the |
|
209 |
/// |
|
205 |
///The default type is \ref ListDigraph. |
|
206 |
///\tparam LM A \ref concepts::ReadMap "readable" arc map that specifies |
|
207 |
///the lengths of the arcs. |
|
208 |
///It is read once for each arc, so the map may involve in |
|
210 | 209 |
///relatively time consuming process to compute the arc lengths if |
211 | 210 |
///it is necessary. The default map type is \ref |
212 |
///concepts::Digraph::ArcMap "Digraph::ArcMap<int>". |
|
213 |
///The value of LM is not used directly by \ref Dijkstra, it is only |
|
214 |
///passed to \ref DijkstraDefaultTraits. |
|
215 |
///\tparam TR Traits class to set various data types used by the algorithm. |
|
216 |
///The default traits class is \ref DijkstraDefaultTraits |
|
217 |
///"DijkstraDefaultTraits<GR,LM>". See \ref DijkstraDefaultTraits |
|
218 |
/// |
|
211 |
///concepts::Digraph::ArcMap "GR::ArcMap<int>". |
|
219 | 212 |
#ifdef DOXYGEN |
... | ... |
@@ -251,3 +244,3 @@ |
251 | 244 |
|
252 |
///The traits class. |
|
245 |
///The \ref DijkstraDefaultTraits "traits class" of the algorithm. |
|
253 | 246 |
typedef TR Traits; |
... | ... |
@@ -333,2 +326,3 @@ |
333 | 326 |
///PredMap type. |
327 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
334 | 328 |
template <class T> |
... | ... |
@@ -353,2 +347,3 @@ |
353 | 347 |
///DistMap type. |
348 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
354 | 349 |
template <class T> |
... | ... |
@@ -373,2 +368,3 @@ |
373 | 368 |
///ProcessedMap type. |
369 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
|
374 | 370 |
template <class T> |
... | ... |
@@ -413,6 +409,10 @@ |
413 | 409 |
///\brief \ref named-templ-param "Named parameter" for setting |
414 |
///heap and cross reference |
|
410 |
///heap and cross reference types |
|
415 | 411 |
/// |
416 | 412 |
///\ref named-templ-param "Named parameter" for setting heap and cross |
417 |
///reference |
|
413 |
///reference types. If this named parameter is used, then external |
|
414 |
///heap and cross reference objects must be passed to the algorithm |
|
415 |
///using the \ref heap() function before calling \ref run(Node) "run()" |
|
416 |
///or \ref init(). |
|
417 |
///\sa SetStandardHeap |
|
418 | 418 |
template <class H, class CR = typename Digraph::template NodeMap<int> > |
... | ... |
@@ -436,8 +436,14 @@ |
436 | 436 |
///\brief \ref named-templ-param "Named parameter" for setting |
437 |
///heap and cross reference |
|
437 |
///heap and cross reference types with automatic allocation |
|
438 | 438 |
/// |
439 | 439 |
///\ref named-templ-param "Named parameter" for setting heap and cross |
440 |
///reference type. It can allocate the heap and the cross reference |
|
441 |
///object if the cross reference's constructor waits for the digraph as |
|
442 |
/// |
|
440 |
///reference types with automatic allocation. |
|
441 |
///They should have standard constructor interfaces to be able to |
|
442 |
///automatically created by the algorithm (i.e. the digraph should be |
|
443 |
///passed to the constructor of the cross reference and the cross |
|
444 |
///reference should be passed to the constructor of the heap). |
|
445 |
///However external heap and cross reference objects could also be |
|
446 |
///passed to the algorithm using the \ref heap() function before |
|
447 |
///calling \ref run(Node) "run()" or \ref init(). |
|
448 |
///\sa SetHeap |
|
443 | 449 |
template <class H, class CR = typename Digraph::template NodeMap<int> > |
... | ... |
@@ -511,5 +517,6 @@ |
511 | 517 |
///Sets the map that stores the predecessor arcs. |
512 |
///If you don't use this function before calling \ref run(), |
|
513 |
///it will allocate one. The destructor deallocates this |
|
514 |
/// |
|
518 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
519 |
///or \ref init(), an instance will be allocated automatically. |
|
520 |
///The destructor deallocates this automatically allocated map, |
|
521 |
///of course. |
|
515 | 522 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -528,5 +535,6 @@ |
528 | 535 |
///Sets the map that indicates which nodes are processed. |
529 |
///If you don't use this function before calling \ref run(), |
|
530 |
///it will allocate one. The destructor deallocates this |
|
531 |
/// |
|
536 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
537 |
///or \ref init(), an instance will be allocated automatically. |
|
538 |
///The destructor deallocates this automatically allocated map, |
|
539 |
///of course. |
|
532 | 540 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -546,5 +554,6 @@ |
546 | 554 |
///algorithm. |
547 |
///If you don't use this function before calling \ref run(), |
|
548 |
///it will allocate one. The destructor deallocates this |
|
549 |
/// |
|
555 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
556 |
///or \ref init(), an instance will be allocated automatically. |
|
557 |
///The destructor deallocates this automatically allocated map, |
|
558 |
///of course. |
|
550 | 559 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -563,5 +572,7 @@ |
563 | 572 |
///Sets the heap and the cross reference used by algorithm. |
564 |
///If you don't use this function before calling \ref run(), |
|
565 |
///it will allocate one. The destructor deallocates this |
|
566 |
/// |
|
573 |
///If you don't use this function before calling \ref run(Node) "run()" |
|
574 |
///or \ref init(), heap and cross reference instances will be |
|
575 |
///allocated automatically. |
|
576 |
///The destructor deallocates these automatically allocated objects, |
|
577 |
///of course. |
|
567 | 578 |
///\return <tt> (*this) </tt> |
... | ... |
@@ -592,11 +603,9 @@ |
592 | 603 |
|
593 |
///\name Execution control |
|
594 |
///The simplest way to execute the algorithm is to use one of the |
|
595 |
///member functions called \ref lemon::Dijkstra::run() "run()". |
|
596 |
///\n |
|
597 |
///If you need more control on the execution, first you must call |
|
598 |
///\ref lemon::Dijkstra::init() "init()", then you can add several |
|
599 |
///source nodes with \ref lemon::Dijkstra::addSource() "addSource()". |
|
600 |
///Finally \ref lemon::Dijkstra::start() "start()" will perform the |
|
601 |
/// |
|
604 |
///\name Execution Control |
|
605 |
///The simplest way to execute the %Dijkstra algorithm is to use |
|
606 |
///one of the member functions called \ref run(Node) "run()".\n |
|
607 |
///If you need more control on the execution, first you have to call |
|
608 |
///\ref init(), then you can add several source nodes with |
|
609 |
///\ref addSource(). Finally the actual path computation can be |
|
610 |
///performed with one of the \ref start() functions. |
|
602 | 611 |
|
... | ... |
@@ -604,6 +613,5 @@ |
604 | 613 |
|
614 |
///\brief Initializes the internal data structures. |
|
615 |
/// |
|
605 | 616 |
///Initializes the internal data structures. |
606 |
|
|
607 |
///Initializes the internal data structures. |
|
608 |
/// |
|
609 | 617 |
void init() |
... | ... |
@@ -683,13 +691,12 @@ |
683 | 691 |
|
684 |
///\brief Returns \c false if there are nodes |
|
685 |
///to be processed. |
|
686 |
/// |
|
687 |
///Returns \c false if there are nodes |
|
688 |
///to be processed |
|
692 |
///Returns \c false if there are nodes to be processed. |
|
693 |
|
|
694 |
///Returns \c false if there are nodes to be processed |
|
695 |
///in the priority heap. |
|
689 | 696 |
bool emptyQueue() const { return _heap->empty(); } |
690 | 697 |
|
691 |
///Returns the number of the nodes to be processed |
|
698 |
///Returns the number of the nodes to be processed. |
|
692 | 699 |
|
693 |
///Returns the number of the nodes to be processed in the priority heap. |
|
694 |
/// |
|
700 |
///Returns the number of the nodes to be processed |
|
701 |
///in the priority heap. |
|
695 | 702 |
int queueSize() const { return _heap->size(); } |
... | ... |
@@ -814,7 +821,6 @@ |
814 | 821 |
///\name Query Functions |
815 |
///The |
|
822 |
///The results of the %Dijkstra algorithm can be obtained using these |
|
816 | 823 |
///functions.\n |
817 |
///Either \ref lemon::Dijkstra::run() "run()" or |
|
818 |
///\ref lemon::Dijkstra::start() "start()" must be called before |
|
819 |
/// |
|
824 |
///Either \ref run(Node) "run()" or \ref start() should be called |
|
825 |
///before using them. |
|
820 | 826 |
|
... | ... |
@@ -826,6 +832,6 @@ |
826 | 832 |
/// |
827 |
///\warning \c t should be |
|
833 |
///\warning \c t should be reached from the root(s). |
|
828 | 834 |
/// |
829 |
///\pre Either \ref run() or \ref start() must be called before |
|
830 |
///using this function. |
|
835 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
836 |
///must be called before using this function. |
|
831 | 837 |
Path path(Node t) const { return Path(*G, *_pred, t); } |
... | ... |
@@ -836,7 +842,7 @@ |
836 | 842 |
/// |
837 |
///\warning If node \c v is not |
|
843 |
///\warning If node \c v is not reached from the root(s), then |
|
838 | 844 |
///the return value of this function is undefined. |
839 | 845 |
/// |
840 |
///\pre Either \ref run() or \ref start() must be called before |
|
841 |
///using this function. |
|
846 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
847 |
///must be called before using this function. |
|
842 | 848 |
Value dist(Node v) const { return (*_dist)[v]; } |
... | ... |
@@ -847,4 +853,4 @@ |
847 | 853 |
///tree for the node \c v, i.e. it returns the last arc of a |
848 |
///shortest path from the root(s) to \c v. It is \c INVALID if \c v |
|
849 |
///is not reachable from the root(s) or if \c v is a root. |
|
854 |
///shortest path from a root to \c v. It is \c INVALID if \c v |
|
855 |
///is not reached from the root(s) or if \c v is a root. |
|
850 | 856 |
/// |
... | ... |
@@ -853,4 +859,4 @@ |
853 | 859 |
/// |
854 |
///\pre Either \ref run() or \ref start() must be called before |
|
855 |
///using this function. |
|
860 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
861 |
///must be called before using this function. |
|
856 | 862 |
Arc predArc(Node v) const { return (*_pred)[v]; } |
... | ... |
@@ -861,4 +867,4 @@ |
861 | 867 |
///tree for the node \c v, i.e. it returns the last but one node |
862 |
///from a shortest path from the root(s) to \c v. It is \c INVALID |
|
863 |
///if \c v is not reachable from the root(s) or if \c v is a root. |
|
868 |
///from a shortest path from a root to \c v. It is \c INVALID |
|
869 |
///if \c v is not reached from the root(s) or if \c v is a root. |
|
864 | 870 |
/// |
... | ... |
@@ -867,4 +873,4 @@ |
867 | 873 |
/// |
868 |
///\pre Either \ref run() or \ref start() must be called before |
|
869 |
///using this function. |
|
874 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
875 |
///must be called before using this function. |
|
870 | 876 |
Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID: |
... | ... |
@@ -878,3 +884,3 @@ |
878 | 884 |
/// |
879 |
///\pre Either \ref run() or \ref init() |
|
885 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
880 | 886 |
///must be called before using this function. |
... | ... |
@@ -888,3 +894,3 @@ |
888 | 894 |
/// |
889 |
///\pre Either \ref run() or \ref init() |
|
895 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
890 | 896 |
///must be called before using this function. |
... | ... |
@@ -892,6 +898,7 @@ |
892 | 898 |
|
893 |
///Checks if a node is |
|
899 |
///Checks if a node is reached from the root(s). |
|
894 | 900 |
|
895 |
///Returns \c true if \c v is reachable from the root(s). |
|
896 |
///\pre Either \ref run() or \ref start() |
|
901 |
///Returns \c true if \c v is reached from the root(s). |
|
902 |
/// |
|
903 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
897 | 904 |
///must be called before using this function. |
... | ... |
@@ -904,3 +911,4 @@ |
904 | 911 |
///path to \c v has already found. |
905 |
/// |
|
912 |
/// |
|
913 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
906 | 914 |
///must be called before using this function. |
... | ... |
@@ -913,3 +921,4 @@ |
913 | 921 |
///It may be decreased in the following processes. |
914 |
/// |
|
922 |
/// |
|
923 |
///\pre Either \ref run(Node) "run()" or \ref init() |
|
915 | 924 |
///must be called before using this function and |
... | ... |
@@ -1096,4 +1105,4 @@ |
1096 | 1105 |
/// \ref dijkstra() "function-type interface" of \ref Dijkstra algorithm. |
1097 |
/// It does not have own \ref run() method, it uses the functions |
|
1098 |
/// and features of the plain \ref Dijkstra. |
|
1106 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
|
1107 |
/// functions and features of the plain \ref Dijkstra. |
|
1099 | 1108 |
/// |
... | ... |
@@ -1292,3 +1301,3 @@ |
1292 | 1301 |
///\endcode |
1293 |
///\warning Don't forget to put the \ref DijkstraWizard::run() "run()" |
|
1302 |
///\warning Don't forget to put the \ref DijkstraWizard::run(Node) "run()" |
|
1294 | 1303 |
///to the end of the parameter list. |
0 comments (0 inline)