0
3
0
| ... | ... |
@@ -1415,26 +1415,26 @@ |
| 1415 | 1415 |
/// \brief Erase an arc from the graph. |
| 1416 | 1416 |
/// |
| 1417 | 1417 |
/// Erase an arc from the graph. |
| 1418 | 1418 |
/// |
| 1419 | 1419 |
void erase(const Edge&) {}
|
| 1420 | 1420 |
|
| 1421 | 1421 |
template <typename _Graph> |
| 1422 | 1422 |
struct Constraints {
|
| 1423 | 1423 |
void constraints() {
|
| 1424 | 1424 |
checkConcept<Base, _Graph>(); |
| 1425 | 1425 |
typename _Graph::Node node; |
| 1426 | 1426 |
graph.erase(node); |
| 1427 |
typename _Graph::Arc arc; |
|
| 1428 |
graph.erase(arc); |
|
| 1427 |
typename _Graph::Edge edge; |
|
| 1428 |
graph.erase(edge); |
|
| 1429 | 1429 |
} |
| 1430 | 1430 |
|
| 1431 | 1431 |
_Graph& graph; |
| 1432 | 1432 |
}; |
| 1433 | 1433 |
}; |
| 1434 | 1434 |
|
| 1435 | 1435 |
/// \brief An empty clearable base digraph class. |
| 1436 | 1436 |
/// |
| 1437 | 1437 |
/// This class provides beside the core digraph features core clear |
| 1438 | 1438 |
/// functions for the digraph structure. The main difference between |
| 1439 | 1439 |
/// the base and this interface is that the digraph alterations |
| 1440 | 1440 |
/// should handled already on this level. |
| ... | ... |
@@ -13,34 +13,32 @@ |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#ifndef LEMON_DIJKSTRA_H |
| 20 | 20 |
#define LEMON_DIJKSTRA_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup shortest_path |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Dijkstra algorithm. |
| 25 |
/// |
|
| 26 | 25 |
|
| 27 |
#include <lemon/ |
|
| 26 |
#include <lemon/list_graph.h> |
|
| 28 | 27 |
#include <lemon/bin_heap.h> |
| 29 | 28 |
#include <lemon/bits/path_dump.h> |
| 30 | 29 |
#include <lemon/bits/invalid.h> |
| 31 | 30 |
#include <lemon/error.h> |
| 32 | 31 |
#include <lemon/maps.h> |
| 33 | 32 |
|
| 34 |
|
|
| 35 | 33 |
namespace lemon {
|
| 36 | 34 |
|
| 37 | 35 |
/// \brief Default OperationTraits for the Dijkstra algorithm class. |
| 38 | 36 |
/// |
| 39 | 37 |
/// It defines all computational operations and constants which are |
| 40 | 38 |
/// used in the Dijkstra algorithm. |
| 41 | 39 |
template <typename Value> |
| 42 | 40 |
struct DijkstraDefaultOperationTraits {
|
| 43 | 41 |
/// \brief Gives back the zero value of the type. |
| 44 | 42 |
static Value zero() {
|
| 45 | 43 |
return static_cast<Value>(0); |
| 46 | 44 |
} |
| ... | ... |
@@ -393,38 +393,38 @@ |
| 393 | 393 |
namespace _graph_utils_bits {
|
| 394 | 394 |
|
| 395 | 395 |
template <typename Graph, typename Enable = void> |
| 396 | 396 |
struct FindEdgeSelector {
|
| 397 | 397 |
typedef typename Graph::Node Node; |
| 398 | 398 |
typedef typename Graph::Edge Edge; |
| 399 | 399 |
static Edge find(const Graph &g, Node u, Node v, Edge e) {
|
| 400 | 400 |
bool b; |
| 401 | 401 |
if (u != v) {
|
| 402 | 402 |
if (e == INVALID) {
|
| 403 | 403 |
g.firstInc(e, b, u); |
| 404 | 404 |
} else {
|
| 405 |
b = g. |
|
| 405 |
b = g.u(e) == u; |
|
| 406 | 406 |
g.nextInc(e, b); |
| 407 | 407 |
} |
| 408 |
while (e != INVALID && (b ? g. |
|
| 408 |
while (e != INVALID && (b ? g.v(e) : g.u(e)) != v) {
|
|
| 409 | 409 |
g.nextInc(e, b); |
| 410 | 410 |
} |
| 411 | 411 |
} else {
|
| 412 | 412 |
if (e == INVALID) {
|
| 413 | 413 |
g.firstInc(e, b, u); |
| 414 | 414 |
} else {
|
| 415 | 415 |
b = true; |
| 416 | 416 |
g.nextInc(e, b); |
| 417 | 417 |
} |
| 418 |
while (e != INVALID && (!b || g. |
|
| 418 |
while (e != INVALID && (!b || g.v(e) != v)) {
|
|
| 419 | 419 |
g.nextInc(e, b); |
| 420 | 420 |
} |
| 421 | 421 |
} |
| 422 | 422 |
return e; |
| 423 | 423 |
} |
| 424 | 424 |
}; |
| 425 | 425 |
|
| 426 | 426 |
template <typename Graph> |
| 427 | 427 |
struct FindEdgeSelector< |
| 428 | 428 |
Graph, |
| 429 | 429 |
typename enable_if<typename Graph::FindEdgeTag, void>::type> |
| 430 | 430 |
{
|
| ... | ... |
@@ -446,25 +446,25 @@ |
| 446 | 446 |
/// it finds the first arc from \c u to \c v. Otherwise it looks for |
| 447 | 447 |
/// the next arc from \c u to \c v after \c prev. |
| 448 | 448 |
/// \return The found arc or \ref INVALID if there is no such an arc. |
| 449 | 449 |
/// |
| 450 | 450 |
/// Thus you can iterate through each arc from \c u to \c v as it follows. |
| 451 | 451 |
///\code |
| 452 | 452 |
/// for(Edge e = findEdge(g,u,v); e != INVALID; |
| 453 | 453 |
/// e = findEdge(g,u,v,e)) {
|
| 454 | 454 |
/// ... |
| 455 | 455 |
/// } |
| 456 | 456 |
///\endcode |
| 457 | 457 |
/// |
| 458 |
///\sa |
|
| 458 |
///\sa ConEdgeIt |
|
| 459 | 459 |
|
| 460 | 460 |
template <typename Graph> |
| 461 | 461 |
inline typename Graph::Edge |
| 462 | 462 |
findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, |
| 463 | 463 |
typename Graph::Edge p = INVALID) {
|
| 464 | 464 |
return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, p); |
| 465 | 465 |
} |
| 466 | 466 |
|
| 467 | 467 |
/// \brief Iterator for iterating on edges connected the same nodes. |
| 468 | 468 |
/// |
| 469 | 469 |
/// Iterator for iterating on edges connected the same nodes. It is |
| 470 | 470 |
/// higher level interface for the findEdge() function. You can |
| ... | ... |
@@ -495,26 +495,26 @@ |
| 495 | 495 |
} |
| 496 | 496 |
|
| 497 | 497 |
/// \brief Constructor. |
| 498 | 498 |
/// |
| 499 | 499 |
/// Construct a new ConEdgeIt which continues the iterating from |
| 500 | 500 |
/// the \c e edge. |
| 501 | 501 |
ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
|
| 502 | 502 |
|
| 503 | 503 |
/// \brief Increment operator. |
| 504 | 504 |
/// |
| 505 | 505 |
/// It increments the iterator and gives back the next edge. |
| 506 | 506 |
ConEdgeIt& operator++() {
|
| 507 |
Parent::operator=(findEdge(_graph, _graph.source(*this), |
|
| 508 |
_graph.target(*this), *this)); |
|
| 507 |
Parent::operator=(findEdge(_graph, _graph.u(*this), |
|
| 508 |
_graph.v(*this), *this)); |
|
| 509 | 509 |
return *this; |
| 510 | 510 |
} |
| 511 | 511 |
private: |
| 512 | 512 |
const Graph& _graph; |
| 513 | 513 |
}; |
| 514 | 514 |
|
| 515 | 515 |
namespace _graph_utils_bits {
|
| 516 | 516 |
|
| 517 | 517 |
template <typename Digraph, typename Item, typename RefMap> |
| 518 | 518 |
class MapCopyBase {
|
| 519 | 519 |
public: |
| 520 | 520 |
virtual void copy(const Digraph& from, const RefMap& refMap) = 0; |
0 comments (0 inline)