equal
deleted
inserted
replaced
26 separated files named after the algorithm itself but lower case as all other header file names. |
26 separated files named after the algorithm itself but lower case as all other header file names. |
27 For example the next Bfs class is in the \c lemon/bfs.h. |
27 For example the next Bfs class is in the \c lemon/bfs.h. |
28 |
28 |
29 \subsection Bfs |
29 \subsection Bfs |
30 The algorithm is implemented in the \ref lemon::Bfs "Bfs" template class - rather than as function. |
30 The algorithm is implemented in the \ref lemon::Bfs "Bfs" template class - rather than as function. |
31 The class has two template parameters: \b GR and \TR.<br> |
31 The class has two template parameters: \b GR and \b TR.<br> |
32 GR is the graph the algorithm runs on. It has \ref lemon::ListGraph "ListGraph" as default type. |
32 GR is the graph the algorithm runs on. It has \ref lemon::ListGraph "ListGraph" as default type. |
33 TR is a Traits class commonly used to easy the parametrization of templates. In most cases you |
33 TR is a Traits class commonly used to easy the parametrization of templates. In most cases you |
34 wont need to modify the default type \ref lemon::BfsDefaultTraits "BfsDefaultTraits<GR>". |
34 wont need to modify the default type \ref lemon::BfsDefaultTraits "BfsDefaultTraits<GR>". |
35 |
35 |
36 To use the class, declare it! |
36 To use the class, declare it! |
49 \code |
49 \code |
50 bfs.run(s); |
50 bfs.run(s); |
51 \endcode |
51 \endcode |
52 Now the distances and path information are stored in maps which you can access with |
52 Now the distances and path information are stored in maps which you can access with |
53 member functions like \ref lemon::Bfs::distMap "distMap()" or \ref lemon::Bfs::predMap "predMap()".<br> |
53 member functions like \ref lemon::Bfs::distMap "distMap()" or \ref lemon::Bfs::predMap "predMap()".<br> |
54 Or more directly whit other member functions like \c predNode(). Once the algorithm |
54 Or more directly with other member functions like \ref lemon::Bfs::predNode "predNode()". Once the algorithm |
55 is finished (or to be precise reached that node) \ref lemon::Bfs::dist "dist()" or \ref lemon::Bfs::predNode |
55 is finished (or to be precise reached that node) \ref lemon::Bfs::dist "dist()" or \ref lemon::Bfs::predNode |
56 "predNode()" can be called. |
56 "predNode()" can be called. |
57 |
57 |
58 For an example let's say we want to print the shortest path of those nodes which |
58 For an example let's say we want to print the shortest path of those nodes which |
59 are in a certain distance. |
59 are in a certain distance. |
113 First of all we will need an own \ref lemon::Dfs::ProcessedMap "ProcessedMap". The ordering |
113 First of all we will need an own \ref lemon::Dfs::ProcessedMap "ProcessedMap". The ordering |
114 will be done through it. |
114 will be done through it. |
115 \skip MyOrdererMap |
115 \skip MyOrdererMap |
116 \until }; |
116 \until }; |
117 The class meets the \ref lemon::WriteMap "WriteMap" concept. In it's \c set() method the only thing |
117 The class meets the \ref lemon::WriteMap "WriteMap" concept. In it's \c set() method the only thing |
118 we need to do is insert the key - that is the node who's processing just finished - into the beginning |
118 we need to do is insert the key - that is the node whose processing just finished - into the beginning |
119 of the list.<br> |
119 of the list.<br> |
120 Although we implemented this needed helper class ourselves it was not necessary. |
120 Although we implemented this needed helper class ourselves it was not necessary. |
121 The \ref lemon::FrontInserterBoolMap "FrontInserterBoolMap" class does exactly |
121 The \ref lemon::FrontInserterBoolMap "FrontInserterBoolMap" class does exactly |
122 what we needed. To be correct it's more general - and it's all in \c LEMON. But |
122 what we needed. To be correct it's more general - and it's all in \c LEMON. But |
123 we wanted to show you, how easy is to add additional functionality. |
123 we wanted to show you, how easy is to add additional functionality. |