1047 dfs(const GR &g,typename GR::Node s=INVALID) |
1047 dfs(const GR &g,typename GR::Node s=INVALID) |
1048 { |
1048 { |
1049 return DfsWizard<DfsWizardBase<GR> >(g,s); |
1049 return DfsWizard<DfsWizardBase<GR> >(g,s); |
1050 } |
1050 } |
1051 |
1051 |
|
1052 #ifdef DOXYGEN |
1052 /// \brief Visitor class for dfs. |
1053 /// \brief Visitor class for dfs. |
1053 /// |
1054 /// |
1054 /// It gives a simple interface for a functional interface for dfs |
1055 /// It gives a simple interface for a functional interface for dfs |
1055 /// traversal. The traversal on a linear data structure. |
1056 /// traversal. The traversal on a linear data structure. |
1056 template <typename _Graph> |
1057 template <typename _Graph> |
1082 /// already discovered. |
1083 /// already discovered. |
1083 void examine(const Edge& edge) {} |
1084 void examine(const Edge& edge) {} |
1084 /// \brief Called for the source node of the dfs. |
1085 /// \brief Called for the source node of the dfs. |
1085 /// |
1086 /// |
1086 /// It is called for the source node of the dfs. |
1087 /// It is called for the source node of the dfs. |
1087 void start(const Node&) {} |
1088 void start(const Node& node) {} |
1088 /// \brief Called when we leave the source node of the dfs. |
1089 /// \brief Called when we leave the source node of the dfs. |
1089 /// |
1090 /// |
1090 /// It is called when we leave the source node of the dfs. |
1091 /// It is called when we leave the source node of the dfs. |
|
1092 void stop(const Node& node) {} |
|
1093 |
|
1094 }; |
|
1095 #else |
|
1096 template <typename _Graph> |
|
1097 struct DfsVisitor { |
|
1098 typedef _Graph Graph; |
|
1099 typedef typename Graph::Edge Edge; |
|
1100 typedef typename Graph::Node Node; |
|
1101 void discover(const Edge&) {} |
|
1102 void reach(const Node&) {} |
|
1103 void backtrack(const Edge&) {} |
|
1104 void leave(const Node&) {} |
|
1105 void examine(const Edge&) {} |
|
1106 void start(const Node&) {} |
1091 void stop(const Node&) {} |
1107 void stop(const Node&) {} |
1092 |
1108 |
1093 template <typename _Visitor> |
1109 template <typename _Visitor> |
1094 struct Constraints { |
1110 struct Constraints { |
1095 void constraints() { |
1111 void constraints() { |