0
28
0
35
48
1
1
5
5
1
1
19
35
15
9
1
1
| ... | ... |
@@ -26,7 +26,7 @@ |
| 26 | 26 |
/// graphToEps(), and showing how to draw directed graphs, |
| 27 | 27 |
/// how to handle parallel egdes, how to change the properties (like |
| 28 | 28 |
/// color, shape, size, title etc.) of nodes and arcs individually |
| 29 |
/// using appropriate |
|
| 29 |
/// using appropriate graph maps. |
|
| 30 | 30 |
/// |
| 31 | 31 |
/// \include graph_to_eps_demo.cc |
| 32 | 32 |
| ... | ... |
@@ -54,7 +54,9 @@ |
| 54 | 54 |
|
| 55 | 55 |
You are free to use the graph structure that fit your requirements |
| 56 | 56 |
the best, most graph algorithms and auxiliary data structures can be used |
| 57 |
with any graph |
|
| 57 |
with any graph structure. |
|
| 58 |
|
|
| 59 |
<b>See also:</b> \ref graph_concepts "Graph Structure Concepts". |
|
| 58 | 60 |
*/ |
| 59 | 61 |
|
| 60 | 62 |
/** |
| ... | ... |
@@ -74,8 +76,10 @@ |
| 74 | 76 |
|
| 75 | 77 |
This group describes the map structures implemented in LEMON. |
| 76 | 78 |
|
| 77 |
LEMON provides several special purpose maps that e.g. combine |
|
| 79 |
LEMON provides several special purpose maps and map adaptors that e.g. combine |
|
| 78 | 80 |
new maps from existing ones. |
| 81 |
|
|
| 82 |
<b>See also:</b> \ref map_concepts "Map Concepts". |
|
| 79 | 83 |
*/ |
| 80 | 84 |
|
| 81 | 85 |
/** |
| ... | ... |
@@ -87,7 +91,6 @@ |
| 87 | 91 |
values to the nodes and arcs of graphs. |
| 88 | 92 |
*/ |
| 89 | 93 |
|
| 90 |
|
|
| 91 | 94 |
/** |
| 92 | 95 |
\defgroup map_adaptors Map Adaptors |
| 93 | 96 |
\ingroup maps |
| ... | ... |
@@ -104,7 +107,7 @@ |
| 104 | 107 |
The typical usage of this classes is passing implicit maps to |
| 105 | 108 |
algorithms. If a function type algorithm is called then the function |
| 106 | 109 |
type map adaptors can be used comfortable. For example let's see the |
| 107 |
usage of map adaptors with the \c |
|
| 110 |
usage of map adaptors with the \c graphToEps() function. |
|
| 108 | 111 |
\code |
| 109 | 112 |
Color nodeColor(int deg) {
|
| 110 | 113 |
if (deg >= 2) {
|
| ... | ... |
@@ -118,13 +121,13 @@ |
| 118 | 121 |
|
| 119 | 122 |
Digraph::NodeMap<int> degree_map(graph); |
| 120 | 123 |
|
| 121 |
|
|
| 124 |
graphToEps(graph, "graph.eps") |
|
| 122 | 125 |
.coords(coords).scaleToA4().undirected() |
| 123 | 126 |
.nodeColors(composeMap(functorToMap(nodeColor), degree_map)) |
| 124 | 127 |
.run(); |
| 125 | 128 |
\endcode |
| 126 | 129 |
The \c functorToMap() function makes an \c int to \c Color map from the |
| 127 |
\ |
|
| 130 |
\c nodeColor() function. The \c composeMap() compose the \c degree_map |
|
| 128 | 131 |
and the previously created map. The composed map is a proper function to |
| 129 | 132 |
get the color of each node. |
| 130 | 133 |
|
| ... | ... |
@@ -173,7 +176,6 @@ |
| 173 | 176 |
any kind of path structure. |
| 174 | 177 |
|
| 175 | 178 |
\sa lemon::concepts::Path |
| 176 |
|
|
| 177 | 179 |
*/ |
| 178 | 180 |
|
| 179 | 181 |
/** |
| ... | ... |
@@ -185,7 +187,6 @@ |
| 185 | 187 |
order to make it easier to implement combinatorial algorithms. |
| 186 | 188 |
*/ |
| 187 | 189 |
|
| 188 |
|
|
| 189 | 190 |
/** |
| 190 | 191 |
@defgroup algs Algorithms |
| 191 | 192 |
\brief This group describes the several algorithms |
| ... | ... |
@@ -201,11 +202,11 @@ |
| 201 | 202 |
\brief Common graph search algorithms. |
| 202 | 203 |
|
| 203 | 204 |
This group describes the common graph search algorithms like |
| 204 |
Breadth- |
|
| 205 |
Breadth-First Search (BFS) and Depth-First Search (DFS). |
|
| 205 | 206 |
*/ |
| 206 | 207 |
|
| 207 | 208 |
/** |
| 208 |
@defgroup shortest_path Shortest Path |
|
| 209 |
@defgroup shortest_path Shortest Path Algorithms |
|
| 209 | 210 |
@ingroup algs |
| 210 | 211 |
\brief Algorithms for finding shortest paths. |
| 211 | 212 |
|
| ... | ... |
@@ -213,7 +214,7 @@ |
| 213 | 214 |
*/ |
| 214 | 215 |
|
| 215 | 216 |
/** |
| 216 |
@defgroup max_flow Maximum Flow |
|
| 217 |
@defgroup max_flow Maximum Flow Algorithms |
|
| 217 | 218 |
@ingroup algs |
| 218 | 219 |
\brief Algorithms for finding maximum flows. |
| 219 | 220 |
|
| ... | ... |
@@ -241,11 +242,10 @@ |
| 241 | 242 |
fastest method to compute the maximum flow. All impelementations |
| 242 | 243 |
provides functions to query the minimum cut, which is the dual linear |
| 243 | 244 |
programming problem of the maximum flow. |
| 244 |
|
|
| 245 | 245 |
*/ |
| 246 | 246 |
|
| 247 | 247 |
/** |
| 248 |
@defgroup min_cost_flow Minimum Cost Flow |
|
| 248 |
@defgroup min_cost_flow Minimum Cost Flow Algorithms |
|
| 249 | 249 |
@ingroup algs |
| 250 | 250 |
|
| 251 | 251 |
\brief Algorithms for finding minimum cost flows and circulations. |
| ... | ... |
@@ -255,7 +255,7 @@ |
| 255 | 255 |
*/ |
| 256 | 256 |
|
| 257 | 257 |
/** |
| 258 |
@defgroup min_cut Minimum Cut |
|
| 258 |
@defgroup min_cut Minimum Cut Algorithms |
|
| 259 | 259 |
@ingroup algs |
| 260 | 260 |
|
| 261 | 261 |
\brief Algorithms for finding minimum cut in graphs. |
| ... | ... |
@@ -282,11 +282,10 @@ |
| 282 | 282 |
|
| 283 | 283 |
If you want to find minimum cut just between two distinict nodes, |
| 284 | 284 |
please see the \ref max_flow "Maximum Flow page". |
| 285 |
|
|
| 286 | 285 |
*/ |
| 287 | 286 |
|
| 288 | 287 |
/** |
| 289 |
@defgroup graph_prop Connectivity and |
|
| 288 |
@defgroup graph_prop Connectivity and Other Graph Properties |
|
| 290 | 289 |
@ingroup algs |
| 291 | 290 |
\brief Algorithms for discovering the graph properties |
| 292 | 291 |
|
| ... | ... |
@@ -298,7 +297,7 @@ |
| 298 | 297 |
*/ |
| 299 | 298 |
|
| 300 | 299 |
/** |
| 301 |
@defgroup planar Planarity |
|
| 300 |
@defgroup planar Planarity Embedding and Drawing |
|
| 302 | 301 |
@ingroup algs |
| 303 | 302 |
\brief Algorithms for planarity checking, embedding and drawing |
| 304 | 303 |
|
| ... | ... |
@@ -310,7 +309,7 @@ |
| 310 | 309 |
*/ |
| 311 | 310 |
|
| 312 | 311 |
/** |
| 313 |
@defgroup matching Matching |
|
| 312 |
@defgroup matching Matching Algorithms |
|
| 314 | 313 |
@ingroup algs |
| 315 | 314 |
\brief Algorithms for finding matchings in graphs and bipartite graphs. |
| 316 | 315 |
|
| ... | ... |
@@ -348,11 +347,10 @@ |
| 348 | 347 |
|
| 349 | 348 |
\image html bipartite_matching.png |
| 350 | 349 |
\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth |
| 351 |
|
|
| 352 | 350 |
*/ |
| 353 | 351 |
|
| 354 | 352 |
/** |
| 355 |
@defgroup spantree Minimum Spanning Tree |
|
| 353 |
@defgroup spantree Minimum Spanning Tree Algorithms |
|
| 356 | 354 |
@ingroup algs |
| 357 | 355 |
\brief Algorithms for finding a minimum cost spanning tree in a graph. |
| 358 | 356 |
|
| ... | ... |
@@ -360,9 +358,8 @@ |
| 360 | 358 |
tree in a graph |
| 361 | 359 |
*/ |
| 362 | 360 |
|
| 363 |
|
|
| 364 | 361 |
/** |
| 365 |
@defgroup auxalg Auxiliary |
|
| 362 |
@defgroup auxalg Auxiliary Algorithms |
|
| 366 | 363 |
@ingroup algs |
| 367 | 364 |
\brief Auxiliary algorithms implemented in LEMON. |
| 368 | 365 |
|
| ... | ... |
@@ -371,7 +368,8 @@ |
| 371 | 368 |
*/ |
| 372 | 369 |
|
| 373 | 370 |
/** |
| 374 |
@defgroup approx Approximation |
|
| 371 |
@defgroup approx Approximation Algorithms |
|
| 372 |
@ingroup algs |
|
| 375 | 373 |
\brief Approximation algorithms. |
| 376 | 374 |
|
| 377 | 375 |
This group describes the approximation and heuristic algorithms |
| ... | ... |
@@ -385,22 +383,20 @@ |
| 385 | 383 |
|
| 386 | 384 |
This group describes some general optimization frameworks |
| 387 | 385 |
implemented in LEMON. |
| 388 |
|
|
| 389 | 386 |
*/ |
| 390 | 387 |
|
| 391 | 388 |
/** |
| 392 |
@defgroup lp_group Lp and Mip |
|
| 389 |
@defgroup lp_group Lp and Mip Solvers |
|
| 393 | 390 |
@ingroup gen_opt_group |
| 394 | 391 |
\brief Lp and Mip solver interfaces for LEMON. |
| 395 | 392 |
|
| 396 | 393 |
This group describes Lp and Mip solver interfaces for LEMON. The |
| 397 | 394 |
various LP solvers could be used in the same manner with this |
| 398 | 395 |
interface. |
| 399 |
|
|
| 400 | 396 |
*/ |
| 401 | 397 |
|
| 402 | 398 |
/** |
| 403 |
@defgroup lp_utils Tools for Lp and Mip |
|
| 399 |
@defgroup lp_utils Tools for Lp and Mip Solvers |
|
| 404 | 400 |
@ingroup lp_group |
| 405 | 401 |
\brief Helper tools to the Lp and Mip solvers. |
| 406 | 402 |
|
| ... | ... |
@@ -441,7 +437,7 @@ |
| 441 | 437 |
*/ |
| 442 | 438 |
|
| 443 | 439 |
/** |
| 444 |
@defgroup timecount Time |
|
| 440 |
@defgroup timecount Time Measuring and Counting |
|
| 445 | 441 |
@ingroup misc |
| 446 | 442 |
\brief Simple tools for measuring the performance of algorithms. |
| 447 | 443 |
|
| ... | ... |
@@ -450,15 +446,6 @@ |
| 450 | 446 |
*/ |
| 451 | 447 |
|
| 452 | 448 |
/** |
| 453 |
@defgroup graphbits Tools for Graph Implementation |
|
| 454 |
@ingroup utils |
|
| 455 |
\brief Tools to make it easier to create graphs. |
|
| 456 |
|
|
| 457 |
This group describes the tools that makes it easier to create graphs and |
|
| 458 |
the maps that dynamically update with the graph changes. |
|
| 459 |
*/ |
|
| 460 |
|
|
| 461 |
/** |
|
| 462 | 449 |
@defgroup exceptions Exceptions |
| 463 | 450 |
@ingroup utils |
| 464 | 451 |
\brief Exceptions defined in LEMON. |
| ... | ... |
@@ -471,21 +458,22 @@ |
| 471 | 458 |
\brief Graph Input-Output methods |
| 472 | 459 |
|
| 473 | 460 |
This group describes the tools for importing and exporting graphs |
| 474 |
and graph related data. Now it supports the LEMON format, the |
|
| 475 |
\c DIMACS format and the encapsulated postscript (EPS) format. |
|
| 461 |
and graph related data. Now it supports the \ref lgf-format |
|
| 462 |
"LEMON Graph Format", the \c DIMACS format and the encapsulated |
|
| 463 |
postscript (EPS) format. |
|
| 476 | 464 |
*/ |
| 477 | 465 |
|
| 478 | 466 |
/** |
| 479 | 467 |
@defgroup lemon_io LEMON Input-Output |
| 480 | 468 |
@ingroup io_group |
| 481 |
\brief Reading and writing |
|
| 469 |
\brief Reading and writing LEMON Graph Format. |
|
| 482 | 470 |
|
| 483 | 471 |
This group describes methods for reading and writing |
| 484 | 472 |
\ref lgf-format "LEMON Graph Format". |
| 485 | 473 |
*/ |
| 486 | 474 |
|
| 487 | 475 |
/** |
| 488 |
@defgroup eps_io Postscript |
|
| 476 |
@defgroup eps_io Postscript Exporting |
|
| 489 | 477 |
@ingroup io_group |
| 490 | 478 |
\brief General \c EPS drawer and graph exporter |
| 491 | 479 |
|
| ... | ... |
@@ -493,7 +481,6 @@ |
| 493 | 481 |
graph exporting tools. |
| 494 | 482 |
*/ |
| 495 | 483 |
|
| 496 |
|
|
| 497 | 484 |
/** |
| 498 | 485 |
@defgroup concept Concepts |
| 499 | 486 |
\brief Skeleton classes and concept checking classes |
| ... | ... |
@@ -521,10 +508,8 @@ |
| 521 | 508 |
concept indeed provides all the required features. |
| 522 | 509 |
|
| 523 | 510 |
- Finally, They can serve as a skeleton of a new implementation of a concept. |
| 524 |
|
|
| 525 | 511 |
*/ |
| 526 | 512 |
|
| 527 |
|
|
| 528 | 513 |
/** |
| 529 | 514 |
@defgroup graph_concepts Graph Structure Concepts |
| 530 | 515 |
@ingroup concept |
| ... | ... |
@@ -534,10 +519,12 @@ |
| 534 | 519 |
graph structures and helper classes used to implement these. |
| 535 | 520 |
*/ |
| 536 | 521 |
|
| 537 |
/* --- Unused group |
|
| 538 |
@defgroup experimental Experimental Structures and Algorithms |
|
| 539 |
This group describes some Experimental structures and algorithms. |
|
| 540 |
The stuff here is subject to change. |
|
| 522 |
/** |
|
| 523 |
@defgroup map_concepts Map Concepts |
|
| 524 |
@ingroup concept |
|
| 525 |
\brief Skeleton and concept checking classes for maps |
|
| 526 |
|
|
| 527 |
This group describes the skeletons and concept checking classes of maps. |
|
| 541 | 528 |
*/ |
| 542 | 529 |
|
| 543 | 530 |
/** |
| ... | ... |
@@ -78,7 +78,7 @@ |
| 78 | 78 |
2 3 18 |
| 79 | 79 |
\endcode |
| 80 | 80 |
|
| 81 |
The \c \@edges is just a synonym of \c \@arcs. The @arcs section can |
|
| 81 |
The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can |
|
| 82 | 82 |
also store the edge set of an undirected graph. In such case there is |
| 83 | 83 |
a conventional method for store arc maps in the file, if two columns |
| 84 | 84 |
has the same caption with \c '+' and \c '-' prefix, then these columns |
| ... | ... |
@@ -50,11 +50,12 @@ |
| 50 | 50 |
|
| 51 | 51 |
If you |
| 52 | 52 |
want to see how LEMON works, see |
| 53 |
some \ref demoprograms "demo programs" |
|
| 53 |
some \ref demoprograms "demo programs". |
|
| 54 | 54 |
|
| 55 | 55 |
If you know what you are looking for then try to find it under the |
| 56 | 56 |
<a class="el" href="modules.html">Modules</a> |
| 57 | 57 |
section. |
| 58 | 58 |
|
| 59 |
If you are a user of the old (0.x) series of LEMON, please check out the |
|
| 59 |
If you are a user of the old (0.x) series of LEMON, please check out the |
|
| 60 |
\ref migration "Migration Guide" for the backward incompatibilities. |
|
| 60 | 61 |
*/ |
| ... | ... |
@@ -24,76 +24,75 @@ |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/core.h> |
| 26 | 26 |
|
| 27 |
///\ingroup graphbits |
|
| 28 |
///\file |
|
| 29 |
|
|
| 27 |
//\ingroup graphbits |
|
| 28 |
//\file |
|
| 29 |
//\brief Observer notifier for graph alteration observers. |
|
| 30 | 30 |
|
| 31 | 31 |
namespace lemon {
|
| 32 | 32 |
|
| 33 |
/// \ingroup graphbits |
|
| 34 |
/// |
|
| 35 |
/// \brief Notifier class to notify observes about alterations in |
|
| 36 |
/// a container. |
|
| 37 |
/// |
|
| 38 |
/// The simple graph's can be refered as two containers, one node container |
|
| 39 |
/// and one edge container. But they are not standard containers they |
|
| 40 |
/// does not store values directly they are just key continars for more |
|
| 41 |
/// value containers which are the node and edge maps. |
|
| 42 |
/// |
|
| 43 |
/// The graph's node and edge sets can be changed as we add or erase |
|
| 44 |
/// nodes and edges in the graph. LEMON would like to handle easily |
|
| 45 |
/// that the node and edge maps should contain values for all nodes or |
|
| 46 |
/// edges. If we want to check on every indicing if the map contains |
|
| 47 |
/// the current indicing key that cause a drawback in the performance |
|
| 48 |
/// in the library. We use another solution we notify all maps about |
|
| 49 |
/// an alteration in the graph, which cause only drawback on the |
|
| 50 |
/// alteration of the graph. |
|
| 51 |
/// |
|
| 52 |
/// This class provides an interface to the container. The \e first() and \e |
|
| 53 |
/// next() member functions make possible to iterate on the keys of the |
|
| 54 |
/// container. The \e id() function returns an integer id for each key. |
|
| 55 |
/// The \e maxId() function gives back an upper bound of the ids. |
|
| 56 |
/// |
|
| 57 |
/// For the proper functonality of this class, we should notify it |
|
| 58 |
/// about each alteration in the container. The alterations have four type |
|
| 59 |
/// as \e add(), \e erase(), \e build() and \e clear(). The \e add() and |
|
| 60 |
/// \e erase() signals that only one or few items added or erased to or |
|
| 61 |
/// from the graph. If all items are erased from the graph or from an empty |
|
| 62 |
/// graph a new graph is builded then it can be signaled with the |
|
| 63 |
/// clear() and build() members. Important rule that if we erase items |
|
| 64 |
/// from graph we should first signal the alteration and after that erase |
|
| 65 |
/// them from the container, on the other way on item addition we should |
|
| 66 |
/// first extend the container and just after that signal the alteration. |
|
| 67 |
/// |
|
| 68 |
/// The alteration can be observed with a class inherited from the |
|
| 69 |
/// \e ObserverBase nested class. The signals can be handled with |
|
| 70 |
/// overriding the virtual functions defined in the base class. The |
|
| 71 |
/// observer base can be attached to the notifier with the |
|
| 72 |
/// \e attach() member and can be detached with detach() function. The |
|
| 73 |
/// alteration handlers should not call any function which signals |
|
| 74 |
/// an other alteration in the same notifier and should not |
|
| 75 |
/// detach any observer from the notifier. |
|
| 76 |
/// |
|
| 77 |
/// Alteration observers try to be exception safe. If an \e add() or |
|
| 78 |
/// a \e clear() function throws an exception then the remaining |
|
| 79 |
/// observeres will not be notified and the fulfilled additions will |
|
| 80 |
/// be rolled back by calling the \e erase() or \e clear() |
|
| 81 |
/// functions. Thence the \e erase() and \e clear() should not throw |
|
| 82 |
/// exception. Actullay, it can be throw only |
|
| 83 |
/// \ref AlterationObserver::ImmediateDetach ImmediateDetach |
|
| 84 |
/// exception which detach the observer from the notifier. |
|
| 85 |
/// |
|
| 86 |
/// There are some place when the alteration observing is not completly |
|
| 87 |
/// reliable. If we want to carry out the node degree in the graph |
|
| 88 |
/// as in the \ref InDegMap and we use the reverseEdge that cause |
|
| 89 |
/// unreliable functionality. Because the alteration observing signals |
|
| 90 |
/// only erasing and adding but not the reversing it will stores bad |
|
| 91 |
/// degrees. The sub graph adaptors cannot signal the alterations because |
|
| 92 |
/// just a setting in the filter map can modify the graph and this cannot |
|
| 93 |
/// be watched in any way. |
|
| 94 |
/// |
|
| 95 |
/// \param _Container The container which is observed. |
|
| 96 |
/// \param _Item The item type which is obserbved. |
|
| 33 |
// \ingroup graphbits |
|
| 34 |
// |
|
| 35 |
// \brief Notifier class to notify observes about alterations in |
|
| 36 |
// a container. |
|
| 37 |
// |
|
| 38 |
// The simple graph's can be refered as two containers, one node container |
|
| 39 |
// and one edge container. But they are not standard containers they |
|
| 40 |
// does not store values directly they are just key continars for more |
|
| 41 |
// value containers which are the node and edge maps. |
|
| 42 |
// |
|
| 43 |
// The graph's node and edge sets can be changed as we add or erase |
|
| 44 |
// nodes and edges in the graph. LEMON would like to handle easily |
|
| 45 |
// that the node and edge maps should contain values for all nodes or |
|
| 46 |
// edges. If we want to check on every indicing if the map contains |
|
| 47 |
// the current indicing key that cause a drawback in the performance |
|
| 48 |
// in the library. We use another solution we notify all maps about |
|
| 49 |
// an alteration in the graph, which cause only drawback on the |
|
| 50 |
// alteration of the graph. |
|
| 51 |
// |
|
| 52 |
// This class provides an interface to the container. The \e first() and \e |
|
| 53 |
// next() member functions make possible to iterate on the keys of the |
|
| 54 |
// container. The \e id() function returns an integer id for each key. |
|
| 55 |
// The \e maxId() function gives back an upper bound of the ids. |
|
| 56 |
// |
|
| 57 |
// For the proper functonality of this class, we should notify it |
|
| 58 |
// about each alteration in the container. The alterations have four type |
|
| 59 |
// as \e add(), \e erase(), \e build() and \e clear(). The \e add() and |
|
| 60 |
// \e erase() signals that only one or few items added or erased to or |
|
| 61 |
// from the graph. If all items are erased from the graph or from an empty |
|
| 62 |
// graph a new graph is builded then it can be signaled with the |
|
| 63 |
// clear() and build() members. Important rule that if we erase items |
|
| 64 |
// from graph we should first signal the alteration and after that erase |
|
| 65 |
// them from the container, on the other way on item addition we should |
|
| 66 |
// first extend the container and just after that signal the alteration. |
|
| 67 |
// |
|
| 68 |
// The alteration can be observed with a class inherited from the |
|
| 69 |
// \e ObserverBase nested class. The signals can be handled with |
|
| 70 |
// overriding the virtual functions defined in the base class. The |
|
| 71 |
// observer base can be attached to the notifier with the |
|
| 72 |
// \e attach() member and can be detached with detach() function. The |
|
| 73 |
// alteration handlers should not call any function which signals |
|
| 74 |
// an other alteration in the same notifier and should not |
|
| 75 |
// detach any observer from the notifier. |
|
| 76 |
// |
|
| 77 |
// Alteration observers try to be exception safe. If an \e add() or |
|
| 78 |
// a \e clear() function throws an exception then the remaining |
|
| 79 |
// observeres will not be notified and the fulfilled additions will |
|
| 80 |
// be rolled back by calling the \e erase() or \e clear() |
|
| 81 |
// functions. Thence the \e erase() and \e clear() should not throw |
|
| 82 |
// exception. Actullay, it can be throw only \ref ImmediateDetach |
|
| 83 |
// exception which detach the observer from the notifier. |
|
| 84 |
// |
|
| 85 |
// There are some place when the alteration observing is not completly |
|
| 86 |
// reliable. If we want to carry out the node degree in the graph |
|
| 87 |
// as in the \ref InDegMap and we use the reverseEdge that cause |
|
| 88 |
// unreliable functionality. Because the alteration observing signals |
|
| 89 |
// only erasing and adding but not the reversing it will stores bad |
|
| 90 |
// degrees. The sub graph adaptors cannot signal the alterations because |
|
| 91 |
// just a setting in the filter map can modify the graph and this cannot |
|
| 92 |
// be watched in any way. |
|
| 93 |
// |
|
| 94 |
// \param _Container The container which is observed. |
|
| 95 |
// \param _Item The item type which is obserbved. |
|
| 97 | 96 |
|
| 98 | 97 |
template <typename _Container, typename _Item> |
| 99 | 98 |
class AlterationNotifier {
|
| ... | ... |
@@ -104,92 +103,87 @@ |
| 104 | 103 |
typedef _Container Container; |
| 105 | 104 |
typedef _Item Item; |
| 106 | 105 |
|
| 107 |
/// \brief Exception which can be called from \e clear() and |
|
| 108 |
/// \e erase(). |
|
| 109 |
/// |
|
| 110 |
/// From the \e clear() and \e erase() function only this |
|
| 111 |
/// exception is allowed to throw. The exception immediatly |
|
| 112 |
/// detaches the current observer from the notifier. Because the |
|
| 113 |
/// \e clear() and \e erase() should not throw other exceptions |
|
| 114 |
/// it can be used to invalidate the observer. |
|
| 106 |
// \brief Exception which can be called from \e clear() and |
|
| 107 |
// \e erase(). |
|
| 108 |
// |
|
| 109 |
// From the \e clear() and \e erase() function only this |
|
| 110 |
// exception is allowed to throw. The exception immediatly |
|
| 111 |
// detaches the current observer from the notifier. Because the |
|
| 112 |
// \e clear() and \e erase() should not throw other exceptions |
|
| 113 |
// it can be used to invalidate the observer. |
|
| 115 | 114 |
struct ImmediateDetach {};
|
| 116 | 115 |
|
| 117 |
/// \brief ObserverBase is the base class for the observers. |
|
| 118 |
/// |
|
| 119 |
/// ObserverBase is the abstract base class for the observers. |
|
| 120 |
/// It will be notified about an item was inserted into or |
|
| 121 |
/// erased from the graph. |
|
| 122 |
/// |
|
| 123 |
/// The observer interface contains some pure virtual functions |
|
| 124 |
/// to override. The add() and erase() functions are |
|
| 125 |
/// to notify the oberver when one item is added or |
|
| 126 |
/// erased. |
|
| 127 |
/// |
|
| 128 |
/// The build() and clear() members are to notify the observer |
|
| 129 |
/// about the container is built from an empty container or |
|
| 130 |
/// is cleared to an empty container. |
|
| 131 |
|
|
| 116 |
// \brief ObserverBase is the base class for the observers. |
|
| 117 |
// |
|
| 118 |
// ObserverBase is the abstract base class for the observers. |
|
| 119 |
// It will be notified about an item was inserted into or |
|
| 120 |
// erased from the graph. |
|
| 121 |
// |
|
| 122 |
// The observer interface contains some pure virtual functions |
|
| 123 |
// to override. The add() and erase() functions are |
|
| 124 |
// to notify the oberver when one item is added or |
|
| 125 |
// erased. |
|
| 126 |
// |
|
| 127 |
// The build() and clear() members are to notify the observer |
|
| 128 |
// about the container is built from an empty container or |
|
| 129 |
// is cleared to an empty container. |
|
| 132 | 130 |
class ObserverBase {
|
| 133 | 131 |
protected: |
| 134 | 132 |
typedef AlterationNotifier Notifier; |
| 135 | 133 |
|
| 136 | 134 |
friend class AlterationNotifier; |
| 137 | 135 |
|
| 138 |
/// \brief Default constructor. |
|
| 139 |
/// |
|
| 140 |
/// Default constructor for ObserverBase. |
|
| 141 |
/// |
|
| 136 |
// \brief Default constructor. |
|
| 137 |
// |
|
| 138 |
// Default constructor for ObserverBase. |
|
| 142 | 139 |
ObserverBase() : _notifier(0) {}
|
| 143 | 140 |
|
| 144 |
/// \brief Constructor which attach the observer into notifier. |
|
| 145 |
/// |
|
| 146 |
// |
|
| 141 |
// \brief Constructor which attach the observer into notifier. |
|
| 142 |
// |
|
| 143 |
// Constructor which attach the observer into notifier. |
|
| 147 | 144 |
ObserverBase(AlterationNotifier& nf) {
|
| 148 | 145 |
attach(nf); |
| 149 | 146 |
} |
| 150 | 147 |
|
| 151 |
/// \brief Constructor which attach the obserever to the same notifier. |
|
| 152 |
/// |
|
| 153 |
/// Constructor which attach the obserever to the same notifier as |
|
| 154 |
/// the other observer is attached to. |
|
| 148 |
// \brief Constructor which attach the obserever to the same notifier. |
|
| 149 |
// |
|
| 150 |
// Constructor which attach the obserever to the same notifier as |
|
| 151 |
// the other observer is attached to. |
|
| 155 | 152 |
ObserverBase(const ObserverBase& copy) {
|
| 156 | 153 |
if (copy.attached()) {
|
| 157 | 154 |
attach(*copy.notifier()); |
| 158 | 155 |
} |
| 159 | 156 |
} |
| 160 | 157 |
|
| 161 |
// |
|
| 158 |
// \brief Destructor |
|
| 162 | 159 |
virtual ~ObserverBase() {
|
| 163 | 160 |
if (attached()) {
|
| 164 | 161 |
detach(); |
| 165 | 162 |
} |
| 166 | 163 |
} |
| 167 | 164 |
|
| 168 |
/// \brief Attaches the observer into an AlterationNotifier. |
|
| 169 |
/// |
|
| 170 |
/// This member attaches the observer into an AlterationNotifier. |
|
| 171 |
/// |
|
| 165 |
// \brief Attaches the observer into an AlterationNotifier. |
|
| 166 |
// |
|
| 167 |
// This member attaches the observer into an AlterationNotifier. |
|
| 172 | 168 |
void attach(AlterationNotifier& nf) {
|
| 173 | 169 |
nf.attach(*this); |
| 174 | 170 |
} |
| 175 | 171 |
|
| 176 |
/// \brief Detaches the observer into an AlterationNotifier. |
|
| 177 |
/// |
|
| 178 |
/// This member detaches the observer from an AlterationNotifier. |
|
| 179 |
/// |
|
| 172 |
// \brief Detaches the observer into an AlterationNotifier. |
|
| 173 |
// |
|
| 174 |
// This member detaches the observer from an AlterationNotifier. |
|
| 180 | 175 |
void detach() {
|
| 181 | 176 |
_notifier->detach(*this); |
| 182 | 177 |
} |
| 183 | 178 |
|
| 184 |
/// \brief Gives back a pointer to the notifier which the map |
|
| 185 |
/// attached into. |
|
| 186 |
/// |
|
| 187 |
/// This function gives back a pointer to the notifier which the map |
|
| 188 |
/// attached into. |
|
| 189 |
/// |
|
| 179 |
// \brief Gives back a pointer to the notifier which the map |
|
| 180 |
// attached into. |
|
| 181 |
// |
|
| 182 |
// This function gives back a pointer to the notifier which the map |
|
| 183 |
// attached into. |
|
| 190 | 184 |
Notifier* notifier() const { return const_cast<Notifier*>(_notifier); }
|
| 191 | 185 |
|
| 192 |
|
|
| 186 |
// Gives back true when the observer is attached into a notifier. |
|
| 193 | 187 |
bool attached() const { return _notifier != 0; }
|
| 194 | 188 |
|
| 195 | 189 |
private: |
| ... | ... |
@@ -201,53 +195,52 @@ |
| 201 | 195 |
Notifier* _notifier; |
| 202 | 196 |
typename std::list<ObserverBase*>::iterator _index; |
| 203 | 197 |
|
| 204 |
/// \brief The member function to notificate the observer about an |
|
| 205 |
/// item is added to the container. |
|
| 206 |
/// |
|
| 207 |
/// The add() member function notificates the observer about an item |
|
| 208 |
/// is added to the container. It have to be overrided in the |
|
| 209 |
/// subclasses. |
|
| 198 |
// \brief The member function to notificate the observer about an |
|
| 199 |
// item is added to the container. |
|
| 200 |
// |
|
| 201 |
// The add() member function notificates the observer about an item |
|
| 202 |
// is added to the container. It have to be overrided in the |
|
| 203 |
// subclasses. |
|
| 210 | 204 |
virtual void add(const Item&) = 0; |
| 211 | 205 |
|
| 212 |
/// \brief The member function to notificate the observer about |
|
| 213 |
/// more item is added to the container. |
|
| 214 |
/// |
|
| 215 |
/// The add() member function notificates the observer about more item |
|
| 216 |
/// is added to the container. It have to be overrided in the |
|
| 217 |
/// subclasses. |
|
| 206 |
// \brief The member function to notificate the observer about |
|
| 207 |
// more item is added to the container. |
|
| 208 |
// |
|
| 209 |
// The add() member function notificates the observer about more item |
|
| 210 |
// is added to the container. It have to be overrided in the |
|
| 211 |
// subclasses. |
|
| 218 | 212 |
virtual void add(const std::vector<Item>& items) = 0; |
| 219 | 213 |
|
| 220 |
/// \brief The member function to notificate the observer about an |
|
| 221 |
/// item is erased from the container. |
|
| 222 |
/// |
|
| 223 |
/// The erase() member function notificates the observer about an |
|
| 224 |
/// item is erased from the container. It have to be overrided in |
|
| 225 |
/// the subclasses. |
|
| 214 |
// \brief The member function to notificate the observer about an |
|
| 215 |
// item is erased from the container. |
|
| 216 |
// |
|
| 217 |
// The erase() member function notificates the observer about an |
|
| 218 |
// item is erased from the container. It have to be overrided in |
|
| 219 |
// the subclasses. |
|
| 226 | 220 |
virtual void erase(const Item&) = 0; |
| 227 | 221 |
|
| 228 |
/// \brief The member function to notificate the observer about |
|
| 229 |
/// more item is erased from the container. |
|
| 230 |
/// |
|
| 231 |
/// The erase() member function notificates the observer about more item |
|
| 232 |
/// is erased from the container. It have to be overrided in the |
|
| 233 |
/// subclasses. |
|
| 222 |
// \brief The member function to notificate the observer about |
|
| 223 |
// more item is erased from the container. |
|
| 224 |
// |
|
| 225 |
// The erase() member function notificates the observer about more item |
|
| 226 |
// is erased from the container. It have to be overrided in the |
|
| 227 |
// subclasses. |
|
| 234 | 228 |
virtual void erase(const std::vector<Item>& items) = 0; |
| 235 | 229 |
|
| 236 |
/// \brief The member function to notificate the observer about the |
|
| 237 |
/// container is built. |
|
| 238 |
/// |
|
| 239 |
/// The build() member function notificates the observer about the |
|
| 240 |
/// container is built from an empty container. It have to be |
|
| 241 |
/// overrided in the subclasses. |
|
| 242 |
|
|
| 230 |
// \brief The member function to notificate the observer about the |
|
| 231 |
// container is built. |
|
| 232 |
// |
|
| 233 |
// The build() member function notificates the observer about the |
|
| 234 |
// container is built from an empty container. It have to be |
|
| 235 |
// overrided in the subclasses. |
|
| 243 | 236 |
virtual void build() = 0; |
| 244 | 237 |
|
| 245 |
/// \brief The member function to notificate the observer about all |
|
| 246 |
/// items are erased from the container. |
|
| 247 |
/// |
|
| 248 |
/// The clear() member function notificates the observer about all |
|
| 249 |
/// items are erased from the container. It have to be overrided in |
|
| 250 |
/// the subclasses. |
|
| 238 |
// \brief The member function to notificate the observer about all |
|
| 239 |
// items are erased from the container. |
|
| 240 |
// |
|
| 241 |
// The clear() member function notificates the observer about all |
|
| 242 |
// items are erased from the container. It have to be overrided in |
|
| 243 |
// the subclasses. |
|
| 251 | 244 |
virtual void clear() = 0; |
| 252 | 245 |
|
| 253 | 246 |
}; |
| ... | ... |
@@ -262,31 +255,30 @@ |
| 262 | 255 |
|
| 263 | 256 |
public: |
| 264 | 257 |
|
| 265 |
/// \brief Default constructor. |
|
| 266 |
/// |
|
| 267 |
/// The default constructor of the AlterationNotifier. |
|
| 268 |
/// It creates an empty notifier. |
|
| 258 |
// \brief Default constructor. |
|
| 259 |
// |
|
| 260 |
// The default constructor of the AlterationNotifier. |
|
| 261 |
// It creates an empty notifier. |
|
| 269 | 262 |
AlterationNotifier() |
| 270 | 263 |
: container(0) {}
|
| 271 | 264 |
|
| 272 |
/// \brief Constructor. |
|
| 273 |
/// |
|
| 274 |
// |
|
| 265 |
// \brief Constructor. |
|
| 266 |
// |
|
| 267 |
// Constructor with the observed container parameter. |
|
| 275 | 268 |
AlterationNotifier(const Container& _container) |
| 276 | 269 |
: container(&_container) {}
|
| 277 | 270 |
|
| 278 |
/// \brief Copy Constructor of the AlterationNotifier. |
|
| 279 |
/// |
|
| 280 |
/// Copy constructor of the AlterationNotifier. |
|
| 281 |
/// It creates only an empty notifier because the copiable |
|
| 282 |
// |
|
| 271 |
// \brief Copy Constructor of the AlterationNotifier. |
|
| 272 |
// |
|
| 273 |
// Copy constructor of the AlterationNotifier. |
|
| 274 |
// It creates only an empty notifier because the copiable |
|
| 275 |
// notifier's observers have to be registered still into that notifier. |
|
| 283 | 276 |
AlterationNotifier(const AlterationNotifier& _notifier) |
| 284 | 277 |
: container(_notifier.container) {}
|
| 285 | 278 |
|
| 286 |
/// \brief Destructor. |
|
| 287 |
/// |
|
| 288 |
/// Destructor of the AlterationNotifier. |
|
| 289 |
/// |
|
| 279 |
// \brief Destructor. |
|
| 280 |
// |
|
| 281 |
// Destructor of the AlterationNotifier. |
|
| 290 | 282 |
~AlterationNotifier() {
|
| 291 | 283 |
typename Observers::iterator it; |
| 292 | 284 |
for (it = _observers.begin(); it != _observers.end(); ++it) {
|
| ... | ... |
@@ -294,9 +286,9 @@ |
| 294 | 286 |
} |
| 295 | 287 |
} |
| 296 | 288 |
|
| 297 |
/// \brief Sets the container. |
|
| 298 |
/// |
|
| 299 |
// |
|
| 289 |
// \brief Sets the container. |
|
| 290 |
// |
|
| 291 |
// Sets the container. |
|
| 300 | 292 |
void setContainer(const Container& _container) {
|
| 301 | 293 |
container = &_container; |
| 302 | 294 |
} |
| ... | ... |
@@ -307,34 +299,32 @@ |
| 307 | 299 |
|
| 308 | 300 |
public: |
| 309 | 301 |
|
| 310 |
|
|
| 311 |
|
|
| 312 |
/// \brief First item in the container. |
|
| 313 |
/// |
|
| 314 |
/// Returns the first item in the container. It is |
|
| 315 |
/// for start the iteration on the container. |
|
| 302 |
// \brief First item in the container. |
|
| 303 |
// |
|
| 304 |
// Returns the first item in the container. It is |
|
| 305 |
// for start the iteration on the container. |
|
| 316 | 306 |
void first(Item& item) const {
|
| 317 | 307 |
container->first(item); |
| 318 | 308 |
} |
| 319 | 309 |
|
| 320 |
/// \brief Next item in the container. |
|
| 321 |
/// |
|
| 322 |
/// Returns the next item in the container. It is |
|
| 323 |
/// for iterate on the container. |
|
| 310 |
// \brief Next item in the container. |
|
| 311 |
// |
|
| 312 |
// Returns the next item in the container. It is |
|
| 313 |
// for iterate on the container. |
|
| 324 | 314 |
void next(Item& item) const {
|
| 325 | 315 |
container->next(item); |
| 326 | 316 |
} |
| 327 | 317 |
|
| 328 |
/// \brief Returns the id of the item. |
|
| 329 |
/// |
|
| 330 |
// |
|
| 318 |
// \brief Returns the id of the item. |
|
| 319 |
// |
|
| 320 |
// Returns the id of the item provided by the container. |
|
| 331 | 321 |
int id(const Item& item) const {
|
| 332 | 322 |
return container->id(item); |
| 333 | 323 |
} |
| 334 | 324 |
|
| 335 |
/// \brief Returns the maximum id of the container. |
|
| 336 |
/// |
|
| 337 |
// |
|
| 325 |
// \brief Returns the maximum id of the container. |
|
| 326 |
// |
|
| 327 |
// Returns the maximum id of the container. |
|
| 338 | 328 |
int maxId() const {
|
| 339 | 329 |
return container->maxId(Item()); |
| 340 | 330 |
} |
| ... | ... |
@@ -354,12 +344,11 @@ |
| 354 | 344 |
|
| 355 | 345 |
public: |
| 356 | 346 |
|
| 357 |
/// \brief Notifies all the registed observers about an item added to |
|
| 358 |
/// the container. |
|
| 359 |
/// |
|
| 360 |
/// It notifies all the registed observers about an item added to |
|
| 361 |
/// the container. |
|
| 362 |
/// |
|
| 347 |
// \brief Notifies all the registed observers about an item added to |
|
| 348 |
// the container. |
|
| 349 |
// |
|
| 350 |
// It notifies all the registed observers about an item added to |
|
| 351 |
// the container. |
|
| 363 | 352 |
void add(const Item& item) {
|
| 364 | 353 |
typename Observers::reverse_iterator it; |
| 365 | 354 |
try {
|
| ... | ... |
@@ -375,12 +364,11 @@ |
| 375 | 364 |
} |
| 376 | 365 |
} |
| 377 | 366 |
|
| 378 |
/// \brief Notifies all the registed observers about more item added to |
|
| 379 |
/// the container. |
|
| 380 |
/// |
|
| 381 |
/// It notifies all the registed observers about more item added to |
|
| 382 |
/// the container. |
|
| 383 |
/// |
|
| 367 |
// \brief Notifies all the registed observers about more item added to |
|
| 368 |
// the container. |
|
| 369 |
// |
|
| 370 |
// It notifies all the registed observers about more item added to |
|
| 371 |
// the container. |
|
| 384 | 372 |
void add(const std::vector<Item>& items) {
|
| 385 | 373 |
typename Observers::reverse_iterator it; |
| 386 | 374 |
try {
|
| ... | ... |
@@ -396,12 +384,11 @@ |
| 396 | 384 |
} |
| 397 | 385 |
} |
| 398 | 386 |
|
| 399 |
/// \brief Notifies all the registed observers about an item erased from |
|
| 400 |
/// the container. |
|
| 401 |
/// |
|
| 402 |
/// It notifies all the registed observers about an item erased from |
|
| 403 |
/// the container. |
|
| 404 |
/// |
|
| 387 |
// \brief Notifies all the registed observers about an item erased from |
|
| 388 |
// the container. |
|
| 389 |
// |
|
| 390 |
// It notifies all the registed observers about an item erased from |
|
| 391 |
// the container. |
|
| 405 | 392 |
void erase(const Item& item) throw() {
|
| 406 | 393 |
typename Observers::iterator it = _observers.begin(); |
| 407 | 394 |
while (it != _observers.end()) {
|
| ... | ... |
@@ -416,12 +403,11 @@ |
| 416 | 403 |
} |
| 417 | 404 |
} |
| 418 | 405 |
|
| 419 |
/// \brief Notifies all the registed observers about more item erased |
|
| 420 |
/// from the container. |
|
| 421 |
/// |
|
| 422 |
/// It notifies all the registed observers about more item erased from |
|
| 423 |
/// the container. |
|
| 424 |
/// |
|
| 406 |
// \brief Notifies all the registed observers about more item erased |
|
| 407 |
// from the container. |
|
| 408 |
// |
|
| 409 |
// It notifies all the registed observers about more item erased from |
|
| 410 |
// the container. |
|
| 425 | 411 |
void erase(const std::vector<Item>& items) {
|
| 426 | 412 |
typename Observers::iterator it = _observers.begin(); |
| 427 | 413 |
while (it != _observers.end()) {
|
| ... | ... |
@@ -436,11 +422,11 @@ |
| 436 | 422 |
} |
| 437 | 423 |
} |
| 438 | 424 |
|
| 439 |
/// \brief Notifies all the registed observers about the container is |
|
| 440 |
/// built. |
|
| 441 |
/// |
|
| 442 |
/// Notifies all the registed observers about the container is built |
|
| 443 |
// |
|
| 425 |
// \brief Notifies all the registed observers about the container is |
|
| 426 |
// built. |
|
| 427 |
// |
|
| 428 |
// Notifies all the registed observers about the container is built |
|
| 429 |
// from an empty container. |
|
| 444 | 430 |
void build() {
|
| 445 | 431 |
typename Observers::reverse_iterator it; |
| 446 | 432 |
try {
|
| ... | ... |
@@ -456,11 +442,11 @@ |
| 456 | 442 |
} |
| 457 | 443 |
} |
| 458 | 444 |
|
| 459 |
/// \brief Notifies all the registed observers about all items are |
|
| 460 |
/// erased. |
|
| 461 |
/// |
|
| 462 |
/// Notifies all the registed observers about all items are erased |
|
| 463 |
// |
|
| 445 |
// \brief Notifies all the registed observers about all items are |
|
| 446 |
// erased. |
|
| 447 |
// |
|
| 448 |
// Notifies all the registed observers about all items are erased |
|
| 449 |
// from the container. |
|
| 464 | 450 |
void clear() {
|
| 465 | 451 |
typename Observers::iterator it = _observers.begin(); |
| 466 | 452 |
while (it != _observers.end()) {
|
| ... | ... |
@@ -26,48 +26,48 @@ |
| 26 | 26 |
#include <lemon/concept_check.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
|
| 29 |
/// \ingroup graphbits |
|
| 30 |
/// \file |
|
| 31 |
|
|
| 29 |
// \ingroup graphbits |
|
| 30 |
// \file |
|
| 31 |
// \brief Graph map based on the array storage. |
|
| 32 | 32 |
|
| 33 | 33 |
namespace lemon {
|
| 34 | 34 |
|
| 35 |
/// \ingroup graphbits |
|
| 36 |
/// |
|
| 37 |
/// \brief Graph map based on the array storage. |
|
| 38 |
/// |
|
| 39 |
/// The ArrayMap template class is graph map structure what |
|
| 40 |
/// automatically updates the map when a key is added to or erased from |
|
| 41 |
/// the map. This map uses the allocators to implement |
|
| 42 |
/// the container functionality. |
|
| 43 |
/// |
|
| 44 |
/// The template parameters are the Graph the current Item type and |
|
| 45 |
// |
|
| 35 |
// \ingroup graphbits |
|
| 36 |
// |
|
| 37 |
// \brief Graph map based on the array storage. |
|
| 38 |
// |
|
| 39 |
// The ArrayMap template class is graph map structure what |
|
| 40 |
// automatically updates the map when a key is added to or erased from |
|
| 41 |
// the map. This map uses the allocators to implement |
|
| 42 |
// the container functionality. |
|
| 43 |
// |
|
| 44 |
// The template parameters are the Graph the current Item type and |
|
| 45 |
// the Value type of the map. |
|
| 46 | 46 |
template <typename _Graph, typename _Item, typename _Value> |
| 47 | 47 |
class ArrayMap |
| 48 | 48 |
: public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
|
| 49 | 49 |
public: |
| 50 |
|
|
| 50 |
// The graph type of the maps. |
|
| 51 | 51 |
typedef _Graph Graph; |
| 52 |
|
|
| 52 |
// The item type of the map. |
|
| 53 | 53 |
typedef _Item Item; |
| 54 |
|
|
| 54 |
// The reference map tag. |
|
| 55 | 55 |
typedef True ReferenceMapTag; |
| 56 | 56 |
|
| 57 |
|
|
| 57 |
// The key type of the maps. |
|
| 58 | 58 |
typedef _Item Key; |
| 59 |
|
|
| 59 |
// The value type of the map. |
|
| 60 | 60 |
typedef _Value Value; |
| 61 | 61 |
|
| 62 |
|
|
| 62 |
// The const reference type of the map. |
|
| 63 | 63 |
typedef const _Value& ConstReference; |
| 64 |
|
|
| 64 |
// The reference type of the map. |
|
| 65 | 65 |
typedef _Value& Reference; |
| 66 | 66 |
|
| 67 |
|
|
| 67 |
// The notifier type. |
|
| 68 | 68 |
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; |
| 69 | 69 |
|
| 70 |
|
|
| 70 |
// The MapBase of the Map which imlements the core regisitry function. |
|
| 71 | 71 |
typedef typename Notifier::ObserverBase Parent; |
| 72 | 72 |
|
| 73 | 73 |
private: |
| ... | ... |
@@ -75,9 +75,9 @@ |
| 75 | 75 |
|
| 76 | 76 |
public: |
| 77 | 77 |
|
| 78 |
/// \brief Graph initialized map constructor. |
|
| 79 |
/// |
|
| 80 |
// |
|
| 78 |
// \brief Graph initialized map constructor. |
|
| 79 |
// |
|
| 80 |
// Graph initialized map constructor. |
|
| 81 | 81 |
explicit ArrayMap(const Graph& graph) {
|
| 82 | 82 |
Parent::attach(graph.notifier(Item())); |
| 83 | 83 |
allocate_memory(); |
| ... | ... |
@@ -89,9 +89,9 @@ |
| 89 | 89 |
} |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
/// \brief Constructor to use default value to initialize the map. |
|
| 93 |
/// |
|
| 94 |
// |
|
| 92 |
// \brief Constructor to use default value to initialize the map. |
|
| 93 |
// |
|
| 94 |
// It constructs a map and initialize all of the the map. |
|
| 95 | 95 |
ArrayMap(const Graph& graph, const Value& value) {
|
| 96 | 96 |
Parent::attach(graph.notifier(Item())); |
| 97 | 97 |
allocate_memory(); |
| ... | ... |
@@ -104,9 +104,9 @@ |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
private: |
| 107 |
/// \brief Constructor to copy a map of the same map type. |
|
| 108 |
/// |
|
| 109 |
// |
|
| 107 |
// \brief Constructor to copy a map of the same map type. |
|
| 108 |
// |
|
| 109 |
// Constructor to copy a map of the same map type. |
|
| 110 | 110 |
ArrayMap(const ArrayMap& copy) : Parent() {
|
| 111 | 111 |
if (copy.attached()) {
|
| 112 | 112 |
attach(*copy.notifier()); |
| ... | ... |
@@ -122,24 +122,24 @@ |
| 122 | 122 |
} |
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 |
/// \brief Assign operator. |
|
| 126 |
/// |
|
| 127 |
/// This operator assigns for each item in the map the |
|
| 128 |
/// value mapped to the same item in the copied map. |
|
| 129 |
/// The parameter map should be indiced with the same |
|
| 130 |
/// itemset because this assign operator does not change |
|
| 131 |
// |
|
| 125 |
// \brief Assign operator. |
|
| 126 |
// |
|
| 127 |
// This operator assigns for each item in the map the |
|
| 128 |
// value mapped to the same item in the copied map. |
|
| 129 |
// The parameter map should be indiced with the same |
|
| 130 |
// itemset because this assign operator does not change |
|
| 131 |
// the container of the map. |
|
| 132 | 132 |
ArrayMap& operator=(const ArrayMap& cmap) {
|
| 133 | 133 |
return operator=<ArrayMap>(cmap); |
| 134 | 134 |
} |
| 135 | 135 |
|
| 136 | 136 |
|
| 137 |
/// \brief Template assign operator. |
|
| 138 |
/// |
|
| 139 |
/// The given parameter should be conform to the ReadMap |
|
| 140 |
/// concecpt and could be indiced by the current item set of |
|
| 141 |
/// the NodeMap. In this case the value for each item |
|
| 142 |
/// is assigned by the value of the given ReadMap. |
|
| 137 |
// \brief Template assign operator. |
|
| 138 |
// |
|
| 139 |
// The given parameter should be conform to the ReadMap |
|
| 140 |
// concecpt and could be indiced by the current item set of |
|
| 141 |
// the NodeMap. In this case the value for each item |
|
| 142 |
// is assigned by the value of the given ReadMap. |
|
| 143 | 143 |
template <typename CMap> |
| 144 | 144 |
ArrayMap& operator=(const CMap& cmap) {
|
| 145 | 145 |
checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); |
| ... | ... |
@@ -152,9 +152,9 @@ |
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 | 154 |
public: |
| 155 |
/// \brief The destructor of the map. |
|
| 156 |
/// |
|
| 157 |
// |
|
| 155 |
// \brief The destructor of the map. |
|
| 156 |
// |
|
| 157 |
// The destructor of the map. |
|
| 158 | 158 |
virtual ~ArrayMap() {
|
| 159 | 159 |
if (attached()) {
|
| 160 | 160 |
clear(); |
| ... | ... |
@@ -170,38 +170,38 @@ |
| 170 | 170 |
|
| 171 | 171 |
public: |
| 172 | 172 |
|
| 173 |
/// \brief The subscript operator. |
|
| 174 |
/// |
|
| 175 |
/// The subscript operator. The map can be subscripted by the |
|
| 176 |
/// actual keys of the graph. |
|
| 173 |
// \brief The subscript operator. |
|
| 174 |
// |
|
| 175 |
// The subscript operator. The map can be subscripted by the |
|
| 176 |
// actual keys of the graph. |
|
| 177 | 177 |
Value& operator[](const Key& key) {
|
| 178 | 178 |
int id = Parent::notifier()->id(key); |
| 179 | 179 |
return values[id]; |
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 |
/// \brief The const subscript operator. |
|
| 183 |
/// |
|
| 184 |
/// The const subscript operator. The map can be subscripted by the |
|
| 185 |
/// actual keys of the graph. |
|
| 182 |
// \brief The const subscript operator. |
|
| 183 |
// |
|
| 184 |
// The const subscript operator. The map can be subscripted by the |
|
| 185 |
// actual keys of the graph. |
|
| 186 | 186 |
const Value& operator[](const Key& key) const {
|
| 187 | 187 |
int id = Parent::notifier()->id(key); |
| 188 | 188 |
return values[id]; |
| 189 | 189 |
} |
| 190 | 190 |
|
| 191 |
/// \brief Setter function of the map. |
|
| 192 |
/// |
|
| 193 |
/// Setter function of the map. Equivalent with map[key] = val. |
|
| 194 |
/// This is a compatibility feature with the not dereferable maps. |
|
| 191 |
// \brief Setter function of the map. |
|
| 192 |
// |
|
| 193 |
// Setter function of the map. Equivalent with map[key] = val. |
|
| 194 |
// This is a compatibility feature with the not dereferable maps. |
|
| 195 | 195 |
void set(const Key& key, const Value& val) {
|
| 196 | 196 |
(*this)[key] = val; |
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 | 199 |
protected: |
| 200 | 200 |
|
| 201 |
/// \brief Adds a new key to the map. |
|
| 202 |
/// |
|
| 203 |
/// It adds a new key to the map. It called by the observer notifier |
|
| 204 |
/// and it overrides the add() member function of the observer base. |
|
| 201 |
// \brief Adds a new key to the map. |
|
| 202 |
// |
|
| 203 |
// It adds a new key to the map. It called by the observer notifier |
|
| 204 |
// and it overrides the add() member function of the observer base. |
|
| 205 | 205 |
virtual void add(const Key& key) {
|
| 206 | 206 |
Notifier* nf = Parent::notifier(); |
| 207 | 207 |
int id = nf->id(key); |
| ... | ... |
@@ -226,10 +226,10 @@ |
| 226 | 226 |
allocator.construct(&(values[id]), Value()); |
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 |
/// \brief Adds more new keys to the map. |
|
| 230 |
/// |
|
| 231 |
/// It adds more new keys to the map. It called by the observer notifier |
|
| 232 |
/// and it overrides the add() member function of the observer base. |
|
| 229 |
// \brief Adds more new keys to the map. |
|
| 230 |
// |
|
| 231 |
// It adds more new keys to the map. It called by the observer notifier |
|
| 232 |
// and it overrides the add() member function of the observer base. |
|
| 233 | 233 |
virtual void add(const std::vector<Key>& keys) {
|
| 234 | 234 |
Notifier* nf = Parent::notifier(); |
| 235 | 235 |
int max_id = -1; |
| ... | ... |
@@ -270,19 +270,19 @@ |
| 270 | 270 |
} |
| 271 | 271 |
} |
| 272 | 272 |
|
| 273 |
/// \brief Erase a key from the map. |
|
| 274 |
/// |
|
| 275 |
/// Erase a key from the map. It called by the observer notifier |
|
| 276 |
/// and it overrides the erase() member function of the observer base. |
|
| 273 |
// \brief Erase a key from the map. |
|
| 274 |
// |
|
| 275 |
// Erase a key from the map. It called by the observer notifier |
|
| 276 |
// and it overrides the erase() member function of the observer base. |
|
| 277 | 277 |
virtual void erase(const Key& key) {
|
| 278 | 278 |
int id = Parent::notifier()->id(key); |
| 279 | 279 |
allocator.destroy(&(values[id])); |
| 280 | 280 |
} |
| 281 | 281 |
|
| 282 |
/// \brief Erase more keys from the map. |
|
| 283 |
/// |
|
| 284 |
/// Erase more keys from the map. It called by the observer notifier |
|
| 285 |
/// and it overrides the erase() member function of the observer base. |
|
| 282 |
// \brief Erase more keys from the map. |
|
| 283 |
// |
|
| 284 |
// Erase more keys from the map. It called by the observer notifier |
|
| 285 |
// and it overrides the erase() member function of the observer base. |
|
| 286 | 286 |
virtual void erase(const std::vector<Key>& keys) {
|
| 287 | 287 |
for (int i = 0; i < int(keys.size()); ++i) {
|
| 288 | 288 |
int id = Parent::notifier()->id(keys[i]); |
| ... | ... |
@@ -290,10 +290,10 @@ |
| 290 | 290 |
} |
| 291 | 291 |
} |
| 292 | 292 |
|
| 293 |
/// \brief Buildes the map. |
|
| 294 |
/// |
|
| 295 |
/// It buildes the map. It called by the observer notifier |
|
| 296 |
/// and it overrides the build() member function of the observer base. |
|
| 293 |
// \brief Buildes the map. |
|
| 294 |
// |
|
| 295 |
// It buildes the map. It called by the observer notifier |
|
| 296 |
// and it overrides the build() member function of the observer base. |
|
| 297 | 297 |
virtual void build() {
|
| 298 | 298 |
Notifier* nf = Parent::notifier(); |
| 299 | 299 |
allocate_memory(); |
| ... | ... |
@@ -304,10 +304,10 @@ |
| 304 | 304 |
} |
| 305 | 305 |
} |
| 306 | 306 |
|
| 307 |
/// \brief Clear the map. |
|
| 308 |
/// |
|
| 309 |
/// It erase all items from the map. It called by the observer notifier |
|
| 310 |
/// and it overrides the clear() member function of the observer base. |
|
| 307 |
// \brief Clear the map. |
|
| 308 |
// |
|
| 309 |
// It erase all items from the map. It called by the observer notifier |
|
| 310 |
// and it overrides the clear() member function of the observer base. |
|
| 311 | 311 |
virtual void clear() {
|
| 312 | 312 |
Notifier* nf = Parent::notifier(); |
| 313 | 313 |
if (capacity != 0) {
|
| ... | ... |
@@ -28,14 +28,14 @@ |
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
#include <lemon/concepts/maps.h> |
| 30 | 30 |
|
| 31 |
///\ingroup digraphbits |
|
| 32 |
///\file |
|
| 33 |
|
|
| 31 |
//\ingroup digraphbits |
|
| 32 |
//\file |
|
| 33 |
//\brief Extenders for the digraph types |
|
| 34 | 34 |
namespace lemon {
|
| 35 | 35 |
|
| 36 |
/// \ingroup digraphbits |
|
| 37 |
/// |
|
| 38 |
// |
|
| 36 |
// \ingroup digraphbits |
|
| 37 |
// |
|
| 38 |
// \brief BaseDigraph to BaseGraph extender |
|
| 39 | 39 |
template <typename Base> |
| 40 | 40 |
class UndirDigraphExtender : public Base {
|
| 41 | 41 |
|
| ... | ... |
@@ -74,37 +74,37 @@ |
| 74 | 74 |
} |
| 75 | 75 |
}; |
| 76 | 76 |
|
| 77 |
|
|
| 77 |
// First node of the edge |
|
| 78 | 78 |
Node u(const Edge &e) const {
|
| 79 | 79 |
return Parent::source(e); |
| 80 | 80 |
} |
| 81 | 81 |
|
| 82 |
|
|
| 82 |
// Source of the given arc |
|
| 83 | 83 |
Node source(const Arc &e) const {
|
| 84 | 84 |
return e.forward ? Parent::source(e) : Parent::target(e); |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 |
|
|
| 87 |
// Second node of the edge |
|
| 88 | 88 |
Node v(const Edge &e) const {
|
| 89 | 89 |
return Parent::target(e); |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
|
|
| 92 |
// Target of the given arc |
|
| 93 | 93 |
Node target(const Arc &e) const {
|
| 94 | 94 |
return e.forward ? Parent::target(e) : Parent::source(e); |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 |
/// \brief Directed arc from an edge. |
|
| 98 |
/// |
|
| 99 |
/// Returns a directed arc corresponding to the specified edge. |
|
| 100 |
/// If the given bool is true, the first node of the given edge and |
|
| 101 |
// |
|
| 97 |
// \brief Directed arc from an edge. |
|
| 98 |
// |
|
| 99 |
// Returns a directed arc corresponding to the specified edge. |
|
| 100 |
// If the given bool is true, the first node of the given edge and |
|
| 101 |
// the source node of the returned arc are the same. |
|
| 102 | 102 |
static Arc direct(const Edge &e, bool d) {
|
| 103 | 103 |
return Arc(e, d); |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 |
/// Returns whether the given directed arc has the same orientation |
|
| 107 |
/// as the corresponding edge. |
|
| 106 |
// Returns whether the given directed arc has the same orientation |
|
| 107 |
// as the corresponding edge. |
|
| 108 | 108 |
static bool direction(const Arc &a) { return a.forward; }
|
| 109 | 109 |
|
| 110 | 110 |
using Parent::first; |
| ... | ... |
@@ -19,11 +19,11 @@ |
| 19 | 19 |
#ifndef LEMON_BEZIER_H |
| 20 | 20 |
#define LEMON_BEZIER_H |
| 21 | 21 |
|
| 22 |
///\ingroup misc |
|
| 23 |
///\file |
|
| 24 |
///\brief Classes to compute with Bezier curves. |
|
| 25 |
/// |
|
| 26 |
// |
|
| 22 |
//\ingroup misc |
|
| 23 |
//\file |
|
| 24 |
//\brief Classes to compute with Bezier curves. |
|
| 25 |
// |
|
| 26 |
//Up to now this file is used internally by \ref graph_to_eps.h |
|
| 27 | 27 |
|
| 28 | 28 |
#include<lemon/dim2.h> |
| 29 | 29 |
| ... | ... |
@@ -19,14 +19,13 @@ |
| 19 | 19 |
#ifndef LEMON_BITS_DEFAULT_MAP_H |
| 20 | 20 |
#define LEMON_BITS_DEFAULT_MAP_H |
| 21 | 21 |
|
| 22 |
|
|
| 23 | 22 |
#include <lemon/bits/array_map.h> |
| 24 | 23 |
#include <lemon/bits/vector_map.h> |
| 25 | 24 |
//#include <lemon/bits/debug_map.h> |
| 26 | 25 |
|
| 27 |
///\ingroup graphbits |
|
| 28 |
///\file |
|
| 29 |
|
|
| 26 |
//\ingroup graphbits |
|
| 27 |
//\file |
|
| 28 |
//\brief Graph maps that construct and destruct their elements dynamically. |
|
| 30 | 29 |
|
| 31 | 30 |
namespace lemon {
|
| 32 | 31 |
|
| ... | ... |
@@ -149,7 +148,7 @@ |
| 149 | 148 |
|
| 150 | 149 |
// #endif |
| 151 | 150 |
|
| 152 |
// |
|
| 151 |
// DefaultMap class |
|
| 153 | 152 |
template <typename _Graph, typename _Item, typename _Value> |
| 154 | 153 |
class DefaultMap |
| 155 | 154 |
: public DefaultMapSelector<_Graph, _Item, _Value>::Map {
|
| ... | ... |
@@ -35,29 +35,29 @@ |
| 35 | 35 |
#ifndef LEMON_BITS_ENABLE_IF_H |
| 36 | 36 |
#define LEMON_BITS_ENABLE_IF_H |
| 37 | 37 |
|
| 38 |
///\file |
|
| 39 |
///\brief Miscellaneous basic utilities |
|
| 38 |
//\file |
|
| 39 |
//\brief Miscellaneous basic utilities |
|
| 40 | 40 |
|
| 41 | 41 |
namespace lemon |
| 42 | 42 |
{
|
| 43 | 43 |
|
| 44 |
|
|
| 44 |
// Basic type for defining "tags". A "YES" condition for \c enable_if. |
|
| 45 | 45 |
|
| 46 |
/// Basic type for defining "tags". A "YES" condition for \c enable_if. |
|
| 47 |
/// |
|
| 48 |
// |
|
| 46 |
// Basic type for defining "tags". A "YES" condition for \c enable_if. |
|
| 47 |
// |
|
| 48 |
//\sa False |
|
| 49 | 49 |
struct True {
|
| 50 |
// |
|
| 50 |
//\e |
|
| 51 | 51 |
static const bool value = true; |
| 52 | 52 |
}; |
| 53 | 53 |
|
| 54 |
|
|
| 54 |
// Basic type for defining "tags". A "NO" condition for \c enable_if. |
|
| 55 | 55 |
|
| 56 |
/// Basic type for defining "tags". A "NO" condition for \c enable_if. |
|
| 57 |
/// |
|
| 58 |
// |
|
| 56 |
// Basic type for defining "tags". A "NO" condition for \c enable_if. |
|
| 57 |
// |
|
| 58 |
//\sa True |
|
| 59 | 59 |
struct False {
|
| 60 |
// |
|
| 60 |
//\e |
|
| 61 | 61 |
static const bool value = false; |
| 62 | 62 |
}; |
| 63 | 63 |
| ... | ... |
@@ -27,14 +27,14 @@ |
| 27 | 27 |
#include <lemon/concept_check.h> |
| 28 | 28 |
#include <lemon/concepts/maps.h> |
| 29 | 29 |
|
| 30 |
///\ingroup graphbits |
|
| 31 |
///\file |
|
| 32 |
|
|
| 30 |
//\ingroup graphbits |
|
| 31 |
//\file |
|
| 32 |
//\brief Extenders for the digraph types |
|
| 33 | 33 |
namespace lemon {
|
| 34 | 34 |
|
| 35 |
/// \ingroup graphbits |
|
| 36 |
/// |
|
| 37 |
// |
|
| 35 |
// \ingroup graphbits |
|
| 36 |
// |
|
| 37 |
// \brief Extender for the Digraphs |
|
| 38 | 38 |
template <typename Base> |
| 39 | 39 |
class DigraphExtender : public Base {
|
| 40 | 40 |
public: |
| ... | ... |
@@ -186,30 +186,30 @@ |
| 186 | 186 |
|
| 187 | 187 |
}; |
| 188 | 188 |
|
| 189 |
/// \brief Base node of the iterator |
|
| 190 |
/// |
|
| 191 |
// |
|
| 189 |
// \brief Base node of the iterator |
|
| 190 |
// |
|
| 191 |
// Returns the base node (i.e. the source in this case) of the iterator |
|
| 192 | 192 |
Node baseNode(const OutArcIt &arc) const {
|
| 193 | 193 |
return Parent::source(arc); |
| 194 | 194 |
} |
| 195 |
/// \brief Running node of the iterator |
|
| 196 |
/// |
|
| 197 |
/// Returns the running node (i.e. the target in this case) of the |
|
| 198 |
/// iterator |
|
| 195 |
// \brief Running node of the iterator |
|
| 196 |
// |
|
| 197 |
// Returns the running node (i.e. the target in this case) of the |
|
| 198 |
// iterator |
|
| 199 | 199 |
Node runningNode(const OutArcIt &arc) const {
|
| 200 | 200 |
return Parent::target(arc); |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 |
/// \brief Base node of the iterator |
|
| 204 |
/// |
|
| 205 |
// |
|
| 203 |
// \brief Base node of the iterator |
|
| 204 |
// |
|
| 205 |
// Returns the base node (i.e. the target in this case) of the iterator |
|
| 206 | 206 |
Node baseNode(const InArcIt &arc) const {
|
| 207 | 207 |
return Parent::target(arc); |
| 208 | 208 |
} |
| 209 |
/// \brief Running node of the iterator |
|
| 210 |
/// |
|
| 211 |
/// Returns the running node (i.e. the source in this case) of the |
|
| 212 |
/// iterator |
|
| 209 |
// \brief Running node of the iterator |
|
| 210 |
// |
|
| 211 |
// Returns the running node (i.e. the source in this case) of the |
|
| 212 |
// iterator |
|
| 213 | 213 |
Node runningNode(const InArcIt &arc) const {
|
| 214 | 214 |
return Parent::source(arc); |
| 215 | 215 |
} |
| ... | ... |
@@ -325,9 +325,9 @@ |
| 325 | 325 |
} |
| 326 | 326 |
}; |
| 327 | 327 |
|
| 328 |
/// \ingroup _graphbits |
|
| 329 |
/// |
|
| 330 |
// |
|
| 328 |
// \ingroup _graphbits |
|
| 329 |
// |
|
| 330 |
// \brief Extender for the Graphs |
|
| 331 | 331 |
template <typename Base> |
| 332 | 332 |
class GraphExtender : public Base {
|
| 333 | 333 |
public: |
| ... | ... |
@@ -555,43 +555,43 @@ |
| 555 | 555 |
} |
| 556 | 556 |
}; |
| 557 | 557 |
|
| 558 |
/// \brief Base node of the iterator |
|
| 559 |
/// |
|
| 560 |
// |
|
| 558 |
// \brief Base node of the iterator |
|
| 559 |
// |
|
| 560 |
// Returns the base node (ie. the source in this case) of the iterator |
|
| 561 | 561 |
Node baseNode(const OutArcIt &arc) const {
|
| 562 | 562 |
return Parent::source(static_cast<const Arc&>(arc)); |
| 563 | 563 |
} |
| 564 |
/// \brief Running node of the iterator |
|
| 565 |
/// |
|
| 566 |
/// Returns the running node (ie. the target in this case) of the |
|
| 567 |
/// iterator |
|
| 564 |
// \brief Running node of the iterator |
|
| 565 |
// |
|
| 566 |
// Returns the running node (ie. the target in this case) of the |
|
| 567 |
// iterator |
|
| 568 | 568 |
Node runningNode(const OutArcIt &arc) const {
|
| 569 | 569 |
return Parent::target(static_cast<const Arc&>(arc)); |
| 570 | 570 |
} |
| 571 | 571 |
|
| 572 |
/// \brief Base node of the iterator |
|
| 573 |
/// |
|
| 574 |
// |
|
| 572 |
// \brief Base node of the iterator |
|
| 573 |
// |
|
| 574 |
// Returns the base node (ie. the target in this case) of the iterator |
|
| 575 | 575 |
Node baseNode(const InArcIt &arc) const {
|
| 576 | 576 |
return Parent::target(static_cast<const Arc&>(arc)); |
| 577 | 577 |
} |
| 578 |
/// \brief Running node of the iterator |
|
| 579 |
/// |
|
| 580 |
/// Returns the running node (ie. the source in this case) of the |
|
| 581 |
/// iterator |
|
| 578 |
// \brief Running node of the iterator |
|
| 579 |
// |
|
| 580 |
// Returns the running node (ie. the source in this case) of the |
|
| 581 |
// iterator |
|
| 582 | 582 |
Node runningNode(const InArcIt &arc) const {
|
| 583 | 583 |
return Parent::source(static_cast<const Arc&>(arc)); |
| 584 | 584 |
} |
| 585 | 585 |
|
| 586 |
/// Base node of the iterator |
|
| 587 |
/// |
|
| 588 |
// |
|
| 586 |
// Base node of the iterator |
|
| 587 |
// |
|
| 588 |
// Returns the base node of the iterator |
|
| 589 | 589 |
Node baseNode(const IncEdgeIt &edge) const {
|
| 590 | 590 |
return edge._direction ? u(edge) : v(edge); |
| 591 | 591 |
} |
| 592 |
/// Running node of the iterator |
|
| 593 |
/// |
|
| 594 |
// |
|
| 592 |
// Running node of the iterator |
|
| 593 |
// |
|
| 594 |
// Returns the running node of the iterator |
|
| 595 | 595 |
Node runningNode(const IncEdgeIt &edge) const {
|
| 596 | 596 |
return edge._direction ? v(edge) : u(edge); |
| 597 | 597 |
} |
| ... | ... |
@@ -26,14 +26,14 @@ |
| 26 | 26 |
#include <lemon/concept_check.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
|
| 29 |
///\file |
|
| 30 |
///\brief Extenders for iterable maps. |
|
| 29 |
//\file |
|
| 30 |
//\brief Extenders for iterable maps. |
|
| 31 | 31 |
|
| 32 | 32 |
namespace lemon {
|
| 33 | 33 |
|
| 34 |
/// \ingroup graphbits |
|
| 35 |
/// |
|
| 36 |
// |
|
| 34 |
// \ingroup graphbits |
|
| 35 |
// |
|
| 36 |
// \brief Extender for maps |
|
| 37 | 37 |
template <typename _Map> |
| 38 | 38 |
class MapExtender : public _Map {
|
| 39 | 39 |
public: |
| ... | ... |
@@ -171,9 +171,9 @@ |
| 171 | 171 |
}; |
| 172 | 172 |
}; |
| 173 | 173 |
|
| 174 |
/// \ingroup graphbits |
|
| 175 |
/// |
|
| 176 |
// |
|
| 174 |
// \ingroup graphbits |
|
| 175 |
// |
|
| 176 |
// \brief Extender for maps which use a subset of the items. |
|
| 177 | 177 |
template <typename _Graph, typename _Map> |
| 178 | 178 |
class SubMapExtender : public _Map {
|
| 179 | 179 |
public: |
| ... | ... |
@@ -28,81 +28,81 @@ |
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
#include <lemon/concepts/maps.h> |
| 30 | 30 |
|
| 31 |
///\ingroup graphbits |
|
| 32 |
/// |
|
| 33 |
///\file |
|
| 34 |
///\brief Vector based graph maps. |
|
| 31 |
//\ingroup graphbits |
|
| 32 |
// |
|
| 33 |
//\file |
|
| 34 |
//\brief Vector based graph maps. |
|
| 35 | 35 |
namespace lemon {
|
| 36 | 36 |
|
| 37 |
/// \ingroup graphbits |
|
| 38 |
/// |
|
| 39 |
/// \brief Graph map based on the std::vector storage. |
|
| 40 |
/// |
|
| 41 |
/// The VectorMap template class is graph map structure what |
|
| 42 |
/// automatically updates the map when a key is added to or erased from |
|
| 43 |
/// the map. This map type uses the std::vector to store the values. |
|
| 44 |
/// |
|
| 45 |
/// \tparam _Graph The graph this map is attached to. |
|
| 46 |
/// \tparam _Item The item type of the graph items. |
|
| 47 |
// |
|
| 37 |
// \ingroup graphbits |
|
| 38 |
// |
|
| 39 |
// \brief Graph map based on the std::vector storage. |
|
| 40 |
// |
|
| 41 |
// The VectorMap template class is graph map structure what |
|
| 42 |
// automatically updates the map when a key is added to or erased from |
|
| 43 |
// the map. This map type uses the std::vector to store the values. |
|
| 44 |
// |
|
| 45 |
// \tparam _Graph The graph this map is attached to. |
|
| 46 |
// \tparam _Item The item type of the graph items. |
|
| 47 |
// \tparam _Value The value type of the map. |
|
| 48 | 48 |
template <typename _Graph, typename _Item, typename _Value> |
| 49 | 49 |
class VectorMap |
| 50 | 50 |
: public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
|
| 51 | 51 |
private: |
| 52 | 52 |
|
| 53 |
|
|
| 53 |
// The container type of the map. |
|
| 54 | 54 |
typedef std::vector<_Value> Container; |
| 55 | 55 |
|
| 56 | 56 |
public: |
| 57 | 57 |
|
| 58 |
|
|
| 58 |
// The graph type of the map. |
|
| 59 | 59 |
typedef _Graph Graph; |
| 60 |
|
|
| 60 |
// The item type of the map. |
|
| 61 | 61 |
typedef _Item Item; |
| 62 |
|
|
| 62 |
// The reference map tag. |
|
| 63 | 63 |
typedef True ReferenceMapTag; |
| 64 | 64 |
|
| 65 |
|
|
| 65 |
// The key type of the map. |
|
| 66 | 66 |
typedef _Item Key; |
| 67 |
|
|
| 67 |
// The value type of the map. |
|
| 68 | 68 |
typedef _Value Value; |
| 69 | 69 |
|
| 70 |
|
|
| 70 |
// The notifier type. |
|
| 71 | 71 |
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; |
| 72 | 72 |
|
| 73 |
|
|
| 73 |
// The map type. |
|
| 74 | 74 |
typedef VectorMap Map; |
| 75 |
|
|
| 75 |
// The base class of the map. |
|
| 76 | 76 |
typedef typename Notifier::ObserverBase Parent; |
| 77 | 77 |
|
| 78 |
|
|
| 78 |
// The reference type of the map; |
|
| 79 | 79 |
typedef typename Container::reference Reference; |
| 80 |
|
|
| 80 |
// The const reference type of the map; |
|
| 81 | 81 |
typedef typename Container::const_reference ConstReference; |
| 82 | 82 |
|
| 83 | 83 |
|
| 84 |
/// \brief Constructor to attach the new map into the notifier. |
|
| 85 |
/// |
|
| 86 |
/// It constructs a map and attachs it into the notifier. |
|
| 87 |
/// It adds all the items of the graph to the map. |
|
| 84 |
// \brief Constructor to attach the new map into the notifier. |
|
| 85 |
// |
|
| 86 |
// It constructs a map and attachs it into the notifier. |
|
| 87 |
// It adds all the items of the graph to the map. |
|
| 88 | 88 |
VectorMap(const Graph& graph) {
|
| 89 | 89 |
Parent::attach(graph.notifier(Item())); |
| 90 | 90 |
container.resize(Parent::notifier()->maxId() + 1); |
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 |
/// \brief Constructor uses given value to initialize the map. |
|
| 94 |
/// |
|
| 95 |
/// It constructs a map uses a given value to initialize the map. |
|
| 96 |
/// It adds all the items of the graph to the map. |
|
| 93 |
// \brief Constructor uses given value to initialize the map. |
|
| 94 |
// |
|
| 95 |
// It constructs a map uses a given value to initialize the map. |
|
| 96 |
// It adds all the items of the graph to the map. |
|
| 97 | 97 |
VectorMap(const Graph& graph, const Value& value) {
|
| 98 | 98 |
Parent::attach(graph.notifier(Item())); |
| 99 | 99 |
container.resize(Parent::notifier()->maxId() + 1, value); |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 | 102 |
private: |
| 103 |
/// \brief Copy constructor |
|
| 104 |
/// |
|
| 105 |
// |
|
| 103 |
// \brief Copy constructor |
|
| 104 |
// |
|
| 105 |
// Copy constructor. |
|
| 106 | 106 |
VectorMap(const VectorMap& _copy) : Parent() {
|
| 107 | 107 |
if (_copy.attached()) {
|
| 108 | 108 |
Parent::attach(*_copy.notifier()); |
| ... | ... |
@@ -110,24 +110,24 @@ |
| 110 | 110 |
} |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 |
/// \brief Assign operator. |
|
| 114 |
/// |
|
| 115 |
/// This operator assigns for each item in the map the |
|
| 116 |
/// value mapped to the same item in the copied map. |
|
| 117 |
/// The parameter map should be indiced with the same |
|
| 118 |
/// itemset because this assign operator does not change |
|
| 119 |
// |
|
| 113 |
// \brief Assign operator. |
|
| 114 |
// |
|
| 115 |
// This operator assigns for each item in the map the |
|
| 116 |
// value mapped to the same item in the copied map. |
|
| 117 |
// The parameter map should be indiced with the same |
|
| 118 |
// itemset because this assign operator does not change |
|
| 119 |
// the container of the map. |
|
| 120 | 120 |
VectorMap& operator=(const VectorMap& cmap) {
|
| 121 | 121 |
return operator=<VectorMap>(cmap); |
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
|
| 125 |
/// \brief Template assign operator. |
|
| 126 |
/// |
|
| 127 |
/// The given parameter should be conform to the ReadMap |
|
| 128 |
/// concecpt and could be indiced by the current item set of |
|
| 129 |
/// the NodeMap. In this case the value for each item |
|
| 130 |
/// is assigned by the value of the given ReadMap. |
|
| 125 |
// \brief Template assign operator. |
|
| 126 |
// |
|
| 127 |
// The given parameter should be conform to the ReadMap |
|
| 128 |
// concecpt and could be indiced by the current item set of |
|
| 129 |
// the NodeMap. In this case the value for each item |
|
| 130 |
// is assigned by the value of the given ReadMap. |
|
| 131 | 131 |
template <typename CMap> |
| 132 | 132 |
VectorMap& operator=(const CMap& cmap) {
|
| 133 | 133 |
checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); |
| ... | ... |
@@ -141,36 +141,36 @@ |
| 141 | 141 |
|
| 142 | 142 |
public: |
| 143 | 143 |
|
| 144 |
/// \brief The subcript operator. |
|
| 145 |
/// |
|
| 146 |
/// The subscript operator. The map can be subscripted by the |
|
| 147 |
/// actual items of the graph. |
|
| 144 |
// \brief The subcript operator. |
|
| 145 |
// |
|
| 146 |
// The subscript operator. The map can be subscripted by the |
|
| 147 |
// actual items of the graph. |
|
| 148 | 148 |
Reference operator[](const Key& key) {
|
| 149 | 149 |
return container[Parent::notifier()->id(key)]; |
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 |
/// \brief The const subcript operator. |
|
| 153 |
/// |
|
| 154 |
/// The const subscript operator. The map can be subscripted by the |
|
| 155 |
/// actual items of the graph. |
|
| 152 |
// \brief The const subcript operator. |
|
| 153 |
// |
|
| 154 |
// The const subscript operator. The map can be subscripted by the |
|
| 155 |
// actual items of the graph. |
|
| 156 | 156 |
ConstReference operator[](const Key& key) const {
|
| 157 | 157 |
return container[Parent::notifier()->id(key)]; |
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
|
| 161 |
/// \brief The setter function of the map. |
|
| 162 |
/// |
|
| 163 |
// |
|
| 161 |
// \brief The setter function of the map. |
|
| 162 |
// |
|
| 163 |
// It the same as operator[](key) = value expression. |
|
| 164 | 164 |
void set(const Key& key, const Value& value) {
|
| 165 | 165 |
(*this)[key] = value; |
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 | 168 |
protected: |
| 169 | 169 |
|
| 170 |
/// \brief Adds a new key to the map. |
|
| 171 |
/// |
|
| 172 |
/// It adds a new key to the map. It called by the observer notifier |
|
| 173 |
/// and it overrides the add() member function of the observer base. |
|
| 170 |
// \brief Adds a new key to the map. |
|
| 171 |
// |
|
| 172 |
// It adds a new key to the map. It called by the observer notifier |
|
| 173 |
// and it overrides the add() member function of the observer base. |
|
| 174 | 174 |
virtual void add(const Key& key) {
|
| 175 | 175 |
int id = Parent::notifier()->id(key); |
| 176 | 176 |
if (id >= int(container.size())) {
|
| ... | ... |
@@ -178,10 +178,10 @@ |
| 178 | 178 |
} |
| 179 | 179 |
} |
| 180 | 180 |
|
| 181 |
/// \brief Adds more new keys to the map. |
|
| 182 |
/// |
|
| 183 |
/// It adds more new keys to the map. It called by the observer notifier |
|
| 184 |
/// and it overrides the add() member function of the observer base. |
|
| 181 |
// \brief Adds more new keys to the map. |
|
| 182 |
// |
|
| 183 |
// It adds more new keys to the map. It called by the observer notifier |
|
| 184 |
// and it overrides the add() member function of the observer base. |
|
| 185 | 185 |
virtual void add(const std::vector<Key>& keys) {
|
| 186 | 186 |
int max = container.size() - 1; |
| 187 | 187 |
for (int i = 0; i < int(keys.size()); ++i) {
|
| ... | ... |
@@ -193,38 +193,38 @@ |
| 193 | 193 |
container.resize(max + 1); |
| 194 | 194 |
} |
| 195 | 195 |
|
| 196 |
/// \brief Erase a key from the map. |
|
| 197 |
/// |
|
| 198 |
/// Erase a key from the map. It called by the observer notifier |
|
| 199 |
/// and it overrides the erase() member function of the observer base. |
|
| 196 |
// \brief Erase a key from the map. |
|
| 197 |
// |
|
| 198 |
// Erase a key from the map. It called by the observer notifier |
|
| 199 |
// and it overrides the erase() member function of the observer base. |
|
| 200 | 200 |
virtual void erase(const Key& key) {
|
| 201 | 201 |
container[Parent::notifier()->id(key)] = Value(); |
| 202 | 202 |
} |
| 203 | 203 |
|
| 204 |
/// \brief Erase more keys from the map. |
|
| 205 |
/// |
|
| 206 |
/// Erase more keys from the map. It called by the observer notifier |
|
| 207 |
/// and it overrides the erase() member function of the observer base. |
|
| 204 |
// \brief Erase more keys from the map. |
|
| 205 |
// |
|
| 206 |
// Erase more keys from the map. It called by the observer notifier |
|
| 207 |
// and it overrides the erase() member function of the observer base. |
|
| 208 | 208 |
virtual void erase(const std::vector<Key>& keys) {
|
| 209 | 209 |
for (int i = 0; i < int(keys.size()); ++i) {
|
| 210 | 210 |
container[Parent::notifier()->id(keys[i])] = Value(); |
| 211 | 211 |
} |
| 212 | 212 |
} |
| 213 | 213 |
|
| 214 |
/// \brief Buildes the map. |
|
| 215 |
/// |
|
| 216 |
/// It buildes the map. It called by the observer notifier |
|
| 217 |
/// and it overrides the build() member function of the observer base. |
|
| 214 |
// \brief Buildes the map. |
|
| 215 |
// |
|
| 216 |
// It buildes the map. It called by the observer notifier |
|
| 217 |
// and it overrides the build() member function of the observer base. |
|
| 218 | 218 |
virtual void build() {
|
| 219 | 219 |
int size = Parent::notifier()->maxId() + 1; |
| 220 | 220 |
container.reserve(size); |
| 221 | 221 |
container.resize(size); |
| 222 | 222 |
} |
| 223 | 223 |
|
| 224 |
/// \brief Clear the map. |
|
| 225 |
/// |
|
| 226 |
/// It erase all items from the map. It called by the observer notifier |
|
| 227 |
/// and it overrides the clear() member function of the observer base. |
|
| 224 |
// \brief Clear the map. |
|
| 225 |
// |
|
| 226 |
// It erase all items from the map. It called by the observer notifier |
|
| 227 |
// and it overrides the clear() member function of the observer base. |
|
| 228 | 228 |
virtual void clear() {
|
| 229 | 229 |
container.clear(); |
| 230 | 230 |
} |
| ... | ... |
@@ -92,7 +92,7 @@ |
| 92 | 92 |
/// Dark cyan color constant |
| 93 | 93 |
extern const Color DARK_CYAN; |
| 94 | 94 |
|
| 95 |
///Map <tt>int</tt>s to different |
|
| 95 |
///Map <tt>int</tt>s to different <tt>Color</tt>s |
|
| 96 | 96 |
|
| 97 | 97 |
///This map assigns one of the predefined \ref Color "Color"s to |
| 98 | 98 |
///each <tt>int</tt>. It is possible to change the colors as well as |
| ... | ... |
@@ -982,7 +982,7 @@ |
| 982 | 982 |
/// \brief Class describing the concept of graph maps |
| 983 | 983 |
/// |
| 984 | 984 |
/// This class describes the common interface of the graph maps |
| 985 |
/// (NodeMap, ArcMap), that is |
|
| 985 |
/// (NodeMap, ArcMap), that is maps that can be used to |
|
| 986 | 986 |
/// associate data to graph descriptors (nodes or arcs). |
| 987 | 987 |
template <typename _Graph, typename _Item, typename _Value> |
| 988 | 988 |
class GraphMap : public ReadWriteMap<_Item, _Value> {
|
| ... | ... |
@@ -22,7 +22,7 @@ |
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/concept_check.h> |
| 24 | 24 |
|
| 25 |
///\ingroup |
|
| 25 |
///\ingroup map_concepts |
|
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief The concept of maps. |
| 28 | 28 |
|
| ... | ... |
@@ -30,7 +30,7 @@ |
| 30 | 30 |
|
| 31 | 31 |
namespace concepts {
|
| 32 | 32 |
|
| 33 |
/// \addtogroup |
|
| 33 |
/// \addtogroup map_concepts |
|
| 34 | 34 |
/// @{
|
| 35 | 35 |
|
| 36 | 36 |
/// Readable map concept |
| ... | ... |
@@ -1554,7 +1554,7 @@ |
| 1554 | 1554 |
///\note This is a dynamic data structure, therefore the data |
| 1555 | 1555 |
///structure is updated after each graph alteration. Thus although |
| 1556 | 1556 |
///this data structure is theoretically faster than \ref ArcLookUp |
| 1557 |
///and \ref |
|
| 1557 |
///and \ref AllArcLookUp, it often provides worse performance than |
|
| 1558 | 1558 |
///them. |
| 1559 | 1559 |
Arc operator()(Node s, Node t, Arc p = INVALID) const {
|
| 1560 | 1560 |
if (p == INVALID) {
|
| ... | ... |
@@ -1699,8 +1699,8 @@ |
| 1699 | 1699 |
|
| 1700 | 1700 |
///Find an arc between two nodes. |
| 1701 | 1701 |
|
| 1702 |
///Find an arc between two nodes in time <em>O</em>(log<em>d</em>), where |
|
| 1703 |
///<em>d</em> is the number of outgoing arcs of \c s. |
|
| 1702 |
///Find an arc between two nodes in time <em>O</em>(log<em>d</em>), |
|
| 1703 |
///where <em>d</em> is the number of outgoing arcs of \c s. |
|
| 1704 | 1704 |
///\param s The source node. |
| 1705 | 1705 |
///\param t The target node. |
| 1706 | 1706 |
///\return An arc from \c s to \c t if there exists, |
| ... | ... |
@@ -1817,8 +1817,8 @@ |
| 1817 | 1817 |
///for(Arc a = ae(u,v); a != INVALID; a=ae(u,v,a)) n++; |
| 1818 | 1818 |
///\endcode |
| 1819 | 1819 |
/// |
| 1820 |
///Finding the first arc take <em>O</em>(log<em>d</em>) time, where |
|
| 1821 |
///<em>d</em> is the number of outgoing arcs of \c s. Then, the |
|
| 1820 |
///Finding the first arc take <em>O</em>(log<em>d</em>) time, |
|
| 1821 |
///where <em>d</em> is the number of outgoing arcs of \c s. Then the |
|
| 1822 | 1822 |
///consecutive arcs are found in constant time. |
| 1823 | 1823 |
/// |
| 1824 | 1824 |
///\warning If you change the digraph, refresh() must be called before using |
| ... | ... |
@@ -453,7 +453,7 @@ |
| 453 | 453 |
}; |
| 454 | 454 |
|
| 455 | 455 |
/// \brief \ref named-templ-param "Named parameter" for setting |
| 456 |
///\ |
|
| 456 |
///\c OperationTraits type |
|
| 457 | 457 |
/// |
| 458 | 458 |
///\ref named-templ-param "Named parameter" for setting |
| 459 | 459 |
///\ref OperationTraits type. |
| ... | ... |
@@ -1038,7 +1038,7 @@ |
| 1038 | 1038 |
typedef lemon::Path<Digraph> Path; |
| 1039 | 1039 |
}; |
| 1040 | 1040 |
|
| 1041 |
/// Default traits class used by |
|
| 1041 |
/// Default traits class used by DijkstraWizard |
|
| 1042 | 1042 |
|
| 1043 | 1043 |
/// To make it easier to use Dijkstra algorithm |
| 1044 | 1044 |
/// we have created a wizard class. |
| ... | ... |
@@ -259,10 +259,10 @@ |
| 259 | 259 |
|
| 260 | 260 |
|
| 261 | 261 |
|
| 262 |
/// Bounding box of plain vectors ( |
|
| 262 |
/// Bounding box of plain vectors (points). |
|
| 263 | 263 |
|
| 264 | 264 |
/// A class to calculate or store the bounding box of plain vectors |
| 265 |
/// (\ref Point points). |
|
| 265 |
/// (\ref Point "points"). |
|
| 266 | 266 |
template<typename T> |
| 267 | 267 |
class Box {
|
| 268 | 268 |
Point<T> _bottom_left, _top_right; |
| ... | ... |
@@ -573,9 +573,8 @@ |
| 573 | 573 |
return os; |
| 574 | 574 |
} |
| 575 | 575 |
|
| 576 |
///Map of x-coordinates of a |
|
| 576 |
///Map of x-coordinates of a <tt>Point</tt>-map |
|
| 577 | 577 |
|
| 578 |
///\ingroup maps |
|
| 579 | 578 |
///Map of x-coordinates of a \ref Point "Point"-map. |
| 580 | 579 |
/// |
| 581 | 580 |
template<class M> |
| ... | ... |
@@ -592,11 +591,9 @@ |
| 592 | 591 |
void set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));}
|
| 593 | 592 |
}; |
| 594 | 593 |
|
| 595 |
///Returns an |
|
| 594 |
///Returns an XMap class |
|
| 596 | 595 |
|
| 597 |
///This function just returns an \ref XMap class. |
|
| 598 |
/// |
|
| 599 |
/// |
|
| 596 |
///This function just returns an XMap class. |
|
| 600 | 597 |
///\relates XMap |
| 601 | 598 |
template<class M> |
| 602 | 599 |
inline XMap<M> xMap(M &m) |
| ... | ... |
@@ -610,10 +607,9 @@ |
| 610 | 607 |
return XMap<M>(m); |
| 611 | 608 |
} |
| 612 | 609 |
|
| 613 |
///Constant (read only) version of |
|
| 610 |
///Constant (read only) version of XMap |
|
| 614 | 611 |
|
| 615 |
///\ingroup maps |
|
| 616 |
///Constant (read only) version of \ref XMap |
|
| 612 |
///Constant (read only) version of XMap. |
|
| 617 | 613 |
/// |
| 618 | 614 |
template<class M> |
| 619 | 615 |
class ConstXMap |
| ... | ... |
@@ -628,11 +624,9 @@ |
| 628 | 624 |
Value operator[](Key k) const {return _map[k].x;}
|
| 629 | 625 |
}; |
| 630 | 626 |
|
| 631 |
///Returns a |
|
| 627 |
///Returns a ConstXMap class |
|
| 632 | 628 |
|
| 633 |
///This function just returns a \ref ConstXMap class. |
|
| 634 |
/// |
|
| 635 |
/// |
|
| 629 |
///This function just returns a ConstXMap class. |
|
| 636 | 630 |
///\relates ConstXMap |
| 637 | 631 |
template<class M> |
| 638 | 632 |
inline ConstXMap<M> xMap(const M &m) |
| ... | ... |
@@ -640,9 +634,8 @@ |
| 640 | 634 |
return ConstXMap<M>(m); |
| 641 | 635 |
} |
| 642 | 636 |
|
| 643 |
///Map of y-coordinates of a |
|
| 637 |
///Map of y-coordinates of a <tt>Point</tt>-map |
|
| 644 | 638 |
|
| 645 |
///\ingroup maps |
|
| 646 | 639 |
///Map of y-coordinates of a \ref Point "Point"-map. |
| 647 | 640 |
/// |
| 648 | 641 |
template<class M> |
| ... | ... |
@@ -659,11 +652,9 @@ |
| 659 | 652 |
void set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));}
|
| 660 | 653 |
}; |
| 661 | 654 |
|
| 662 |
///Returns a |
|
| 655 |
///Returns a YMap class |
|
| 663 | 656 |
|
| 664 |
///This function just returns a \ref YMap class. |
|
| 665 |
/// |
|
| 666 |
/// |
|
| 657 |
///This function just returns a YMap class. |
|
| 667 | 658 |
///\relates YMap |
| 668 | 659 |
template<class M> |
| 669 | 660 |
inline YMap<M> yMap(M &m) |
| ... | ... |
@@ -677,10 +668,9 @@ |
| 677 | 668 |
return YMap<M>(m); |
| 678 | 669 |
} |
| 679 | 670 |
|
| 680 |
///Constant (read only) version of |
|
| 671 |
///Constant (read only) version of YMap |
|
| 681 | 672 |
|
| 682 |
///\ingroup maps |
|
| 683 |
///Constant (read only) version of \ref YMap |
|
| 673 |
///Constant (read only) version of YMap. |
|
| 684 | 674 |
/// |
| 685 | 675 |
template<class M> |
| 686 | 676 |
class ConstYMap |
| ... | ... |
@@ -695,11 +685,9 @@ |
| 695 | 685 |
Value operator[](Key k) const {return _map[k].y;}
|
| 696 | 686 |
}; |
| 697 | 687 |
|
| 698 |
///Returns a |
|
| 688 |
///Returns a ConstYMap class |
|
| 699 | 689 |
|
| 700 |
///This function just returns a \ref ConstYMap class. |
|
| 701 |
/// |
|
| 702 |
/// |
|
| 690 |
///This function just returns a ConstYMap class. |
|
| 703 | 691 |
///\relates ConstYMap |
| 704 | 692 |
template<class M> |
| 705 | 693 |
inline ConstYMap<M> yMap(const M &m) |
| ... | ... |
@@ -708,12 +696,10 @@ |
| 708 | 696 |
} |
| 709 | 697 |
|
| 710 | 698 |
|
| 711 |
///\brief Map of the \ref Point::normSquare() "normSquare()" |
|
| 712 |
///of a \ref Point "Point"-map |
|
| 699 |
///\brief Map of the normSquare() of a <tt>Point</tt>-map |
|
| 713 | 700 |
/// |
| 714 | 701 |
///Map of the \ref Point::normSquare() "normSquare()" |
| 715 | 702 |
///of a \ref Point "Point"-map. |
| 716 |
///\ingroup maps |
|
| 717 | 703 |
template<class M> |
| 718 | 704 |
class NormSquareMap |
| 719 | 705 |
{
|
| ... | ... |
@@ -727,11 +713,9 @@ |
| 727 | 713 |
Value operator[](Key k) const {return _map[k].normSquare();}
|
| 728 | 714 |
}; |
| 729 | 715 |
|
| 730 |
///Returns a |
|
| 716 |
///Returns a NormSquareMap class |
|
| 731 | 717 |
|
| 732 |
///This function just returns a \ref NormSquareMap class. |
|
| 733 |
/// |
|
| 734 |
/// |
|
| 718 |
///This function just returns a NormSquareMap class. |
|
| 735 | 719 |
///\relates NormSquareMap |
| 736 | 720 |
template<class M> |
| 737 | 721 |
inline NormSquareMap<M> normSquareMap(const M &m) |
| ... | ... |
@@ -413,7 +413,7 @@ |
| 413 | 413 |
/// Change the source of \c a to \c n |
| 414 | 414 |
/// |
| 415 | 415 |
///\note The <tt>InArcIt</tt>s referencing the changed arc remain |
| 416 |
///valid. However the <tt>ArcIt<tt>s and <tt>OutArcIt</tt>s are |
|
| 416 |
///valid. However the <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s are |
|
| 417 | 417 |
///invalidated. |
| 418 | 418 |
/// |
| 419 | 419 |
///\warning This functionality cannot be used together with the Snapshot |
| ... | ... |
@@ -43,7 +43,7 @@ |
| 43 | 43 |
template<typename K, typename V> |
| 44 | 44 |
class MapBase {
|
| 45 | 45 |
public: |
| 46 |
/// \ |
|
| 46 |
/// \brief The key type of the map. |
|
| 47 | 47 |
typedef K Key; |
| 48 | 48 |
/// \brief The value type of the map. |
| 49 | 49 |
/// (The type of objects associated with the keys). |
| ... | ... |
@@ -1683,6 +1683,11 @@ |
| 1683 | 1683 |
|
| 1684 | 1684 |
} |
| 1685 | 1685 |
|
| 1686 |
/// @} |
|
| 1687 |
|
|
| 1688 |
/// \addtogroup maps |
|
| 1689 |
/// @{
|
|
| 1690 |
|
|
| 1686 | 1691 |
/// \brief Writable bool map for logging each \c true assigned element |
| 1687 | 1692 |
/// |
| 1688 | 1693 |
/// A \ref concepts::WriteMap "writable" bool map for logging |
| ... | ... |
@@ -1775,6 +1780,11 @@ |
| 1775 | 1780 |
return LoggerBoolMap<Iterator>(it); |
| 1776 | 1781 |
} |
| 1777 | 1782 |
|
| 1783 |
/// @} |
|
| 1784 |
|
|
| 1785 |
/// \addtogroup graph_maps |
|
| 1786 |
/// @{
|
|
| 1787 |
|
|
| 1778 | 1788 |
/// Provides an immutable and unique id for each item in the graph. |
| 1779 | 1789 |
|
| 1780 | 1790 |
/// The IdMap class provides a unique and immutable id for each item of the |
| ... | ... |
@@ -1882,8 +1892,6 @@ |
| 1882 | 1892 |
/// The value type of the InvertableMap. |
| 1883 | 1893 |
typedef typename Map::Value Value; |
| 1884 | 1894 |
|
| 1885 |
|
|
| 1886 |
|
|
| 1887 | 1895 |
/// \brief Constructor. |
| 1888 | 1896 |
/// |
| 1889 | 1897 |
/// Construct a new InvertableMap for the graph. |
| ... | ... |
@@ -2049,8 +2057,6 @@ |
| 2049 | 2057 |
return InverseMap(*this); |
| 2050 | 2058 |
} |
| 2051 | 2059 |
|
| 2052 |
|
|
| 2053 |
|
|
| 2054 | 2060 |
}; |
| 2055 | 2061 |
|
| 2056 | 2062 |
/// \brief Provides a mutable, continuous and unique descriptor for each |
| ... | ... |
@@ -2266,7 +2272,7 @@ |
| 2266 | 2272 |
/// \brief Constructor |
| 2267 | 2273 |
/// |
| 2268 | 2274 |
/// Constructor |
| 2269 |
/// \param |
|
| 2275 |
/// \param digraph The digraph that the map belongs to. |
|
| 2270 | 2276 |
explicit SourceMap(const Digraph& digraph) : _digraph(digraph) {}
|
| 2271 | 2277 |
|
| 2272 | 2278 |
/// \brief The subscript operator. |
| ... | ... |
@@ -2305,7 +2311,7 @@ |
| 2305 | 2311 |
/// \brief Constructor |
| 2306 | 2312 |
/// |
| 2307 | 2313 |
/// Constructor |
| 2308 |
/// \param |
|
| 2314 |
/// \param digraph The digraph that the map belongs to. |
|
| 2309 | 2315 |
explicit TargetMap(const Digraph& digraph) : _digraph(digraph) {}
|
| 2310 | 2316 |
|
| 2311 | 2317 |
/// \brief The subscript operator. |
| ... | ... |
@@ -2344,7 +2350,7 @@ |
| 2344 | 2350 |
/// \brief Constructor |
| 2345 | 2351 |
/// |
| 2346 | 2352 |
/// Constructor |
| 2347 |
/// \param |
|
| 2353 |
/// \param graph The graph that the map belongs to. |
|
| 2348 | 2354 |
explicit ForwardMap(const Graph& graph) : _graph(graph) {}
|
| 2349 | 2355 |
|
| 2350 | 2356 |
/// \brief The subscript operator. |
| ... | ... |
@@ -2383,7 +2389,7 @@ |
| 2383 | 2389 |
/// \brief Constructor |
| 2384 | 2390 |
/// |
| 2385 | 2391 |
/// Constructor |
| 2386 |
/// \param |
|
| 2392 |
/// \param graph The graph that the map belongs to. |
|
| 2387 | 2393 |
explicit BackwardMap(const Graph& graph) : _graph(graph) {}
|
| 2388 | 2394 |
|
| 2389 | 2395 |
/// \brief The subscript operator. |
| ... | ... |
@@ -849,7 +849,7 @@ |
| 849 | 849 |
/// \brief Return true when the path is empty. |
| 850 | 850 |
int empty() const { return len == 0; }
|
| 851 | 851 |
|
| 852 |
/// \ |
|
| 852 |
/// \brief Erase all arcs in the digraph. |
|
| 853 | 853 |
void clear() {
|
| 854 | 854 |
len = 0; |
| 855 | 855 |
if (arcs) delete[] arcs; |
| ... | ... |
@@ -365,7 +365,7 @@ |
| 365 | 365 |
///Constructor that immediately makes a snapshot |
| 366 | 366 |
|
| 367 | 367 |
///This constructor immediately makes a snapshot of the digraph. |
| 368 |
///\param |
|
| 368 |
///\param graph The digraph we make a snapshot of. |
|
| 369 | 369 |
Snapshot(SmartDigraph &graph) : _graph(&graph) {
|
| 370 | 370 |
node_num=_graph->nodes.size(); |
| 371 | 371 |
arc_num=_graph->arcs.size(); |
| ... | ... |
@@ -377,7 +377,7 @@ |
| 377 | 377 |
/// |
| 378 | 378 |
///This function can be called more than once. In case of a repeated |
| 379 | 379 |
///call, the previous snapshot gets lost. |
| 380 |
///\param |
|
| 380 |
///\param graph The digraph we make the snapshot of. |
|
| 381 | 381 |
void save(SmartDigraph &graph) |
| 382 | 382 |
{
|
| 383 | 383 |
_graph=&graph; |
| ... | ... |
@@ -775,7 +775,7 @@ |
| 775 | 775 |
///Constructor that immediately makes a snapshot |
| 776 | 776 |
|
| 777 | 777 |
///This constructor immediately makes a snapshot of the digraph. |
| 778 |
///\param |
|
| 778 |
///\param graph The digraph we make a snapshot of. |
|
| 779 | 779 |
Snapshot(SmartGraph &graph) {
|
| 780 | 780 |
graph.saveSnapshot(*this); |
| 781 | 781 |
} |
| ... | ... |
@@ -786,7 +786,7 @@ |
| 786 | 786 |
/// |
| 787 | 787 |
///This function can be called more than once. In case of a repeated |
| 788 | 788 |
///call, the previous snapshot gets lost. |
| 789 |
///\param |
|
| 789 |
///\param graph The digraph we make the snapshot of. |
|
| 790 | 790 |
void save(SmartGraph &graph) |
| 791 | 791 |
{
|
| 792 | 792 |
graph.saveSnapshot(*this); |
| ... | ... |
@@ -311,12 +311,11 @@ |
| 311 | 311 |
///\name Control the state of the timer |
| 312 | 312 |
///Basically a Timer can be either running or stopped, |
| 313 | 313 |
///but it provides a bit finer control on the execution. |
| 314 |
///The \ref Timer also counts the number of \ref start() |
|
| 315 |
///executions, and is stops only after the same amount (or more) |
|
| 316 |
///\ref stop() "stop()"s. This can be useful e.g. to compute |
|
| 317 |
///the running time |
|
| 314 |
///The \ref lemon::Timer "Timer" also counts the number of |
|
| 315 |
///\ref lemon::Timer::start() "start()" executions, and it stops |
|
| 316 |
///only after the same amount (or more) \ref lemon::Timer::stop() |
|
| 317 |
///"stop()"s. This can be useful e.g. to compute the running time |
|
| 318 | 318 |
///of recursive functions. |
| 319 |
/// |
|
| 320 | 319 |
|
| 321 | 320 |
///@{
|
| 322 | 321 |
|
| ... | ... |
@@ -472,7 +471,7 @@ |
| 472 | 471 |
///@} |
| 473 | 472 |
}; |
| 474 | 473 |
|
| 475 |
///Same as |
|
| 474 |
///Same as Timer but prints a report on destruction. |
|
| 476 | 475 |
|
| 477 | 476 |
///Same as \ref Timer but prints a report on destruction. |
| 478 | 477 |
///This example shows its usage. |
| ... | ... |
@@ -491,22 +490,22 @@ |
| 491 | 490 |
std::string _title; |
| 492 | 491 |
std::ostream &_os; |
| 493 | 492 |
public: |
| 494 |
/// |
|
| 493 |
///Constructor |
|
| 495 | 494 |
|
| 495 |
///Constructor. |
|
| 496 | 496 |
///\param title This text will be printed before the ellapsed time. |
| 497 | 497 |
///\param os The stream to print the report to. |
| 498 | 498 |
///\param run Sets whether the timer should start immediately. |
| 499 |
|
|
| 500 | 499 |
TimeReport(std::string title,std::ostream &os=std::cerr,bool run=true) |
| 501 | 500 |
: Timer(run), _title(title), _os(os){}
|
| 502 |
/// |
|
| 501 |
///Destructor that prints the ellapsed time |
|
| 503 | 502 |
~TimeReport() |
| 504 | 503 |
{
|
| 505 | 504 |
_os << _title << *this << std::endl; |
| 506 | 505 |
} |
| 507 | 506 |
}; |
| 508 | 507 |
|
| 509 |
///'Do nothing' version of |
|
| 508 |
///'Do nothing' version of TimeReport |
|
| 510 | 509 |
|
| 511 | 510 |
///\sa TimeReport |
| 512 | 511 |
/// |
0 comments (0 inline)