0
4
0
... | ... |
@@ -3,48 +3,49 @@ |
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 |
#ifndef LEMON_CORE_H |
20 | 20 |
#define LEMON_CORE_H |
21 | 21 |
|
22 | 22 |
#include <vector> |
23 | 23 |
#include <algorithm> |
24 | 24 |
|
25 | 25 |
#include <lemon/bits/enable_if.h> |
26 | 26 |
#include <lemon/bits/traits.h> |
27 |
#include <lemon/assert.h> |
|
27 | 28 |
|
28 | 29 |
///\file |
29 | 30 |
///\brief LEMON core utilities. |
30 | 31 |
/// |
31 | 32 |
///This header file contains core utilities for LEMON. |
32 | 33 |
///It is automatically included by all graph types, therefore it usually |
33 | 34 |
///do not have to be included directly. |
34 | 35 |
|
35 | 36 |
namespace lemon { |
36 | 37 |
|
37 | 38 |
/// \brief Dummy type to make it easier to create invalid iterators. |
38 | 39 |
/// |
39 | 40 |
/// Dummy type to make it easier to create invalid iterators. |
40 | 41 |
/// See \ref INVALID for the usage. |
41 | 42 |
struct Invalid { |
42 | 43 |
public: |
43 | 44 |
bool operator==(Invalid) { return true; } |
44 | 45 |
bool operator!=(Invalid) { return false; } |
45 | 46 |
bool operator< (Invalid) { return false; } |
46 | 47 |
}; |
47 | 48 |
|
48 | 49 |
/// \brief Invalid iterators. |
49 | 50 |
/// |
50 | 51 |
/// \ref Invalid is a global type that converts to each iterator |
... | ... |
@@ -6,49 +6,48 @@ |
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 |
#ifndef LEMON_DFS_H |
20 | 20 |
#define LEMON_DFS_H |
21 | 21 |
|
22 | 22 |
///\ingroup search |
23 | 23 |
///\file |
24 | 24 |
///\brief DFS algorithm. |
25 | 25 |
|
26 | 26 |
#include <lemon/list_graph.h> |
27 | 27 |
#include <lemon/bits/path_dump.h> |
28 | 28 |
#include <lemon/core.h> |
29 | 29 |
#include <lemon/error.h> |
30 |
#include <lemon/assert.h> |
|
31 | 30 |
#include <lemon/maps.h> |
32 | 31 |
#include <lemon/path.h> |
33 | 32 |
|
34 | 33 |
namespace lemon { |
35 | 34 |
|
36 | 35 |
///Default traits class of Dfs class. |
37 | 36 |
|
38 | 37 |
///Default traits class of Dfs class. |
39 | 38 |
///\tparam GR Digraph type. |
40 | 39 |
template<class GR> |
41 | 40 |
struct DfsDefaultTraits |
42 | 41 |
{ |
43 | 42 |
///The type of the digraph the algorithm runs on. |
44 | 43 |
typedef GR Digraph; |
45 | 44 |
|
46 | 45 |
///\brief The type of the map that stores the predecessor |
47 | 46 |
///arcs of the %DFS paths. |
48 | 47 |
/// |
49 | 48 |
///The type of the map that stores the predecessor |
50 | 49 |
///arcs of the %DFS paths. |
51 | 50 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
52 | 51 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
53 | 52 |
///Instantiates a PredMap. |
54 | 53 |
... | ... |
@@ -10,49 +10,48 @@ |
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 | 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 |
#include <lemon/assert.h> |
|
35 | 34 |
#include <lemon/core.h> |
36 | 35 |
|
37 | 36 |
#include <lemon/lgf_writer.h> |
38 | 37 |
|
39 | 38 |
#include <lemon/concept_check.h> |
40 | 39 |
#include <lemon/concepts/maps.h> |
41 | 40 |
|
42 | 41 |
namespace lemon { |
43 | 42 |
|
44 | 43 |
namespace _reader_bits { |
45 | 44 |
|
46 | 45 |
template <typename Value> |
47 | 46 |
struct DefaultConverter { |
48 | 47 |
Value operator()(const std::string& str) { |
49 | 48 |
std::istringstream is(str); |
50 | 49 |
Value value; |
51 | 50 |
if (!(is >> value)) { |
52 | 51 |
throw FormatError("Cannot read token"); |
53 | 52 |
} |
54 | 53 |
|
55 | 54 |
char c; |
56 | 55 |
if (is >> std::ws >> c) { |
57 | 56 |
throw FormatError("Remaining characters in token"); |
58 | 57 |
} |
... | ... |
@@ -12,49 +12,48 @@ |
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 | 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 |
#include <lemon/assert.h> |
|
37 | 36 |
#include <lemon/core.h> |
38 | 37 |
#include <lemon/maps.h> |
39 | 38 |
|
40 | 39 |
#include <lemon/concept_check.h> |
41 | 40 |
#include <lemon/concepts/maps.h> |
42 | 41 |
|
43 | 42 |
namespace lemon { |
44 | 43 |
|
45 | 44 |
namespace _writer_bits { |
46 | 45 |
|
47 | 46 |
template <typename Value> |
48 | 47 |
struct DefaultConverter { |
49 | 48 |
std::string operator()(const Value& value) { |
50 | 49 |
std::ostringstream os; |
51 | 50 |
os << value; |
52 | 51 |
return os.str(); |
53 | 52 |
} |
54 | 53 |
}; |
55 | 54 |
|
56 | 55 |
template <typename T> |
57 | 56 |
bool operator<(const T&, const T&) { |
58 | 57 |
throw FormatError("Label map is not comparable"); |
59 | 58 |
} |
60 | 59 |
|
0 comments (0 inline)