0
2
0
... | ... |
@@ -159,295 +159,328 @@ |
159 | 159 |
|
160 | 160 |
|
161 | 161 |
/// Class for identifying an arc of the digraph |
162 | 162 |
|
163 | 163 |
/// This class identifies an arc of the digraph. It also serves |
164 | 164 |
/// as a base class of the arc iterators, |
165 | 165 |
/// thus they will convert to this type. |
166 | 166 |
class Arc { |
167 | 167 |
public: |
168 | 168 |
/// Default constructor |
169 | 169 |
|
170 | 170 |
/// @warning The default constructor sets the iterator |
171 | 171 |
/// to an undefined value. |
172 | 172 |
Arc() { } |
173 | 173 |
/// Copy constructor. |
174 | 174 |
|
175 | 175 |
/// Copy constructor. |
176 | 176 |
/// |
177 | 177 |
Arc(const Arc&) { } |
178 | 178 |
/// Initialize the iterator to be invalid. |
179 | 179 |
|
180 | 180 |
/// Initialize the iterator to be invalid. |
181 | 181 |
/// |
182 | 182 |
Arc(Invalid) { } |
183 | 183 |
/// Equality operator |
184 | 184 |
|
185 | 185 |
/// Two iterators are equal if and only if they point to the |
186 | 186 |
/// same object or both are invalid. |
187 | 187 |
bool operator==(Arc) const { return true; } |
188 | 188 |
/// Inequality operator |
189 | 189 |
|
190 | 190 |
/// \sa operator==(Arc n) |
191 | 191 |
/// |
192 | 192 |
bool operator!=(Arc) const { return true; } |
193 | 193 |
|
194 | 194 |
/// Artificial ordering operator. |
195 | 195 |
|
196 | 196 |
/// To allow the use of digraph descriptors as key type in std::map or |
197 | 197 |
/// similar associative container we require this. |
198 | 198 |
/// |
199 | 199 |
/// \note This operator only have to define some strict ordering of |
200 | 200 |
/// the items; this order has nothing to do with the iteration |
201 | 201 |
/// ordering of the items. |
202 | 202 |
bool operator<(Arc) const { return false; } |
203 | 203 |
}; |
204 | 204 |
|
205 | 205 |
/// This iterator goes trough the outgoing arcs of a node. |
206 | 206 |
|
207 | 207 |
/// This iterator goes trough the \e outgoing arcs of a certain node |
208 | 208 |
/// of a digraph. |
209 | 209 |
/// Its usage is quite simple, for example you can count the number |
210 | 210 |
/// of outgoing arcs of a node \c n |
211 | 211 |
/// in digraph \c g of type \c Digraph as follows. |
212 | 212 |
///\code |
213 | 213 |
/// int count=0; |
214 | 214 |
/// for (Digraph::OutArcIt e(g, n); e!=INVALID; ++e) ++count; |
215 | 215 |
///\endcode |
216 | 216 |
|
217 | 217 |
class OutArcIt : public Arc { |
218 | 218 |
public: |
219 | 219 |
/// Default constructor |
220 | 220 |
|
221 | 221 |
/// @warning The default constructor sets the iterator |
222 | 222 |
/// to an undefined value. |
223 | 223 |
OutArcIt() { } |
224 | 224 |
/// Copy constructor. |
225 | 225 |
|
226 | 226 |
/// Copy constructor. |
227 | 227 |
/// |
228 | 228 |
OutArcIt(const OutArcIt& e) : Arc(e) { } |
229 | 229 |
/// Initialize the iterator to be invalid. |
230 | 230 |
|
231 | 231 |
/// Initialize the iterator to be invalid. |
232 | 232 |
/// |
233 | 233 |
OutArcIt(Invalid) { } |
234 | 234 |
/// This constructor sets the iterator to the first outgoing arc. |
235 | 235 |
|
236 | 236 |
/// This constructor sets the iterator to the first outgoing arc of |
237 | 237 |
/// the node. |
238 | 238 |
OutArcIt(const Digraph&, const Node&) { } |
239 | 239 |
/// Arc -> OutArcIt conversion |
240 | 240 |
|
241 | 241 |
/// Sets the iterator to the value of the trivial iterator. |
242 | 242 |
/// This feature necessitates that each time we |
243 | 243 |
/// iterate the arc-set, the iteration order is the same. |
244 | 244 |
OutArcIt(const Digraph&, const Arc&) { } |
245 | 245 |
///Next outgoing arc |
246 | 246 |
|
247 | 247 |
/// Assign the iterator to the next |
248 | 248 |
/// outgoing arc of the corresponding node. |
249 | 249 |
OutArcIt& operator++() { return *this; } |
250 | 250 |
}; |
251 | 251 |
|
252 | 252 |
/// This iterator goes trough the incoming arcs of a node. |
253 | 253 |
|
254 | 254 |
/// This iterator goes trough the \e incoming arcs of a certain node |
255 | 255 |
/// of a digraph. |
256 | 256 |
/// Its usage is quite simple, for example you can count the number |
257 | 257 |
/// of outgoing arcs of a node \c n |
258 | 258 |
/// in digraph \c g of type \c Digraph as follows. |
259 | 259 |
///\code |
260 | 260 |
/// int count=0; |
261 | 261 |
/// for(Digraph::InArcIt e(g, n); e!=INVALID; ++e) ++count; |
262 | 262 |
///\endcode |
263 | 263 |
|
264 | 264 |
class InArcIt : public Arc { |
265 | 265 |
public: |
266 | 266 |
/// Default constructor |
267 | 267 |
|
268 | 268 |
/// @warning The default constructor sets the iterator |
269 | 269 |
/// to an undefined value. |
270 | 270 |
InArcIt() { } |
271 | 271 |
/// Copy constructor. |
272 | 272 |
|
273 | 273 |
/// Copy constructor. |
274 | 274 |
/// |
275 | 275 |
InArcIt(const InArcIt& e) : Arc(e) { } |
276 | 276 |
/// Initialize the iterator to be invalid. |
277 | 277 |
|
278 | 278 |
/// Initialize the iterator to be invalid. |
279 | 279 |
/// |
280 | 280 |
InArcIt(Invalid) { } |
281 | 281 |
/// This constructor sets the iterator to first incoming arc. |
282 | 282 |
|
283 | 283 |
/// This constructor set the iterator to the first incoming arc of |
284 | 284 |
/// the node. |
285 | 285 |
InArcIt(const Digraph&, const Node&) { } |
286 | 286 |
/// Arc -> InArcIt conversion |
287 | 287 |
|
288 | 288 |
/// Sets the iterator to the value of the trivial iterator \c e. |
289 | 289 |
/// This feature necessitates that each time we |
290 | 290 |
/// iterate the arc-set, the iteration order is the same. |
291 | 291 |
InArcIt(const Digraph&, const Arc&) { } |
292 | 292 |
/// Next incoming arc |
293 | 293 |
|
294 | 294 |
/// Assign the iterator to the next inarc of the corresponding node. |
295 | 295 |
/// |
296 | 296 |
InArcIt& operator++() { return *this; } |
297 | 297 |
}; |
298 | 298 |
/// This iterator goes through each arc. |
299 | 299 |
|
300 | 300 |
/// This iterator goes through each arc of a digraph. |
301 | 301 |
/// Its usage is quite simple, for example you can count the number |
302 | 302 |
/// of arcs in a digraph \c g of type \c Digraph as follows: |
303 | 303 |
///\code |
304 | 304 |
/// int count=0; |
305 | 305 |
/// for(Digraph::ArcIt e(g); e!=INVALID; ++e) ++count; |
306 | 306 |
///\endcode |
307 | 307 |
class ArcIt : public Arc { |
308 | 308 |
public: |
309 | 309 |
/// Default constructor |
310 | 310 |
|
311 | 311 |
/// @warning The default constructor sets the iterator |
312 | 312 |
/// to an undefined value. |
313 | 313 |
ArcIt() { } |
314 | 314 |
/// Copy constructor. |
315 | 315 |
|
316 | 316 |
/// Copy constructor. |
317 | 317 |
/// |
318 | 318 |
ArcIt(const ArcIt& e) : Arc(e) { } |
319 | 319 |
/// Initialize the iterator to be invalid. |
320 | 320 |
|
321 | 321 |
/// Initialize the iterator to be invalid. |
322 | 322 |
/// |
323 | 323 |
ArcIt(Invalid) { } |
324 | 324 |
/// This constructor sets the iterator to the first arc. |
325 | 325 |
|
326 | 326 |
/// This constructor sets the iterator to the first arc of \c g. |
327 | 327 |
///@param g the digraph |
328 | 328 |
ArcIt(const Digraph& g) { ignore_unused_variable_warning(g); } |
329 | 329 |
/// Arc -> ArcIt conversion |
330 | 330 |
|
331 | 331 |
/// Sets the iterator to the value of the trivial iterator \c e. |
332 | 332 |
/// This feature necessitates that each time we |
333 | 333 |
/// iterate the arc-set, the iteration order is the same. |
334 | 334 |
ArcIt(const Digraph&, const Arc&) { } |
335 | 335 |
///Next arc |
336 | 336 |
|
337 | 337 |
/// Assign the iterator to the next arc. |
338 | 338 |
ArcIt& operator++() { return *this; } |
339 | 339 |
}; |
340 | 340 |
///Gives back the target node of an arc. |
341 | 341 |
|
342 | 342 |
///Gives back the target node of an arc. |
343 | 343 |
/// |
344 | 344 |
Node target(Arc) const { return INVALID; } |
345 | 345 |
///Gives back the source node of an arc. |
346 | 346 |
|
347 | 347 |
///Gives back the source node of an arc. |
348 | 348 |
/// |
349 | 349 |
Node source(Arc) const { return INVALID; } |
350 | 350 |
|
351 |
/// \brief Returns the ID of the node. |
|
352 |
int id(Node) const { return -1; } |
|
353 |
|
|
354 |
/// \brief Returns the ID of the arc. |
|
355 |
int id(Arc) const { return -1; } |
|
356 |
|
|
357 |
/// \brief Returns the node with the given ID. |
|
358 |
/// |
|
359 |
/// \pre The argument should be a valid node ID in the graph. |
|
360 |
Node nodeFromId(int) const { return INVALID; } |
|
361 |
|
|
362 |
/// \brief Returns the arc with the given ID. |
|
363 |
/// |
|
364 |
/// \pre The argument should be a valid arc ID in the graph. |
|
365 |
Arc arcFromId(int) const { return INVALID; } |
|
366 |
|
|
367 |
/// \brief Returns an upper bound on the node IDs. |
|
368 |
int maxNodeId() const { return -1; } |
|
369 |
|
|
370 |
/// \brief Returns an upper bound on the arc IDs. |
|
371 |
int maxArcId() const { return -1; } |
|
372 |
|
|
351 | 373 |
void first(Node&) const {} |
352 | 374 |
void next(Node&) const {} |
353 | 375 |
|
354 | 376 |
void first(Arc&) const {} |
355 | 377 |
void next(Arc&) const {} |
356 | 378 |
|
357 | 379 |
|
358 | 380 |
void firstIn(Arc&, const Node&) const {} |
359 | 381 |
void nextIn(Arc&) const {} |
360 | 382 |
|
361 | 383 |
void firstOut(Arc&, const Node&) const {} |
362 | 384 |
void nextOut(Arc&) const {} |
363 | 385 |
|
386 |
// The second parameter is dummy. |
|
387 |
Node fromId(int, Node) const { return INVALID; } |
|
388 |
// The second parameter is dummy. |
|
389 |
Arc fromId(int, Arc) const { return INVALID; } |
|
390 |
|
|
391 |
// Dummy parameter. |
|
392 |
int maxId(Node) const { return -1; } |
|
393 |
// Dummy parameter. |
|
394 |
int maxId(Arc) const { return -1; } |
|
395 |
|
|
364 | 396 |
/// \brief The base node of the iterator. |
365 | 397 |
/// |
366 | 398 |
/// Gives back the base node of the iterator. |
367 | 399 |
/// It is always the target of the pointed arc. |
368 | 400 |
Node baseNode(const InArcIt&) const { return INVALID; } |
369 | 401 |
|
370 | 402 |
/// \brief The running node of the iterator. |
371 | 403 |
/// |
372 | 404 |
/// Gives back the running node of the iterator. |
373 | 405 |
/// It is always the source of the pointed arc. |
374 | 406 |
Node runningNode(const InArcIt&) const { return INVALID; } |
375 | 407 |
|
376 | 408 |
/// \brief The base node of the iterator. |
377 | 409 |
/// |
378 | 410 |
/// Gives back the base node of the iterator. |
379 | 411 |
/// It is always the source of the pointed arc. |
380 | 412 |
Node baseNode(const OutArcIt&) const { return INVALID; } |
381 | 413 |
|
382 | 414 |
/// \brief The running node of the iterator. |
383 | 415 |
/// |
384 | 416 |
/// Gives back the running node of the iterator. |
385 | 417 |
/// It is always the target of the pointed arc. |
386 | 418 |
Node runningNode(const OutArcIt&) const { return INVALID; } |
387 | 419 |
|
388 | 420 |
/// \brief The opposite node on the given arc. |
389 | 421 |
/// |
390 | 422 |
/// Gives back the opposite node on the given arc. |
391 | 423 |
Node oppositeNode(const Node&, const Arc&) const { return INVALID; } |
392 | 424 |
|
393 | 425 |
/// \brief Read write map of the nodes to type \c T. |
394 | 426 |
/// |
395 | 427 |
/// ReadWrite map of the nodes to type \c T. |
396 | 428 |
/// \sa Reference |
397 | 429 |
template<class T> |
398 | 430 |
class NodeMap : public ReadWriteMap< Node, T > { |
399 | 431 |
public: |
400 | 432 |
|
401 | 433 |
///\e |
402 | 434 |
NodeMap(const Digraph&) { } |
403 | 435 |
///\e |
404 | 436 |
NodeMap(const Digraph&, T) { } |
405 | 437 |
|
406 | 438 |
///Copy constructor |
407 | 439 |
NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } |
408 | 440 |
///Assignment operator |
409 | 441 |
template <typename CMap> |
410 | 442 |
NodeMap& operator=(const CMap&) { |
411 | 443 |
checkConcept<ReadMap<Node, T>, CMap>(); |
412 | 444 |
return *this; |
413 | 445 |
} |
414 | 446 |
}; |
415 | 447 |
|
416 | 448 |
/// \brief Read write map of the arcs to type \c T. |
417 | 449 |
/// |
418 | 450 |
/// Reference map of the arcs to type \c T. |
419 | 451 |
/// \sa Reference |
420 | 452 |
template<class T> |
421 | 453 |
class ArcMap : public ReadWriteMap<Arc,T> { |
422 | 454 |
public: |
423 | 455 |
|
424 | 456 |
///\e |
425 | 457 |
ArcMap(const Digraph&) { } |
426 | 458 |
///\e |
427 | 459 |
ArcMap(const Digraph&, T) { } |
428 | 460 |
///Copy constructor |
429 | 461 |
ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { } |
430 | 462 |
///Assignment operator |
431 | 463 |
template <typename CMap> |
432 | 464 |
ArcMap& operator=(const CMap&) { |
433 | 465 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
434 | 466 |
return *this; |
435 | 467 |
} |
436 | 468 |
}; |
437 | 469 |
|
438 | 470 |
template <typename RDigraph> |
439 | 471 |
struct Constraints { |
440 | 472 |
void constraints() { |
441 | 473 |
checkConcept<IterableDigraphComponent<>, Digraph>(); |
474 |
checkConcept<IDableDigraphComponent<>, Digraph>(); |
|
442 | 475 |
checkConcept<MappableDigraphComponent<>, Digraph>(); |
443 | 476 |
} |
444 | 477 |
}; |
445 | 478 |
|
446 | 479 |
}; |
447 | 480 |
|
448 | 481 |
} //namespace concepts |
449 | 482 |
} //namespace lemon |
450 | 483 |
|
451 | 484 |
|
452 | 485 |
|
453 | 486 |
#endif // LEMON_CONCEPT_DIGRAPH_H |
... | ... |
@@ -435,268 +435,315 @@ |
435 | 435 |
} |
436 | 436 |
/// Arc -> OutArcIt conversion |
437 | 437 |
|
438 | 438 |
/// Sets the iterator to the value of the trivial iterator. |
439 | 439 |
/// This feature necessitates that each time we |
440 | 440 |
/// iterate the arc-set, the iteration order is the same. |
441 | 441 |
OutArcIt(const Graph&, const Arc&) { } |
442 | 442 |
///Next outgoing arc |
443 | 443 |
|
444 | 444 |
/// Assign the iterator to the next |
445 | 445 |
/// outgoing arc of the corresponding node. |
446 | 446 |
OutArcIt& operator++() { return *this; } |
447 | 447 |
}; |
448 | 448 |
|
449 | 449 |
/// This iterator goes trough the incoming directed arcs of a node. |
450 | 450 |
|
451 | 451 |
/// This iterator goes trough the \e incoming arcs of a certain node |
452 | 452 |
/// of a graph. |
453 | 453 |
/// Its usage is quite simple, for example you can count the number |
454 | 454 |
/// of outgoing arcs of a node \c n |
455 | 455 |
/// in graph \c g of type \c Graph as follows. |
456 | 456 |
///\code |
457 | 457 |
/// int count=0; |
458 | 458 |
/// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count; |
459 | 459 |
///\endcode |
460 | 460 |
|
461 | 461 |
class InArcIt : public Arc { |
462 | 462 |
public: |
463 | 463 |
/// Default constructor |
464 | 464 |
|
465 | 465 |
/// @warning The default constructor sets the iterator |
466 | 466 |
/// to an undefined value. |
467 | 467 |
InArcIt() { } |
468 | 468 |
/// Copy constructor. |
469 | 469 |
|
470 | 470 |
/// Copy constructor. |
471 | 471 |
/// |
472 | 472 |
InArcIt(const InArcIt& e) : Arc(e) { } |
473 | 473 |
/// Initialize the iterator to be invalid. |
474 | 474 |
|
475 | 475 |
/// Initialize the iterator to be invalid. |
476 | 476 |
/// |
477 | 477 |
InArcIt(Invalid) { } |
478 | 478 |
/// This constructor sets the iterator to first incoming arc. |
479 | 479 |
|
480 | 480 |
/// This constructor set the iterator to the first incoming arc of |
481 | 481 |
/// the node. |
482 | 482 |
///@param n the node |
483 | 483 |
///@param g the graph |
484 | 484 |
InArcIt(const Graph& g, const Node& n) { |
485 | 485 |
ignore_unused_variable_warning(n); |
486 | 486 |
ignore_unused_variable_warning(g); |
487 | 487 |
} |
488 | 488 |
/// Arc -> InArcIt conversion |
489 | 489 |
|
490 | 490 |
/// Sets the iterator to the value of the trivial iterator \c e. |
491 | 491 |
/// This feature necessitates that each time we |
492 | 492 |
/// iterate the arc-set, the iteration order is the same. |
493 | 493 |
InArcIt(const Graph&, const Arc&) { } |
494 | 494 |
/// Next incoming arc |
495 | 495 |
|
496 | 496 |
/// Assign the iterator to the next inarc of the corresponding node. |
497 | 497 |
/// |
498 | 498 |
InArcIt& operator++() { return *this; } |
499 | 499 |
}; |
500 | 500 |
|
501 | 501 |
/// \brief Read write map of the nodes to type \c T. |
502 | 502 |
/// |
503 | 503 |
/// ReadWrite map of the nodes to type \c T. |
504 | 504 |
/// \sa Reference |
505 | 505 |
template<class T> |
506 | 506 |
class NodeMap : public ReadWriteMap< Node, T > |
507 | 507 |
{ |
508 | 508 |
public: |
509 | 509 |
|
510 | 510 |
///\e |
511 | 511 |
NodeMap(const Graph&) { } |
512 | 512 |
///\e |
513 | 513 |
NodeMap(const Graph&, T) { } |
514 | 514 |
|
515 | 515 |
///Copy constructor |
516 | 516 |
NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } |
517 | 517 |
///Assignment operator |
518 | 518 |
template <typename CMap> |
519 | 519 |
NodeMap& operator=(const CMap&) { |
520 | 520 |
checkConcept<ReadMap<Node, T>, CMap>(); |
521 | 521 |
return *this; |
522 | 522 |
} |
523 | 523 |
}; |
524 | 524 |
|
525 | 525 |
/// \brief Read write map of the directed arcs to type \c T. |
526 | 526 |
/// |
527 | 527 |
/// Reference map of the directed arcs to type \c T. |
528 | 528 |
/// \sa Reference |
529 | 529 |
template<class T> |
530 | 530 |
class ArcMap : public ReadWriteMap<Arc,T> |
531 | 531 |
{ |
532 | 532 |
public: |
533 | 533 |
|
534 | 534 |
///\e |
535 | 535 |
ArcMap(const Graph&) { } |
536 | 536 |
///\e |
537 | 537 |
ArcMap(const Graph&, T) { } |
538 | 538 |
///Copy constructor |
539 | 539 |
ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { } |
540 | 540 |
///Assignment operator |
541 | 541 |
template <typename CMap> |
542 | 542 |
ArcMap& operator=(const CMap&) { |
543 | 543 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
544 | 544 |
return *this; |
545 | 545 |
} |
546 | 546 |
}; |
547 | 547 |
|
548 | 548 |
/// Read write map of the edges to type \c T. |
549 | 549 |
|
550 | 550 |
/// Reference map of the arcs to type \c T. |
551 | 551 |
/// \sa Reference |
552 | 552 |
template<class T> |
553 | 553 |
class EdgeMap : public ReadWriteMap<Edge,T> |
554 | 554 |
{ |
555 | 555 |
public: |
556 | 556 |
|
557 | 557 |
///\e |
558 | 558 |
EdgeMap(const Graph&) { } |
559 | 559 |
///\e |
560 | 560 |
EdgeMap(const Graph&, T) { } |
561 | 561 |
///Copy constructor |
562 | 562 |
EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {} |
563 | 563 |
///Assignment operator |
564 | 564 |
template <typename CMap> |
565 | 565 |
EdgeMap& operator=(const CMap&) { |
566 | 566 |
checkConcept<ReadMap<Edge, T>, CMap>(); |
567 | 567 |
return *this; |
568 | 568 |
} |
569 | 569 |
}; |
570 | 570 |
|
571 | 571 |
/// \brief Direct the given edge. |
572 | 572 |
/// |
573 | 573 |
/// Direct the given edge. The returned arc source |
574 | 574 |
/// will be the given node. |
575 | 575 |
Arc direct(const Edge&, const Node&) const { |
576 | 576 |
return INVALID; |
577 | 577 |
} |
578 | 578 |
|
579 | 579 |
/// \brief Direct the given edge. |
580 | 580 |
/// |
581 | 581 |
/// Direct the given edge. The returned arc |
582 | 582 |
/// represents the given edge and the direction comes |
583 | 583 |
/// from the bool parameter. The source of the edge and |
584 | 584 |
/// the directed arc is the same when the given bool is true. |
585 | 585 |
Arc direct(const Edge&, bool) const { |
586 | 586 |
return INVALID; |
587 | 587 |
} |
588 | 588 |
|
589 | 589 |
/// \brief Returns true if the arc has default orientation. |
590 | 590 |
/// |
591 | 591 |
/// Returns whether the given directed arc is same orientation as |
592 | 592 |
/// the corresponding edge's default orientation. |
593 | 593 |
bool direction(Arc) const { return true; } |
594 | 594 |
|
595 | 595 |
/// \brief Returns the opposite directed arc. |
596 | 596 |
/// |
597 | 597 |
/// Returns the opposite directed arc. |
598 | 598 |
Arc oppositeArc(Arc) const { return INVALID; } |
599 | 599 |
|
600 | 600 |
/// \brief Opposite node on an arc |
601 | 601 |
/// |
602 | 602 |
/// \return the opposite of the given Node on the given Edge |
603 | 603 |
Node oppositeNode(Node, Edge) const { return INVALID; } |
604 | 604 |
|
605 | 605 |
/// \brief First node of the edge. |
606 | 606 |
/// |
607 | 607 |
/// \return the first node of the given Edge. |
608 | 608 |
/// |
609 | 609 |
/// Naturally edges don't have direction and thus |
610 | 610 |
/// don't have source and target node. But we use these two methods |
611 | 611 |
/// to query the two nodes of the arc. The direction of the arc |
612 | 612 |
/// which arises this way is called the inherent direction of the |
613 | 613 |
/// edge, and is used to define the "default" direction |
614 | 614 |
/// of the directed versions of the arcs. |
615 | 615 |
/// \sa direction |
616 | 616 |
Node u(Edge) const { return INVALID; } |
617 | 617 |
|
618 | 618 |
/// \brief Second node of the edge. |
619 | 619 |
Node v(Edge) const { return INVALID; } |
620 | 620 |
|
621 | 621 |
/// \brief Source node of the directed arc. |
622 | 622 |
Node source(Arc) const { return INVALID; } |
623 | 623 |
|
624 | 624 |
/// \brief Target node of the directed arc. |
625 | 625 |
Node target(Arc) const { return INVALID; } |
626 | 626 |
|
627 |
/// \brief Returns the id of the node. |
|
628 |
int id(Node) const { return -1; } |
|
629 |
|
|
630 |
/// \brief Returns the id of the edge. |
|
631 |
int id(Edge) const { return -1; } |
|
632 |
|
|
633 |
/// \brief Returns the id of the arc. |
|
634 |
int id(Arc) const { return -1; } |
|
635 |
|
|
636 |
/// \brief Returns the node with the given id. |
|
637 |
/// |
|
638 |
/// \pre The argument should be a valid node id in the graph. |
|
639 |
Node nodeFromId(int) const { return INVALID; } |
|
640 |
|
|
641 |
/// \brief Returns the edge with the given id. |
|
642 |
/// |
|
643 |
/// \pre The argument should be a valid edge id in the graph. |
|
644 |
Edge edgeFromId(int) const { return INVALID; } |
|
645 |
|
|
646 |
/// \brief Returns the arc with the given id. |
|
647 |
/// |
|
648 |
/// \pre The argument should be a valid arc id in the graph. |
|
649 |
Arc arcFromId(int) const { return INVALID; } |
|
650 |
|
|
651 |
/// \brief Returns an upper bound on the node IDs. |
|
652 |
int maxNodeId() const { return -1; } |
|
653 |
|
|
654 |
/// \brief Returns an upper bound on the edge IDs. |
|
655 |
int maxEdgeId() const { return -1; } |
|
656 |
|
|
657 |
/// \brief Returns an upper bound on the arc IDs. |
|
658 |
int maxArcId() const { return -1; } |
|
659 |
|
|
627 | 660 |
void first(Node&) const {} |
628 | 661 |
void next(Node&) const {} |
629 | 662 |
|
630 | 663 |
void first(Edge&) const {} |
631 | 664 |
void next(Edge&) const {} |
632 | 665 |
|
633 | 666 |
void first(Arc&) const {} |
634 | 667 |
void next(Arc&) const {} |
635 | 668 |
|
636 | 669 |
void firstOut(Arc&, Node) const {} |
637 | 670 |
void nextOut(Arc&) const {} |
638 | 671 |
|
639 | 672 |
void firstIn(Arc&, Node) const {} |
640 | 673 |
void nextIn(Arc&) const {} |
641 | 674 |
|
642 |
|
|
643 | 675 |
void firstInc(Edge &, bool &, const Node &) const {} |
644 | 676 |
void nextInc(Edge &, bool &) const {} |
645 | 677 |
|
678 |
// The second parameter is dummy. |
|
679 |
Node fromId(int, Node) const { return INVALID; } |
|
680 |
// The second parameter is dummy. |
|
681 |
Edge fromId(int, Edge) const { return INVALID; } |
|
682 |
// The second parameter is dummy. |
|
683 |
Arc fromId(int, Arc) const { return INVALID; } |
|
684 |
|
|
685 |
// Dummy parameter. |
|
686 |
int maxId(Node) const { return -1; } |
|
687 |
// Dummy parameter. |
|
688 |
int maxId(Edge) const { return -1; } |
|
689 |
// Dummy parameter. |
|
690 |
int maxId(Arc) const { return -1; } |
|
691 |
|
|
646 | 692 |
/// \brief Base node of the iterator |
647 | 693 |
/// |
648 | 694 |
/// Returns the base node (the source in this case) of the iterator |
649 | 695 |
Node baseNode(OutArcIt e) const { |
650 | 696 |
return source(e); |
651 | 697 |
} |
652 | 698 |
/// \brief Running node of the iterator |
653 | 699 |
/// |
654 | 700 |
/// Returns the running node (the target in this case) of the |
655 | 701 |
/// iterator |
656 | 702 |
Node runningNode(OutArcIt e) const { |
657 | 703 |
return target(e); |
658 | 704 |
} |
659 | 705 |
|
660 | 706 |
/// \brief Base node of the iterator |
661 | 707 |
/// |
662 | 708 |
/// Returns the base node (the target in this case) of the iterator |
663 | 709 |
Node baseNode(InArcIt e) const { |
664 | 710 |
return target(e); |
665 | 711 |
} |
666 | 712 |
/// \brief Running node of the iterator |
667 | 713 |
/// |
668 | 714 |
/// Returns the running node (the source in this case) of the |
669 | 715 |
/// iterator |
670 | 716 |
Node runningNode(InArcIt e) const { |
671 | 717 |
return source(e); |
672 | 718 |
} |
673 | 719 |
|
674 | 720 |
/// \brief Base node of the iterator |
675 | 721 |
/// |
676 | 722 |
/// Returns the base node of the iterator |
677 | 723 |
Node baseNode(IncArcIt) const { |
678 | 724 |
return INVALID; |
679 | 725 |
} |
680 | 726 |
|
681 | 727 |
/// \brief Running node of the iterator |
682 | 728 |
/// |
683 | 729 |
/// Returns the running node of the iterator |
684 | 730 |
Node runningNode(IncArcIt) const { |
685 | 731 |
return INVALID; |
686 | 732 |
} |
687 | 733 |
|
688 | 734 |
template <typename Graph> |
689 | 735 |
struct Constraints { |
690 | 736 |
void constraints() { |
691 | 737 |
checkConcept<IterableGraphComponent<>, Graph>(); |
738 |
checkConcept<IDableGraphComponent<>, Graph>(); |
|
692 | 739 |
checkConcept<MappableGraphComponent<>, Graph>(); |
693 | 740 |
} |
694 | 741 |
}; |
695 | 742 |
|
696 | 743 |
}; |
697 | 744 |
|
698 | 745 |
} |
699 | 746 |
|
700 | 747 |
} |
701 | 748 |
|
702 | 749 |
#endif |
0 comments (0 inline)