Update INSTALL to use CMAKE. Also update AUTHORS and LICENSE
1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2009
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 ///\brief The concept of paths
24 #ifndef LEMON_CONCEPTS_PATH_H
25 #define LEMON_CONCEPTS_PATH_H
27 #include <lemon/core.h>
28 #include <lemon/concept_check.h>
33 /// \addtogroup concept
36 /// \brief A skeleton structure for representing directed paths in
39 /// A skeleton structure for representing directed paths in a
41 /// In a sense, a path can be treated as a list of arcs.
42 /// LEMON path types just store this list. As a consequence, they cannot
43 /// enumerate the nodes on the path directly and a zero length path
44 /// cannot store its source node.
46 /// The arcs of a path should be stored in the order of their directions,
47 /// i.e. the target node of each arc should be the same as the source
48 /// node of the next arc. This consistency could be checked using
50 /// The source and target nodes of a (consistent) path can be obtained
51 /// using \ref pathSource() and \ref pathTarget().
53 /// A path can be constructed from another path of any type using the
54 /// copy constructor or the assignment operator.
56 /// \tparam GR The digraph type in which the path is.
57 template <typename GR>
61 /// Type of the underlying digraph.
63 /// Arc type of the underlying digraph.
64 typedef typename Digraph::Arc Arc;
68 /// \brief Default constructor
71 /// \brief Template copy constructor
72 template <typename CPath>
73 Path(const CPath& cpath) {}
75 /// \brief Template assigment operator
76 template <typename CPath>
77 Path& operator=(const CPath& cpath) {
78 ignore_unused_variable_warning(cpath);
82 /// Length of the path, i.e. the number of arcs on the path.
83 int length() const { return 0;}
85 /// Returns whether the path is empty.
86 bool empty() const { return true;}
88 /// Resets the path to an empty path.
91 /// \brief LEMON style iterator for enumerating the arcs of a path.
93 /// LEMON style iterator class for enumerating the arcs of a path.
96 /// Default constructor
98 /// Invalid constructor
100 /// Sets the iterator to the first arc of the given path
101 ArcIt(const Path &) {}
103 /// Conversion to \c Arc
104 operator Arc() const { return INVALID; }
107 ArcIt& operator++() {return *this;}
109 /// Comparison operator
110 bool operator==(const ArcIt&) const {return true;}
111 /// Comparison operator
112 bool operator!=(const ArcIt&) const {return true;}
113 /// Comparison operator
114 bool operator<(const ArcIt&) const {return false;}
118 template <typename _Path>
129 typename _Path::ArcIt id, ii(INVALID), i(p);
132 typename Digraph::Arc ed = i;
138 ignore_unused_variable_warning(l);
139 ignore_unused_variable_warning(pp);
140 ignore_unused_variable_warning(e);
141 ignore_unused_variable_warning(id);
142 ignore_unused_variable_warning(ii);
143 ignore_unused_variable_warning(ed);
149 namespace _path_bits {
151 template <typename _Digraph, typename _Path, typename RevPathTag = void>
152 struct PathDumperConstraints {
157 typename _Path::ArcIt id, i(p);
160 typename _Digraph::Arc ed = i;
165 ignore_unused_variable_warning(l);
166 ignore_unused_variable_warning(e);
167 ignore_unused_variable_warning(id);
168 ignore_unused_variable_warning(ed);
171 PathDumperConstraints() {}
174 template <typename _Digraph, typename _Path>
175 struct PathDumperConstraints<
177 typename enable_if<typename _Path::RevPathTag, void>::type
183 typename _Path::RevArcIt id, i(p);
186 typename _Digraph::Arc ed = i;
191 ignore_unused_variable_warning(l);
192 ignore_unused_variable_warning(e);
193 ignore_unused_variable_warning(id);
194 ignore_unused_variable_warning(ed);
197 PathDumperConstraints() {}
203 /// \brief A skeleton structure for path dumpers.
205 /// A skeleton structure for path dumpers. The path dumpers are
206 /// the generalization of the paths, they can enumerate the arcs
207 /// of the path either in forward or in backward order.
208 /// These classes are typically not used directly, they are rather
209 /// used to be assigned to a real path type.
211 /// The main purpose of this concept is that the shortest path
212 /// algorithms can enumerate the arcs easily in reverse order.
213 /// In LEMON, such algorithms give back a (reverse) path dumper that
214 /// can be assigned to a real path. The dumpers can be implemented as
215 /// an adaptor class to the predecessor map.
217 /// \tparam GR The digraph type in which the path is.
218 template <typename GR>
222 /// Type of the underlying digraph.
224 /// Arc type of the underlying digraph.
225 typedef typename Digraph::Arc Arc;
227 /// Length of the path, i.e. the number of arcs on the path.
228 int length() const { return 0;}
230 /// Returns whether the path is empty.
231 bool empty() const { return true;}
233 /// \brief Forward or reverse dumping
235 /// If this tag is defined to be \c True, then reverse dumping
236 /// is provided in the path dumper. In this case, \c RevArcIt
237 /// iterator should be implemented instead of \c ArcIt iterator.
238 typedef False RevPathTag;
240 /// \brief LEMON style iterator for enumerating the arcs of a path.
242 /// LEMON style iterator class for enumerating the arcs of a path.
245 /// Default constructor
247 /// Invalid constructor
249 /// Sets the iterator to the first arc of the given path
250 ArcIt(const PathDumper&) {}
252 /// Conversion to \c Arc
253 operator Arc() const { return INVALID; }
256 ArcIt& operator++() {return *this;}
258 /// Comparison operator
259 bool operator==(const ArcIt&) const {return true;}
260 /// Comparison operator
261 bool operator!=(const ArcIt&) const {return true;}
262 /// Comparison operator
263 bool operator<(const ArcIt&) const {return false;}
267 /// \brief LEMON style iterator for enumerating the arcs of a path
268 /// in reverse direction.
270 /// LEMON style iterator class for enumerating the arcs of a path
271 /// in reverse direction.
274 /// Default constructor
276 /// Invalid constructor
278 /// Sets the iterator to the last arc of the given path
279 RevArcIt(const PathDumper &) {}
281 /// Conversion to \c Arc
282 operator Arc() const { return INVALID; }
285 RevArcIt& operator++() {return *this;}
287 /// Comparison operator
288 bool operator==(const RevArcIt&) const {return true;}
289 /// Comparison operator
290 bool operator!=(const RevArcIt&) const {return true;}
291 /// Comparison operator
292 bool operator<(const RevArcIt&) const {return false;}
296 template <typename _Path>
299 function_requires<_path_bits::
300 PathDumperConstraints<Digraph, _Path> >();