0
10
0
1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
2 | 2 |
|
3 | 3 |
#EXECUTE_PROCESS( |
4 | 4 |
# COMMAND hg id -i |
5 | 5 |
# OUTPUT_VARIABLE HG_REVISION |
6 | 6 |
# OUTPUT_STRIP_TRAILING_WHITESPACE) |
7 | 7 |
|
8 |
SET(PROJECT_NAME " |
|
8 |
SET(PROJECT_NAME "LEMON") |
|
9 | 9 |
SET(PROJECT_VERSION_MAJOR "0") |
10 | 10 |
SET(PROJECT_VERSION_MINOR "99") |
11 | 11 |
SET(PROJECT_VERSION_PATCH "0") |
12 | 12 |
SET(PROJECT_VERSION |
13 | 13 |
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") |
14 | 14 |
|
15 | 15 |
PROJECT(${PROJECT_NAME}) |
16 | 16 |
|
17 | 17 |
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
18 | 18 |
|
19 | 19 |
INCLUDE(FindDoxygen) |
20 | 20 |
INCLUDE(FindGhostscript) |
21 | 21 |
|
22 | 22 |
ENABLE_TESTING() |
23 | 23 |
|
24 | 24 |
ADD_SUBDIRECTORY(lemon) |
25 | 25 |
ADD_SUBDIRECTORY(demo) |
26 | 26 |
ADD_SUBDIRECTORY(doc) |
27 | 27 |
ADD_SUBDIRECTORY(test) |
28 | 28 |
|
29 | 29 |
IF(WIN32) |
30 | 30 |
INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico |
31 | 31 |
DESTINATION bin) |
32 | 32 |
ENDIF(WIN32) |
33 | 33 |
|
34 | 34 |
IF(WIN32) |
35 | 35 |
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
36 | 36 |
SET(CPACK_PACKAGE_VENDOR |
37 | 37 |
"EGRES - Egervary Research Group on Combinatorial Optimization") |
38 | 38 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
39 |
" |
|
39 |
"LEMON - Library of Efficient Models and Optimization in Networks") |
|
40 | 40 |
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") |
41 | 41 |
|
42 | 42 |
SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) |
43 | 43 |
SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) |
44 | 44 |
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) |
45 | 45 |
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
46 | 46 |
|
47 | 47 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
48 | 48 |
"${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") |
49 | 49 |
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
50 | 50 |
"${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") |
51 | 51 |
|
52 | 52 |
# Variables to generate a component-based installer. |
53 | 53 |
#SET(CPACK_COMPONENTS_ALL headers library html_documentation) |
54 | 54 |
|
55 | 55 |
#SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") |
56 | 56 |
#SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Static library") |
57 | 57 |
#SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") |
58 | 58 |
|
59 | 59 |
#SET(CPACK_COMPONENT_HEADERS_DESCRIPTION |
60 |
# "C++ header files for use with the |
|
60 |
# "C++ header files for use with the LEMON library") |
|
61 | 61 |
#SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION |
62 |
# "Static library used to build programs with |
|
62 |
# "Static library used to build programs with LEMON") |
|
63 | 63 |
#SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION |
64 | 64 |
# "Doxygen generated documentation") |
65 | 65 |
|
66 | 66 |
#SET(CPACK_COMPONENT_HEADERS_DEPENDS library) |
67 | 67 |
|
68 | 68 |
#SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
69 | 69 |
#SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") |
70 | 70 |
#SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") |
71 | 71 |
|
72 | 72 |
#SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION |
73 |
# "Components needed to develop software using |
|
73 |
# "Components needed to develop software using LEMON") |
|
74 | 74 |
#SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION |
75 |
# "Documentation of |
|
75 |
# "Documentation of LEMON") |
|
76 | 76 |
|
77 | 77 |
#SET(CPACK_ALL_INSTALL_TYPES Full Developer) |
78 | 78 |
|
79 | 79 |
#SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) |
80 | 80 |
#SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) |
81 | 81 |
#SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) |
82 | 82 |
|
83 | 83 |
SET(CPACK_GENERATOR "NSIS") |
84 | 84 |
SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico") |
85 | 85 |
SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico") |
86 | 86 |
#SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") |
87 | 87 |
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") |
88 | 88 |
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") |
89 | 89 |
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") |
90 | 90 |
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") |
91 | 91 |
SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") |
92 | 92 |
SET(CPACK_NSIS_CREATE_ICONS_EXTRA " |
93 | 93 |
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\doc\\\\index.html\\\" |
94 | 94 |
") |
95 | 95 |
SET(CPACK_NSIS_DELETE_ICONS_EXTRA " |
96 | 96 |
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP |
97 | 97 |
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" |
98 | 98 |
") |
99 | 99 |
1 | 1 |
dnl Process this file with autoconf to produce a configure script. |
2 | 2 |
|
3 | 3 |
dnl Version information. |
4 | 4 |
m4_define([lemon_version_number], []) |
5 | 5 |
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))]) |
6 | 6 |
m4_define([lemon_version], [ifelse(lemon_version_number(), [], [lemon_hg_revision()], [lemon_version_number()])]) |
7 | 7 |
|
8 | 8 |
AC_PREREQ([2.59]) |
9 |
AC_INIT([ |
|
9 |
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon]) |
|
10 | 10 |
AC_CONFIG_AUX_DIR([build-aux]) |
11 | 11 |
AC_CONFIG_MACRO_DIR([m4]) |
12 | 12 |
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc]) |
13 | 13 |
AC_CONFIG_SRCDIR([lemon/list_graph.h]) |
14 | 14 |
AC_CONFIG_HEADERS([config.h lemon/config.h]) |
15 | 15 |
|
16 | 16 |
lx_cmdline_cxxflags_set=${CXXFLAGS+set} |
17 | 17 |
|
18 | 18 |
dnl Checks for programs. |
19 | 19 |
AC_PROG_CXX |
20 | 20 |
AC_PROG_CXXCPP |
21 | 21 |
AC_PROG_INSTALL |
22 | 22 |
AC_DISABLE_SHARED |
23 | 23 |
AC_PROG_LIBTOOL |
24 | 24 |
|
25 | 25 |
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no]) |
26 | 26 |
AC_CHECK_PROG([gs_found],[gs],[yes],[no]) |
27 | 27 |
|
28 | 28 |
dnl Set custom compiler flags when using g++. |
29 | 29 |
if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes; then |
30 | 30 |
CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas" |
31 | 31 |
fi |
32 | 32 |
|
33 | 33 |
dnl Checks for libraries. |
... | ... |
@@ -304,49 +304,49 @@ |
304 | 304 |
|
305 | 305 |
This group describes the algorithms for planarity checking, |
306 | 306 |
embedding and drawing. |
307 | 307 |
|
308 | 308 |
\image html planar.png |
309 | 309 |
\image latex planar.eps "Plane graph" width=\textwidth |
310 | 310 |
*/ |
311 | 311 |
|
312 | 312 |
/** |
313 | 313 |
@defgroup matching Matching algorithms |
314 | 314 |
@ingroup algs |
315 | 315 |
\brief Algorithms for finding matchings in graphs and bipartite graphs. |
316 | 316 |
|
317 | 317 |
This group contains algorithm objects and functions to calculate |
318 | 318 |
matchings in graphs and bipartite graphs. The general matching problem is |
319 | 319 |
finding a subset of the arcs which does not shares common endpoints. |
320 | 320 |
|
321 | 321 |
There are several different algorithms for calculate matchings in |
322 | 322 |
graphs. The matching problems in bipartite graphs are generally |
323 | 323 |
easier than in general graphs. The goal of the matching optimization |
324 | 324 |
can be the finding maximum cardinality, maximum weight or minimum cost |
325 | 325 |
matching. The search can be constrained to find perfect or |
326 | 326 |
maximum cardinality matching. |
327 | 327 |
|
328 |
|
|
328 |
LEMON contains the next algorithms: |
|
329 | 329 |
- \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp |
330 | 330 |
augmenting path algorithm for calculate maximum cardinality matching in |
331 | 331 |
bipartite graphs |
332 | 332 |
- \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel |
333 | 333 |
algorithm for calculate maximum cardinality matching in bipartite graphs |
334 | 334 |
- \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching" |
335 | 335 |
Successive shortest path algorithm for calculate maximum weighted matching |
336 | 336 |
and maximum weighted bipartite matching in bipartite graph |
337 | 337 |
- \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching" |
338 | 338 |
Successive shortest path algorithm for calculate minimum cost maximum |
339 | 339 |
matching in bipartite graph |
340 | 340 |
- \ref lemon::MaxMatching "MaxMatching" Edmond's blossom shrinking algorithm |
341 | 341 |
for calculate maximum cardinality matching in general graph |
342 | 342 |
- \ref lemon::MaxWeightedMatching "MaxWeightedMatching" Edmond's blossom |
343 | 343 |
shrinking algorithm for calculate maximum weighted matching in general |
344 | 344 |
graph |
345 | 345 |
- \ref lemon::MaxWeightedPerfectMatching "MaxWeightedPerfectMatching" |
346 | 346 |
Edmond's blossom shrinking algorithm for calculate maximum weighted |
347 | 347 |
perfect matching in general graph |
348 | 348 |
|
349 | 349 |
\image html bipartite_matching.png |
350 | 350 |
\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth |
351 | 351 |
|
352 | 352 |
*/ |
... | ... |
@@ -455,54 +455,54 @@ |
455 | 455 |
\brief Tools to make it easier to create graphs. |
456 | 456 |
|
457 | 457 |
This group describes the tools that makes it easier to create graphs and |
458 | 458 |
the maps that dynamically update with the graph changes. |
459 | 459 |
*/ |
460 | 460 |
|
461 | 461 |
/** |
462 | 462 |
@defgroup exceptions Exceptions |
463 | 463 |
@ingroup utils |
464 | 464 |
\brief Exceptions defined in LEMON. |
465 | 465 |
|
466 | 466 |
This group describes the exceptions defined in LEMON. |
467 | 467 |
*/ |
468 | 468 |
|
469 | 469 |
/** |
470 | 470 |
@defgroup io_group Input-Output |
471 | 471 |
\brief Graph Input-Output methods |
472 | 472 |
|
473 | 473 |
This group describes the tools for importing and exporting graphs |
474 | 474 |
and graph related data. Now it supports the LEMON format, the |
475 | 475 |
\c DIMACS format and the encapsulated postscript (EPS) format. |
476 | 476 |
*/ |
477 | 477 |
|
478 | 478 |
/** |
479 |
@defgroup lemon_io |
|
479 |
@defgroup lemon_io LEMON Input-Output |
|
480 | 480 |
@ingroup io_group |
481 |
\brief Reading and writing \ref lgf-format " |
|
481 |
\brief Reading and writing \ref lgf-format "LEMON Graph Format". |
|
482 | 482 |
|
483 | 483 |
This group describes methods for reading and writing |
484 |
\ref lgf-format " |
|
484 |
\ref lgf-format "LEMON Graph Format". |
|
485 | 485 |
*/ |
486 | 486 |
|
487 | 487 |
/** |
488 | 488 |
@defgroup eps_io Postscript exporting |
489 | 489 |
@ingroup io_group |
490 | 490 |
\brief General \c EPS drawer and graph exporter |
491 | 491 |
|
492 | 492 |
This group describes general \c EPS drawing methods and special |
493 | 493 |
graph exporting tools. |
494 | 494 |
*/ |
495 | 495 |
|
496 | 496 |
|
497 | 497 |
/** |
498 | 498 |
@defgroup concept Concepts |
499 | 499 |
\brief Skeleton classes and concept checking classes |
500 | 500 |
|
501 | 501 |
This group describes the data/algorithm skeletons and concept checking |
502 | 502 |
classes implemented in LEMON. |
503 | 503 |
|
504 | 504 |
The purpose of the classes in this group is fourfold. |
505 | 505 |
|
506 | 506 |
- These classes contain the documentations of the concepts. In order |
507 | 507 |
to avoid document multiplications, an implementation of a concept |
508 | 508 |
simply refers to the corresponding concept class. |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2008 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
namespace lemon { |
20 | 20 |
/*! |
21 | 21 |
|
22 | 22 |
|
23 | 23 |
|
24 |
\page lgf-format |
|
24 |
\page lgf-format LEMON Graph Format (LGF) |
|
25 | 25 |
|
26 | 26 |
The \e LGF is a <em>column oriented</em> |
27 | 27 |
file format for storing graphs and associated data like |
28 | 28 |
node and edge maps. |
29 | 29 |
|
30 | 30 |
Each line with \c '#' first non-whitespace |
31 | 31 |
character is considered as a comment line. |
32 | 32 |
|
33 | 33 |
Otherwise the file consists of sections starting with |
34 | 34 |
a header line. The header lines starts with an \c '@' character followed by the |
35 | 35 |
type of section. The standard section types are \c \@nodes, \c |
36 | 36 |
\@arcs and \c \@edges |
37 | 37 |
and \@attributes. Each header line may also have an optional |
38 | 38 |
\e name, which can be use to distinguish the sections of the same |
39 | 39 |
type. |
40 | 40 |
|
41 | 41 |
The standard sections are column oriented, each line consists of |
42 | 42 |
<em>token</em>s separated by whitespaces. A token can be \e plain or |
43 | 43 |
\e quoted. A plain token is just a sequence of non-whitespace characters, |
44 | 44 |
while a quoted token is a |
45 | 45 |
character sequence surrounded by double quotes, and it can also |
46 | 46 |
contain whitespaces and escape sequences. |
47 | 47 |
|
48 | 48 |
The \c \@nodes section describes a set of nodes and associated |
... | ... |
@@ -20,49 +20,49 @@ |
20 | 20 |
#define LEMON_BITS_ALTERATION_NOTIFIER_H |
21 | 21 |
|
22 | 22 |
#include <vector> |
23 | 23 |
#include <list> |
24 | 24 |
|
25 | 25 |
#include <lemon/core.h> |
26 | 26 |
|
27 | 27 |
///\ingroup graphbits |
28 | 28 |
///\file |
29 | 29 |
///\brief Observer notifier for graph alteration observers. |
30 | 30 |
|
31 | 31 |
namespace lemon { |
32 | 32 |
|
33 | 33 |
/// \ingroup graphbits |
34 | 34 |
/// |
35 | 35 |
/// \brief Notifier class to notify observes about alterations in |
36 | 36 |
/// a container. |
37 | 37 |
/// |
38 | 38 |
/// The simple graph's can be refered as two containers, one node container |
39 | 39 |
/// and one edge container. But they are not standard containers they |
40 | 40 |
/// does not store values directly they are just key continars for more |
41 | 41 |
/// value containers which are the node and edge maps. |
42 | 42 |
/// |
43 | 43 |
/// The graph's node and edge sets can be changed as we add or erase |
44 |
/// nodes and edges in the graph. |
|
44 |
/// nodes and edges in the graph. LEMON would like to handle easily |
|
45 | 45 |
/// that the node and edge maps should contain values for all nodes or |
46 | 46 |
/// edges. If we want to check on every indicing if the map contains |
47 | 47 |
/// the current indicing key that cause a drawback in the performance |
48 | 48 |
/// in the library. We use another solution we notify all maps about |
49 | 49 |
/// an alteration in the graph, which cause only drawback on the |
50 | 50 |
/// alteration of the graph. |
51 | 51 |
/// |
52 | 52 |
/// This class provides an interface to the container. The \e first() and \e |
53 | 53 |
/// next() member functions make possible to iterate on the keys of the |
54 | 54 |
/// container. The \e id() function returns an integer id for each key. |
55 | 55 |
/// The \e maxId() function gives back an upper bound of the ids. |
56 | 56 |
/// |
57 | 57 |
/// For the proper functonality of this class, we should notify it |
58 | 58 |
/// about each alteration in the container. The alterations have four type |
59 | 59 |
/// as \e add(), \e erase(), \e build() and \e clear(). The \e add() and |
60 | 60 |
/// \e erase() signals that only one or few items added or erased to or |
61 | 61 |
/// from the graph. If all items are erased from the graph or from an empty |
62 | 62 |
/// graph a new graph is builded then it can be signaled with the |
63 | 63 |
/// clear() and build() members. Important rule that if we erase items |
64 | 64 |
/// from graph we should first signal the alteration and after that erase |
65 | 65 |
/// them from the container, on the other way on item addition we should |
66 | 66 |
/// first extend the container and just after that signal the alteration. |
67 | 67 |
/// |
68 | 68 |
/// The alteration can be observed with a class inherited from the |
... | ... |
@@ -56,49 +56,49 @@ |
56 | 56 |
typedef typename Digraph::Arc Arc; |
57 | 57 |
|
58 | 58 |
class ArcIt; |
59 | 59 |
|
60 | 60 |
/// \brief Default constructor |
61 | 61 |
Path() {} |
62 | 62 |
|
63 | 63 |
/// \brief Template constructor |
64 | 64 |
template <typename CPath> |
65 | 65 |
Path(const CPath& cpath) {} |
66 | 66 |
|
67 | 67 |
/// \brief Template assigment |
68 | 68 |
template <typename CPath> |
69 | 69 |
Path& operator=(const CPath& cpath) {} |
70 | 70 |
|
71 | 71 |
/// Length of the path ie. the number of arcs in the path. |
72 | 72 |
int length() const { return 0;} |
73 | 73 |
|
74 | 74 |
/// Returns whether the path is empty. |
75 | 75 |
bool empty() const { return true;} |
76 | 76 |
|
77 | 77 |
/// Resets the path to an empty path. |
78 | 78 |
void clear() {} |
79 | 79 |
|
80 |
/// \brief |
|
80 |
/// \brief LEMON style iterator for path arcs |
|
81 | 81 |
/// |
82 | 82 |
/// This class is used to iterate on the arcs of the paths. |
83 | 83 |
class ArcIt { |
84 | 84 |
public: |
85 | 85 |
/// Default constructor |
86 | 86 |
ArcIt() {} |
87 | 87 |
/// Invalid constructor |
88 | 88 |
ArcIt(Invalid) {} |
89 | 89 |
/// Constructor for first arc |
90 | 90 |
ArcIt(const Path &) {} |
91 | 91 |
|
92 | 92 |
/// Conversion to Arc |
93 | 93 |
operator Arc() const { return INVALID; } |
94 | 94 |
|
95 | 95 |
/// Next arc |
96 | 96 |
ArcIt& operator++() {return *this;} |
97 | 97 |
|
98 | 98 |
/// Comparison operator |
99 | 99 |
bool operator==(const ArcIt&) const {return true;} |
100 | 100 |
/// Comparison operator |
101 | 101 |
bool operator!=(const ArcIt&) const {return true;} |
102 | 102 |
/// Comparison operator |
103 | 103 |
bool operator<(const ArcIt&) const {return false;} |
104 | 104 |
|
... | ... |
@@ -179,108 +179,108 @@ |
179 | 179 |
ignore_unused_variable_warning(l); |
180 | 180 |
ignore_unused_variable_warning(e); |
181 | 181 |
ignore_unused_variable_warning(id); |
182 | 182 |
ignore_unused_variable_warning(ed); |
183 | 183 |
} |
184 | 184 |
_Path& p; |
185 | 185 |
}; |
186 | 186 |
|
187 | 187 |
} |
188 | 188 |
|
189 | 189 |
|
190 | 190 |
/// \brief A skeleton structure for path dumpers. |
191 | 191 |
/// |
192 | 192 |
/// A skeleton structure for path dumpers. The path dumpers are |
193 | 193 |
/// the generalization of the paths. The path dumpers can |
194 | 194 |
/// enumerate the arcs of the path wheter in forward or in |
195 | 195 |
/// backward order. In most time these classes are not used |
196 | 196 |
/// directly rather it used to assign a dumped class to a real |
197 | 197 |
/// path type. |
198 | 198 |
/// |
199 | 199 |
/// The main purpose of this concept is that the shortest path |
200 | 200 |
/// algorithms can enumerate easily the arcs in reverse order. |
201 | 201 |
/// If we would like to give back a real path from these |
202 | 202 |
/// algorithms then we should create a temporarly path object. In |
203 |
/// |
|
203 |
/// LEMON such algorithms gives back a path dumper what can |
|
204 | 204 |
/// assigned to a real path and the dumpers can be implemented as |
205 | 205 |
/// an adaptor class to the predecessor map. |
206 | 206 |
|
207 | 207 |
/// \tparam _Digraph The digraph type in which the path is. |
208 | 208 |
/// |
209 | 209 |
/// The paths can be constructed from any path type by a |
210 | 210 |
/// template constructor or a template assignment operator. |
211 | 211 |
/// |
212 | 212 |
template <typename _Digraph> |
213 | 213 |
class PathDumper { |
214 | 214 |
public: |
215 | 215 |
|
216 | 216 |
/// Type of the underlying digraph. |
217 | 217 |
typedef _Digraph Digraph; |
218 | 218 |
/// Arc type of the underlying digraph. |
219 | 219 |
typedef typename Digraph::Arc Arc; |
220 | 220 |
|
221 | 221 |
/// Length of the path ie. the number of arcs in the path. |
222 | 222 |
int length() const { return 0;} |
223 | 223 |
|
224 | 224 |
/// Returns whether the path is empty. |
225 | 225 |
bool empty() const { return true;} |
226 | 226 |
|
227 | 227 |
/// \brief Forward or reverse dumping |
228 | 228 |
/// |
229 | 229 |
/// If the RevPathTag is defined and true then reverse dumping |
230 | 230 |
/// is provided in the path dumper. In this case instead of the |
231 | 231 |
/// ArcIt the RevArcIt iterator should be implemented in the |
232 | 232 |
/// dumper. |
233 | 233 |
typedef False RevPathTag; |
234 | 234 |
|
235 |
/// \brief |
|
235 |
/// \brief LEMON style iterator for path arcs |
|
236 | 236 |
/// |
237 | 237 |
/// This class is used to iterate on the arcs of the paths. |
238 | 238 |
class ArcIt { |
239 | 239 |
public: |
240 | 240 |
/// Default constructor |
241 | 241 |
ArcIt() {} |
242 | 242 |
/// Invalid constructor |
243 | 243 |
ArcIt(Invalid) {} |
244 | 244 |
/// Constructor for first arc |
245 | 245 |
ArcIt(const PathDumper&) {} |
246 | 246 |
|
247 | 247 |
/// Conversion to Arc |
248 | 248 |
operator Arc() const { return INVALID; } |
249 | 249 |
|
250 | 250 |
/// Next arc |
251 | 251 |
ArcIt& operator++() {return *this;} |
252 | 252 |
|
253 | 253 |
/// Comparison operator |
254 | 254 |
bool operator==(const ArcIt&) const {return true;} |
255 | 255 |
/// Comparison operator |
256 | 256 |
bool operator!=(const ArcIt&) const {return true;} |
257 | 257 |
/// Comparison operator |
258 | 258 |
bool operator<(const ArcIt&) const {return false;} |
259 | 259 |
|
260 | 260 |
}; |
261 | 261 |
|
262 |
/// \brief |
|
262 |
/// \brief LEMON style iterator for path arcs |
|
263 | 263 |
/// |
264 | 264 |
/// This class is used to iterate on the arcs of the paths in |
265 | 265 |
/// reverse direction. |
266 | 266 |
class RevArcIt { |
267 | 267 |
public: |
268 | 268 |
/// Default constructor |
269 | 269 |
RevArcIt() {} |
270 | 270 |
/// Invalid constructor |
271 | 271 |
RevArcIt(Invalid) {} |
272 | 272 |
/// Constructor for first arc |
273 | 273 |
RevArcIt(const PathDumper &) {} |
274 | 274 |
|
275 | 275 |
/// Conversion to Arc |
276 | 276 |
operator Arc() const { return INVALID; } |
277 | 277 |
|
278 | 278 |
/// Next arc |
279 | 279 |
RevArcIt& operator++() {return *this;} |
280 | 280 |
|
281 | 281 |
/// Comparison operator |
282 | 282 |
bool operator==(const RevArcIt&) const {return true;} |
283 | 283 |
/// Comparison operator |
284 | 284 |
bool operator!=(const RevArcIt&) const {return true;} |
285 | 285 |
/// Comparison operator |
286 | 286 |
bool operator<(const RevArcIt&) const {return false;} |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2008 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
///\ingroup lemon_io |
20 | 20 |
///\file |
21 |
///\brief \ref lgf-format " |
|
21 |
///\brief \ref lgf-format "LEMON Graph Format" reader. |
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
#ifndef LEMON_LGF_READER_H |
25 | 25 |
#define LEMON_LGF_READER_H |
26 | 26 |
|
27 | 27 |
#include <iostream> |
28 | 28 |
#include <fstream> |
29 | 29 |
#include <sstream> |
30 | 30 |
|
31 | 31 |
#include <set> |
32 | 32 |
#include <map> |
33 | 33 |
|
34 | 34 |
#include <lemon/assert.h> |
35 | 35 |
#include <lemon/core.h> |
36 | 36 |
|
37 | 37 |
#include <lemon/lgf_writer.h> |
38 | 38 |
|
39 | 39 |
#include <lemon/concept_check.h> |
40 | 40 |
#include <lemon/concepts/maps.h> |
41 | 41 |
|
42 | 42 |
namespace lemon { |
43 | 43 |
|
44 | 44 |
namespace _reader_bits { |
45 | 45 |
|
... | ... |
@@ -2280,49 +2280,49 @@ |
2280 | 2280 |
|
2281 | 2281 |
/// \brief Return a \ref SectionReader class |
2282 | 2282 |
/// |
2283 | 2283 |
/// This function just returns a \ref SectionReader class. |
2284 | 2284 |
/// \relates SectionReader |
2285 | 2285 |
inline SectionReader sectionReader(const std::string& fn) { |
2286 | 2286 |
SectionReader tmp(fn); |
2287 | 2287 |
return tmp; |
2288 | 2288 |
} |
2289 | 2289 |
|
2290 | 2290 |
/// \brief Return a \ref SectionReader class |
2291 | 2291 |
/// |
2292 | 2292 |
/// This function just returns a \ref SectionReader class. |
2293 | 2293 |
/// \relates SectionReader |
2294 | 2294 |
inline SectionReader sectionReader(const char* fn) { |
2295 | 2295 |
SectionReader tmp(fn); |
2296 | 2296 |
return tmp; |
2297 | 2297 |
} |
2298 | 2298 |
|
2299 | 2299 |
/// \ingroup lemon_io |
2300 | 2300 |
/// |
2301 | 2301 |
/// \brief Reader for the contents of the \ref lgf-format "LGF" file |
2302 | 2302 |
/// |
2303 | 2303 |
/// This class can be used to read the sections, the map names and |
2304 |
/// the attributes from a file. Usually, the |
|
2304 |
/// the attributes from a file. Usually, the LEMON programs know |
|
2305 | 2305 |
/// that, which type of graph, which maps and which attributes |
2306 | 2306 |
/// should be read from a file, but in general tools (like glemon) |
2307 | 2307 |
/// the contents of an LGF file should be guessed somehow. This class |
2308 | 2308 |
/// reads the graph and stores the appropriate information for |
2309 | 2309 |
/// reading the graph. |
2310 | 2310 |
/// |
2311 | 2311 |
///\code |
2312 | 2312 |
/// LgfContents contents("graph.lgf"); |
2313 | 2313 |
/// contents.run(); |
2314 | 2314 |
/// |
2315 | 2315 |
/// // Does it contain any node section and arc section? |
2316 | 2316 |
/// if (contents.nodeSectionNum() == 0 || contents.arcSectionNum()) { |
2317 | 2317 |
/// std::cerr << "Failure, cannot find graph." << std::endl; |
2318 | 2318 |
/// return -1; |
2319 | 2319 |
/// } |
2320 | 2320 |
/// std::cout << "The name of the default node section: " |
2321 | 2321 |
/// << contents.nodeSection(0) << std::endl; |
2322 | 2322 |
/// std::cout << "The number of the arc maps: " |
2323 | 2323 |
/// << contents.arcMaps(0).size() << std::endl; |
2324 | 2324 |
/// std::cout << "The name of second arc map: " |
2325 | 2325 |
/// << contents.arcMaps(0)[1] << std::endl; |
2326 | 2326 |
///\endcode |
2327 | 2327 |
class LgfContents { |
2328 | 2328 |
private: |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2008 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
///\ingroup lemon_io |
20 | 20 |
///\file |
21 |
///\brief \ref lgf-format " |
|
21 |
///\brief \ref lgf-format "LEMON Graph Format" writer. |
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
#ifndef LEMON_LGF_WRITER_H |
25 | 25 |
#define LEMON_LGF_WRITER_H |
26 | 26 |
|
27 | 27 |
#include <iostream> |
28 | 28 |
#include <fstream> |
29 | 29 |
#include <sstream> |
30 | 30 |
|
31 | 31 |
#include <algorithm> |
32 | 32 |
|
33 | 33 |
#include <vector> |
34 | 34 |
#include <functional> |
35 | 35 |
|
36 | 36 |
#include <lemon/assert.h> |
37 | 37 |
#include <lemon/core.h> |
38 | 38 |
#include <lemon/maps.h> |
39 | 39 |
|
40 | 40 |
namespace lemon { |
41 | 41 |
|
42 | 42 |
namespace _writer_bits { |
43 | 43 |
|
44 | 44 |
template <typename Value> |
45 | 45 |
struct DefaultConverter { |
... | ... |
@@ -61,49 +61,49 @@ |
61 | 61 |
|
62 | 62 |
/// \brief Default constructor |
63 | 63 |
/// |
64 | 64 |
/// Default constructor |
65 | 65 |
Path() {} |
66 | 66 |
|
67 | 67 |
/// \brief Template copy constructor |
68 | 68 |
/// |
69 | 69 |
/// This constuctor initializes the path from any other path type. |
70 | 70 |
/// It simply makes a copy of the given path. |
71 | 71 |
template <typename CPath> |
72 | 72 |
Path(const CPath& cpath) { |
73 | 73 |
copyPath(*this, cpath); |
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
/// \brief Template copy assignment |
77 | 77 |
/// |
78 | 78 |
/// This operator makes a copy of a path of any other type. |
79 | 79 |
template <typename CPath> |
80 | 80 |
Path& operator=(const CPath& cpath) { |
81 | 81 |
copyPath(*this, cpath); |
82 | 82 |
return *this; |
83 | 83 |
} |
84 | 84 |
|
85 |
/// \brief |
|
85 |
/// \brief LEMON style iterator for path arcs |
|
86 | 86 |
/// |
87 | 87 |
/// This class is used to iterate on the arcs of the paths. |
88 | 88 |
class ArcIt { |
89 | 89 |
friend class Path; |
90 | 90 |
public: |
91 | 91 |
/// \brief Default constructor |
92 | 92 |
ArcIt() {} |
93 | 93 |
/// \brief Invalid constructor |
94 | 94 |
ArcIt(Invalid) : path(0), idx(-1) {} |
95 | 95 |
/// \brief Initializate the iterator to the first arc of path |
96 | 96 |
ArcIt(const Path &_path) |
97 | 97 |
: path(&_path), idx(_path.empty() ? -1 : 0) {} |
98 | 98 |
|
99 | 99 |
private: |
100 | 100 |
|
101 | 101 |
ArcIt(const Path &_path, int _idx) |
102 | 102 |
: path(&_path), idx(_idx) {} |
103 | 103 |
|
104 | 104 |
public: |
105 | 105 |
|
106 | 106 |
/// \brief Conversion to Arc |
107 | 107 |
operator const Arc&() const { |
108 | 108 |
return path->nth(idx); |
109 | 109 |
} |
... | ... |
@@ -476,49 +476,49 @@ |
476 | 476 |
} |
477 | 477 |
|
478 | 478 |
} |
479 | 479 |
|
480 | 480 |
/// \brief Gives back a representant item of the component. |
481 | 481 |
/// |
482 | 482 |
/// Gives back a representant item of the component. |
483 | 483 |
Item item(int cls) const { |
484 | 484 |
return items[classes[cls].firstItem].item; |
485 | 485 |
} |
486 | 486 |
|
487 | 487 |
/// \brief Removes the component of the given element from the structure. |
488 | 488 |
/// |
489 | 489 |
/// Removes the component of the given element from the structure. |
490 | 490 |
/// |
491 | 491 |
/// \warning It is an error to give an element which is not in the |
492 | 492 |
/// structure. |
493 | 493 |
void eraseClass(int cls) { |
494 | 494 |
int fdx = classes[cls].firstItem; |
495 | 495 |
unlaceClass(cls); |
496 | 496 |
items[items[fdx].prev].next = firstFreeItem; |
497 | 497 |
firstFreeItem = fdx; |
498 | 498 |
} |
499 | 499 |
|
500 |
/// \brief |
|
500 |
/// \brief LEMON style iterator for the representant items. |
|
501 | 501 |
/// |
502 | 502 |
/// ClassIt is a lemon style iterator for the components. It iterates |
503 | 503 |
/// on the ids of the classes. |
504 | 504 |
class ClassIt { |
505 | 505 |
public: |
506 | 506 |
/// \brief Constructor of the iterator |
507 | 507 |
/// |
508 | 508 |
/// Constructor of the iterator |
509 | 509 |
ClassIt(const UnionFindEnum& ufe) : unionFind(&ufe) { |
510 | 510 |
cdx = unionFind->firstClass; |
511 | 511 |
} |
512 | 512 |
|
513 | 513 |
/// \brief Constructor to get invalid iterator |
514 | 514 |
/// |
515 | 515 |
/// Constructor to get invalid iterator |
516 | 516 |
ClassIt(Invalid) : unionFind(0), cdx(-1) {} |
517 | 517 |
|
518 | 518 |
/// \brief Increment operator |
519 | 519 |
/// |
520 | 520 |
/// It steps to the next representant item. |
521 | 521 |
ClassIt& operator++() { |
522 | 522 |
cdx = unionFind->classes[cdx].next; |
523 | 523 |
return *this; |
524 | 524 |
} |
... | ... |
@@ -528,49 +528,49 @@ |
528 | 528 |
/// It converts the iterator to the current representant item. |
529 | 529 |
operator int() const { |
530 | 530 |
return cdx; |
531 | 531 |
} |
532 | 532 |
|
533 | 533 |
/// \brief Equality operator |
534 | 534 |
/// |
535 | 535 |
/// Equality operator |
536 | 536 |
bool operator==(const ClassIt& i) { |
537 | 537 |
return i.cdx == cdx; |
538 | 538 |
} |
539 | 539 |
|
540 | 540 |
/// \brief Inequality operator |
541 | 541 |
/// |
542 | 542 |
/// Inequality operator |
543 | 543 |
bool operator!=(const ClassIt& i) { |
544 | 544 |
return i.cdx != cdx; |
545 | 545 |
} |
546 | 546 |
|
547 | 547 |
private: |
548 | 548 |
const UnionFindEnum* unionFind; |
549 | 549 |
int cdx; |
550 | 550 |
}; |
551 | 551 |
|
552 |
/// \brief |
|
552 |
/// \brief LEMON style iterator for the items of a component. |
|
553 | 553 |
/// |
554 | 554 |
/// ClassIt is a lemon style iterator for the components. It iterates |
555 | 555 |
/// on the items of a class. By example if you want to iterate on |
556 | 556 |
/// each items of each classes then you may write the next code. |
557 | 557 |
///\code |
558 | 558 |
/// for (ClassIt cit(ufe); cit != INVALID; ++cit) { |
559 | 559 |
/// std::cout << "Class: "; |
560 | 560 |
/// for (ItemIt iit(ufe, cit); iit != INVALID; ++iit) { |
561 | 561 |
/// std::cout << toString(iit) << ' ' << std::endl; |
562 | 562 |
/// } |
563 | 563 |
/// std::cout << std::endl; |
564 | 564 |
/// } |
565 | 565 |
///\endcode |
566 | 566 |
class ItemIt { |
567 | 567 |
public: |
568 | 568 |
/// \brief Constructor of the iterator |
569 | 569 |
/// |
570 | 570 |
/// Constructor of the iterator. The iterator iterates |
571 | 571 |
/// on the class of the \c item. |
572 | 572 |
ItemIt(const UnionFindEnum& ufe, int cls) : unionFind(&ufe) { |
573 | 573 |
fdx = idx = unionFind->classes[cls].firstItem; |
574 | 574 |
} |
575 | 575 |
|
576 | 576 |
/// \brief Constructor to get invalid iterator |
... | ... |
@@ -786,49 +786,49 @@ |
786 | 786 |
|
787 | 787 |
/// \brief Removes the component of the given element from the structure. |
788 | 788 |
/// |
789 | 789 |
/// Removes the component of the given element from the structure. |
790 | 790 |
/// |
791 | 791 |
/// \warning It is an error to give an element which is not in the |
792 | 792 |
/// structure. |
793 | 793 |
void eraseClass(int cdx) { |
794 | 794 |
int idx = classes[cdx].firstItem; |
795 | 795 |
items[items[idx].prev].next = firstFreeItem; |
796 | 796 |
firstFreeItem = idx; |
797 | 797 |
|
798 | 798 |
if (classes[cdx].prev != -1) { |
799 | 799 |
classes[classes[cdx].prev].next = classes[cdx].next; |
800 | 800 |
} else { |
801 | 801 |
firstClass = classes[cdx].next; |
802 | 802 |
} |
803 | 803 |
if (classes[cdx].next != -1) { |
804 | 804 |
classes[classes[cdx].next].prev = classes[cdx].prev; |
805 | 805 |
} |
806 | 806 |
classes[cdx].next = firstFreeClass; |
807 | 807 |
firstFreeClass = cdx; |
808 | 808 |
} |
809 | 809 |
|
810 |
/// \brief |
|
810 |
/// \brief LEMON style iterator for the classes. |
|
811 | 811 |
/// |
812 | 812 |
/// ClassIt is a lemon style iterator for the components. It iterates |
813 | 813 |
/// on the ids of classes. |
814 | 814 |
class ClassIt { |
815 | 815 |
public: |
816 | 816 |
/// \brief Constructor of the iterator |
817 | 817 |
/// |
818 | 818 |
/// Constructor of the iterator |
819 | 819 |
ClassIt(const ExtendFindEnum& ufe) : extendFind(&ufe) { |
820 | 820 |
cdx = extendFind->firstClass; |
821 | 821 |
} |
822 | 822 |
|
823 | 823 |
/// \brief Constructor to get invalid iterator |
824 | 824 |
/// |
825 | 825 |
/// Constructor to get invalid iterator |
826 | 826 |
ClassIt(Invalid) : extendFind(0), cdx(-1) {} |
827 | 827 |
|
828 | 828 |
/// \brief Increment operator |
829 | 829 |
/// |
830 | 830 |
/// It steps to the next representant item. |
831 | 831 |
ClassIt& operator++() { |
832 | 832 |
cdx = extendFind->classes[cdx].next; |
833 | 833 |
return *this; |
834 | 834 |
} |
... | ... |
@@ -838,49 +838,49 @@ |
838 | 838 |
/// It converts the iterator to the current class id. |
839 | 839 |
operator int() const { |
840 | 840 |
return cdx; |
841 | 841 |
} |
842 | 842 |
|
843 | 843 |
/// \brief Equality operator |
844 | 844 |
/// |
845 | 845 |
/// Equality operator |
846 | 846 |
bool operator==(const ClassIt& i) { |
847 | 847 |
return i.cdx == cdx; |
848 | 848 |
} |
849 | 849 |
|
850 | 850 |
/// \brief Inequality operator |
851 | 851 |
/// |
852 | 852 |
/// Inequality operator |
853 | 853 |
bool operator!=(const ClassIt& i) { |
854 | 854 |
return i.cdx != cdx; |
855 | 855 |
} |
856 | 856 |
|
857 | 857 |
private: |
858 | 858 |
const ExtendFindEnum* extendFind; |
859 | 859 |
int cdx; |
860 | 860 |
}; |
861 | 861 |
|
862 |
/// \brief |
|
862 |
/// \brief LEMON style iterator for the items of a component. |
|
863 | 863 |
/// |
864 | 864 |
/// ClassIt is a lemon style iterator for the components. It iterates |
865 | 865 |
/// on the items of a class. By example if you want to iterate on |
866 | 866 |
/// each items of each classes then you may write the next code. |
867 | 867 |
///\code |
868 | 868 |
/// for (ClassIt cit(ufe); cit != INVALID; ++cit) { |
869 | 869 |
/// std::cout << "Class: "; |
870 | 870 |
/// for (ItemIt iit(ufe, cit); iit != INVALID; ++iit) { |
871 | 871 |
/// std::cout << toString(iit) << ' ' << std::endl; |
872 | 872 |
/// } |
873 | 873 |
/// std::cout << std::endl; |
874 | 874 |
/// } |
875 | 875 |
///\endcode |
876 | 876 |
class ItemIt { |
877 | 877 |
public: |
878 | 878 |
/// \brief Constructor of the iterator |
879 | 879 |
/// |
880 | 880 |
/// Constructor of the iterator. The iterator iterates |
881 | 881 |
/// on the class of the \c item. |
882 | 882 |
ItemIt(const ExtendFindEnum& ufe, int cls) : extendFind(&ufe) { |
883 | 883 |
fdx = idx = extendFind->classes[cls].firstItem; |
884 | 884 |
} |
885 | 885 |
|
886 | 886 |
/// \brief Constructor to get invalid iterator |
... | ... |
@@ -1634,49 +1634,49 @@ |
1634 | 1634 |
/// \brief Gives back the minimum priority of the class. |
1635 | 1635 |
/// |
1636 | 1636 |
/// \return Gives back the minimum priority of the class. |
1637 | 1637 |
const Value& classPrio(int cls) const { |
1638 | 1638 |
return nodes[~(classes[cls].parent)].prio; |
1639 | 1639 |
} |
1640 | 1640 |
|
1641 | 1641 |
/// \brief Gives back the minimum priority item of the class. |
1642 | 1642 |
/// |
1643 | 1643 |
/// \return Gives back the minimum priority item of the class. |
1644 | 1644 |
const Item& classTop(int cls) const { |
1645 | 1645 |
return nodes[~(classes[cls].parent)].item; |
1646 | 1646 |
} |
1647 | 1647 |
|
1648 | 1648 |
/// \brief Gives back a representant item of the class. |
1649 | 1649 |
/// |
1650 | 1650 |
/// The representant is indpendent from the priorities of the |
1651 | 1651 |
/// items. |
1652 | 1652 |
/// \return Gives back a representant item of the class. |
1653 | 1653 |
const Item& classRep(int id) const { |
1654 | 1654 |
int parent = classes[id].parent; |
1655 | 1655 |
return nodes[parent >= 0 ? classes[id].depth : leftNode(id)].item; |
1656 | 1656 |
} |
1657 | 1657 |
|
1658 |
/// \brief |
|
1658 |
/// \brief LEMON style iterator for the items of a class. |
|
1659 | 1659 |
/// |
1660 | 1660 |
/// ClassIt is a lemon style iterator for the components. It iterates |
1661 | 1661 |
/// on the items of a class. By example if you want to iterate on |
1662 | 1662 |
/// each items of each classes then you may write the next code. |
1663 | 1663 |
///\code |
1664 | 1664 |
/// for (ClassIt cit(huf); cit != INVALID; ++cit) { |
1665 | 1665 |
/// std::cout << "Class: "; |
1666 | 1666 |
/// for (ItemIt iit(huf, cit); iit != INVALID; ++iit) { |
1667 | 1667 |
/// std::cout << toString(iit) << ' ' << std::endl; |
1668 | 1668 |
/// } |
1669 | 1669 |
/// std::cout << std::endl; |
1670 | 1670 |
/// } |
1671 | 1671 |
///\endcode |
1672 | 1672 |
class ItemIt { |
1673 | 1673 |
private: |
1674 | 1674 |
|
1675 | 1675 |
const HeapUnionFind* _huf; |
1676 | 1676 |
int _id, _lid; |
1677 | 1677 |
|
1678 | 1678 |
public: |
1679 | 1679 |
|
1680 | 1680 |
/// \brief Default constructor |
1681 | 1681 |
/// |
1682 | 1682 |
/// Default constructor |
0 comments (0 inline)