0
3
0
| ... | ... |
@@ -1291,49 +1291,49 @@ |
| 1291 | 1291 |
/// |
| 1292 | 1292 |
/// This interface of the BFS algorithm should be used in special cases |
| 1293 | 1293 |
/// when extra actions have to be performed in connection with certain |
| 1294 | 1294 |
/// events of the BFS algorithm. Otherwise consider to use Bfs or bfs() |
| 1295 | 1295 |
/// instead. |
| 1296 | 1296 |
/// |
| 1297 | 1297 |
/// \tparam _Digraph The type of the digraph the algorithm runs on. |
| 1298 | 1298 |
/// The default value is |
| 1299 | 1299 |
/// \ref ListDigraph. The value of _Digraph is not used directly by |
| 1300 | 1300 |
/// \ref BfsVisit, it is only passed to \ref BfsVisitDefaultTraits. |
| 1301 | 1301 |
/// \tparam _Visitor The Visitor type that is used by the algorithm. |
| 1302 | 1302 |
/// \ref BfsVisitor "BfsVisitor<_Digraph>" is an empty visitor, which |
| 1303 | 1303 |
/// does not observe the BFS events. If you want to observe the BFS |
| 1304 | 1304 |
/// events, you should implement your own visitor class. |
| 1305 | 1305 |
/// \tparam _Traits Traits class to set various data types used by the |
| 1306 | 1306 |
/// algorithm. The default traits class is |
| 1307 | 1307 |
/// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<_Digraph>". |
| 1308 | 1308 |
/// See \ref BfsVisitDefaultTraits for the documentation of |
| 1309 | 1309 |
/// a BFS visit traits class. |
| 1310 | 1310 |
#ifdef DOXYGEN |
| 1311 | 1311 |
template <typename _Digraph, typename _Visitor, typename _Traits> |
| 1312 | 1312 |
#else |
| 1313 | 1313 |
template <typename _Digraph = ListDigraph, |
| 1314 | 1314 |
typename _Visitor = BfsVisitor<_Digraph>, |
| 1315 |
typename _Traits = |
|
| 1315 |
typename _Traits = BfsVisitDefaultTraits<_Digraph> > |
|
| 1316 | 1316 |
#endif |
| 1317 | 1317 |
class BfsVisit {
|
| 1318 | 1318 |
public: |
| 1319 | 1319 |
|
| 1320 | 1320 |
///The traits class. |
| 1321 | 1321 |
typedef _Traits Traits; |
| 1322 | 1322 |
|
| 1323 | 1323 |
///The type of the digraph the algorithm runs on. |
| 1324 | 1324 |
typedef typename Traits::Digraph Digraph; |
| 1325 | 1325 |
|
| 1326 | 1326 |
///The visitor type used by the algorithm. |
| 1327 | 1327 |
typedef _Visitor Visitor; |
| 1328 | 1328 |
|
| 1329 | 1329 |
///The type of the map that indicates which nodes are reached. |
| 1330 | 1330 |
typedef typename Traits::ReachedMap ReachedMap; |
| 1331 | 1331 |
|
| 1332 | 1332 |
private: |
| 1333 | 1333 |
|
| 1334 | 1334 |
typedef typename Digraph::Node Node; |
| 1335 | 1335 |
typedef typename Digraph::NodeIt NodeIt; |
| 1336 | 1336 |
typedef typename Digraph::Arc Arc; |
| 1337 | 1337 |
typedef typename Digraph::OutArcIt OutArcIt; |
| 1338 | 1338 |
|
| 1339 | 1339 |
//Pointer to the underlying digraph. |
| ... | ... |
@@ -277,86 +277,86 @@ |
| 277 | 277 |
return INVALID; |
| 278 | 278 |
} |
| 279 | 279 |
}; |
| 280 | 280 |
|
| 281 | 281 |
template <typename Base> |
| 282 | 282 |
class BidirBpGraphExtender : public Base {
|
| 283 | 283 |
public: |
| 284 | 284 |
typedef Base Parent; |
| 285 | 285 |
typedef BidirBpGraphExtender Digraph; |
| 286 | 286 |
|
| 287 | 287 |
typedef typename Parent::Node Node; |
| 288 | 288 |
typedef typename Parent::Edge Edge; |
| 289 | 289 |
|
| 290 | 290 |
|
| 291 | 291 |
using Parent::first; |
| 292 | 292 |
using Parent::next; |
| 293 | 293 |
|
| 294 | 294 |
using Parent::id; |
| 295 | 295 |
|
| 296 | 296 |
class Red : public Node {
|
| 297 | 297 |
friend class BidirBpGraphExtender; |
| 298 | 298 |
public: |
| 299 | 299 |
Red() {}
|
| 300 | 300 |
Red(const Node& node) : Node(node) {
|
| 301 |
LEMON_ASSERT(Parent::red(node) || node == INVALID, |
|
| 302 |
typename Parent::NodeSetError()); |
|
| 301 |
LEMON_DEBUG(Parent::red(node) || node == INVALID, |
|
| 302 |
typename Parent::NodeSetError()); |
|
| 303 | 303 |
} |
| 304 | 304 |
Red& operator=(const Node& node) {
|
| 305 |
LEMON_ASSERT(Parent::red(node) || node == INVALID, |
|
| 306 |
typename Parent::NodeSetError()); |
|
| 305 |
LEMON_DEBUG(Parent::red(node) || node == INVALID, |
|
| 306 |
typename Parent::NodeSetError()); |
|
| 307 | 307 |
Node::operator=(node); |
| 308 | 308 |
return *this; |
| 309 | 309 |
} |
| 310 | 310 |
Red(Invalid) : Node(INVALID) {}
|
| 311 | 311 |
Red& operator=(Invalid) {
|
| 312 | 312 |
Node::operator=(INVALID); |
| 313 | 313 |
return *this; |
| 314 | 314 |
} |
| 315 | 315 |
}; |
| 316 | 316 |
|
| 317 | 317 |
void first(Red& node) const {
|
| 318 | 318 |
Parent::firstRed(static_cast<Node&>(node)); |
| 319 | 319 |
} |
| 320 | 320 |
void next(Red& node) const {
|
| 321 | 321 |
Parent::nextRed(static_cast<Node&>(node)); |
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
int id(const Red& node) const {
|
| 325 | 325 |
return Parent::redId(node); |
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 | 328 |
class Blue : public Node {
|
| 329 | 329 |
friend class BidirBpGraphExtender; |
| 330 | 330 |
public: |
| 331 | 331 |
Blue() {}
|
| 332 | 332 |
Blue(const Node& node) : Node(node) {
|
| 333 |
LEMON_ASSERT(Parent::blue(node) || node == INVALID, |
|
| 334 |
typename Parent::NodeSetError()); |
|
| 333 |
LEMON_DEBUG(Parent::blue(node) || node == INVALID, |
|
| 334 |
typename Parent::NodeSetError()); |
|
| 335 | 335 |
} |
| 336 | 336 |
Blue& operator=(const Node& node) {
|
| 337 |
LEMON_ASSERT(Parent::blue(node) || node == INVALID, |
|
| 338 |
typename Parent::NodeSetError()); |
|
| 337 |
LEMON_DEBUG(Parent::blue(node) || node == INVALID, |
|
| 338 |
typename Parent::NodeSetError()); |
|
| 339 | 339 |
Node::operator=(node); |
| 340 | 340 |
return *this; |
| 341 | 341 |
} |
| 342 | 342 |
Blue(Invalid) : Node(INVALID) {}
|
| 343 | 343 |
Blue& operator=(Invalid) {
|
| 344 | 344 |
Node::operator=(INVALID); |
| 345 | 345 |
return *this; |
| 346 | 346 |
} |
| 347 | 347 |
}; |
| 348 | 348 |
|
| 349 | 349 |
void first(Blue& node) const {
|
| 350 | 350 |
Parent::firstBlue(static_cast<Node&>(node)); |
| 351 | 351 |
} |
| 352 | 352 |
void next(Blue& node) const {
|
| 353 | 353 |
Parent::nextBlue(static_cast<Node&>(node)); |
| 354 | 354 |
} |
| 355 | 355 |
|
| 356 | 356 |
int id(const Blue& node) const {
|
| 357 | 357 |
return Parent::redId(node); |
| 358 | 358 |
} |
| 359 | 359 |
|
| 360 | 360 |
Node source(const Edge& arc) const {
|
| 361 | 361 |
return red(arc); |
| 362 | 362 |
} |
| ... | ... |
@@ -1237,49 +1237,49 @@ |
| 1237 | 1237 |
/// |
| 1238 | 1238 |
/// This interface of the DFS algorithm should be used in special cases |
| 1239 | 1239 |
/// when extra actions have to be performed in connection with certain |
| 1240 | 1240 |
/// events of the DFS algorithm. Otherwise consider to use Dfs or dfs() |
| 1241 | 1241 |
/// instead. |
| 1242 | 1242 |
/// |
| 1243 | 1243 |
/// \tparam _Digraph The type of the digraph the algorithm runs on. |
| 1244 | 1244 |
/// The default value is |
| 1245 | 1245 |
/// \ref ListDigraph. The value of _Digraph is not used directly by |
| 1246 | 1246 |
/// \ref DfsVisit, it is only passed to \ref DfsVisitDefaultTraits. |
| 1247 | 1247 |
/// \tparam _Visitor The Visitor type that is used by the algorithm. |
| 1248 | 1248 |
/// \ref DfsVisitor "DfsVisitor<_Digraph>" is an empty visitor, which |
| 1249 | 1249 |
/// does not observe the DFS events. If you want to observe the DFS |
| 1250 | 1250 |
/// events, you should implement your own visitor class. |
| 1251 | 1251 |
/// \tparam _Traits Traits class to set various data types used by the |
| 1252 | 1252 |
/// algorithm. The default traits class is |
| 1253 | 1253 |
/// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<_Digraph>". |
| 1254 | 1254 |
/// See \ref DfsVisitDefaultTraits for the documentation of |
| 1255 | 1255 |
/// a DFS visit traits class. |
| 1256 | 1256 |
#ifdef DOXYGEN |
| 1257 | 1257 |
template <typename _Digraph, typename _Visitor, typename _Traits> |
| 1258 | 1258 |
#else |
| 1259 | 1259 |
template <typename _Digraph = ListDigraph, |
| 1260 | 1260 |
typename _Visitor = DfsVisitor<_Digraph>, |
| 1261 |
typename _Traits = |
|
| 1261 |
typename _Traits = DfsVisitDefaultTraits<_Digraph> > |
|
| 1262 | 1262 |
#endif |
| 1263 | 1263 |
class DfsVisit {
|
| 1264 | 1264 |
public: |
| 1265 | 1265 |
|
| 1266 | 1266 |
///The traits class. |
| 1267 | 1267 |
typedef _Traits Traits; |
| 1268 | 1268 |
|
| 1269 | 1269 |
///The type of the digraph the algorithm runs on. |
| 1270 | 1270 |
typedef typename Traits::Digraph Digraph; |
| 1271 | 1271 |
|
| 1272 | 1272 |
///The visitor type used by the algorithm. |
| 1273 | 1273 |
typedef _Visitor Visitor; |
| 1274 | 1274 |
|
| 1275 | 1275 |
///The type of the map that indicates which nodes are reached. |
| 1276 | 1276 |
typedef typename Traits::ReachedMap ReachedMap; |
| 1277 | 1277 |
|
| 1278 | 1278 |
private: |
| 1279 | 1279 |
|
| 1280 | 1280 |
typedef typename Digraph::Node Node; |
| 1281 | 1281 |
typedef typename Digraph::NodeIt NodeIt; |
| 1282 | 1282 |
typedef typename Digraph::Arc Arc; |
| 1283 | 1283 |
typedef typename Digraph::OutArcIt OutArcIt; |
| 1284 | 1284 |
|
| 1285 | 1285 |
//Pointer to the underlying digraph. |
0 comments (0 inline)