lemongraph 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/LICENSE +674 -0
  4. data/README.md +6 -0
  5. data/ext/lemon-1.3.1/AUTHORS +26 -0
  6. data/ext/lemon-1.3.1/CMakeLists.txt +371 -0
  7. data/ext/lemon-1.3.1/INSTALL +167 -0
  8. data/ext/lemon-1.3.1/LICENSE +32 -0
  9. data/ext/lemon-1.3.1/NEWS +337 -0
  10. data/ext/lemon-1.3.1/README +50 -0
  11. data/ext/lemon-1.3.1/cmake/FindCOIN.cmake +110 -0
  12. data/ext/lemon-1.3.1/cmake/FindGLPK.cmake +55 -0
  13. data/ext/lemon-1.3.1/cmake/FindGhostscript.cmake +10 -0
  14. data/ext/lemon-1.3.1/cmake/FindILOG.cmake +102 -0
  15. data/ext/lemon-1.3.1/cmake/FindSOPLEX.cmake +23 -0
  16. data/ext/lemon-1.3.1/cmake/LEMONConfig.cmake.in +13 -0
  17. data/ext/lemon-1.3.1/cmake/nsis/lemon.ico +0 -0
  18. data/ext/lemon-1.3.1/cmake/nsis/uninstall.ico +0 -0
  19. data/ext/lemon-1.3.1/cmake/version.cmake +1 -0
  20. data/ext/lemon-1.3.1/cmake/version.cmake.in +1 -0
  21. data/ext/lemon-1.3.1/contrib/CMakeLists.txt +19 -0
  22. data/ext/lemon-1.3.1/lemon/CMakeLists.txt +91 -0
  23. data/ext/lemon-1.3.1/lemon/adaptors.h +3638 -0
  24. data/ext/lemon-1.3.1/lemon/arg_parser.cc +474 -0
  25. data/ext/lemon-1.3.1/lemon/arg_parser.h +440 -0
  26. data/ext/lemon-1.3.1/lemon/assert.h +214 -0
  27. data/ext/lemon-1.3.1/lemon/base.cc +37 -0
  28. data/ext/lemon-1.3.1/lemon/bellman_ford.h +1116 -0
  29. data/ext/lemon-1.3.1/lemon/bfs.h +1754 -0
  30. data/ext/lemon-1.3.1/lemon/bin_heap.h +347 -0
  31. data/ext/lemon-1.3.1/lemon/binomial_heap.h +445 -0
  32. data/ext/lemon-1.3.1/lemon/bits/alteration_notifier.h +472 -0
  33. data/ext/lemon-1.3.1/lemon/bits/array_map.h +351 -0
  34. data/ext/lemon-1.3.1/lemon/bits/bezier.h +174 -0
  35. data/ext/lemon-1.3.1/lemon/bits/default_map.h +182 -0
  36. data/ext/lemon-1.3.1/lemon/bits/edge_set_extender.h +627 -0
  37. data/ext/lemon-1.3.1/lemon/bits/enable_if.h +131 -0
  38. data/ext/lemon-1.3.1/lemon/bits/graph_adaptor_extender.h +401 -0
  39. data/ext/lemon-1.3.1/lemon/bits/graph_extender.h +1332 -0
  40. data/ext/lemon-1.3.1/lemon/bits/lock.h +65 -0
  41. data/ext/lemon-1.3.1/lemon/bits/map_extender.h +332 -0
  42. data/ext/lemon-1.3.1/lemon/bits/path_dump.h +177 -0
  43. data/ext/lemon-1.3.1/lemon/bits/solver_bits.h +194 -0
  44. data/ext/lemon-1.3.1/lemon/bits/traits.h +388 -0
  45. data/ext/lemon-1.3.1/lemon/bits/variant.h +494 -0
  46. data/ext/lemon-1.3.1/lemon/bits/vector_map.h +244 -0
  47. data/ext/lemon-1.3.1/lemon/bits/windows.cc +166 -0
  48. data/ext/lemon-1.3.1/lemon/bits/windows.h +44 -0
  49. data/ext/lemon-1.3.1/lemon/bucket_heap.h +594 -0
  50. data/ext/lemon-1.3.1/lemon/capacity_scaling.h +1014 -0
  51. data/ext/lemon-1.3.1/lemon/cbc.cc +460 -0
  52. data/ext/lemon-1.3.1/lemon/cbc.h +129 -0
  53. data/ext/lemon-1.3.1/lemon/christofides_tsp.h +254 -0
  54. data/ext/lemon-1.3.1/lemon/circulation.h +807 -0
  55. data/ext/lemon-1.3.1/lemon/clp.cc +464 -0
  56. data/ext/lemon-1.3.1/lemon/clp.h +164 -0
  57. data/ext/lemon-1.3.1/lemon/color.cc +44 -0
  58. data/ext/lemon-1.3.1/lemon/color.h +204 -0
  59. data/ext/lemon-1.3.1/lemon/concept_check.h +77 -0
  60. data/ext/lemon-1.3.1/lemon/concepts/bpgraph.h +1029 -0
  61. data/ext/lemon-1.3.1/lemon/concepts/digraph.h +491 -0
  62. data/ext/lemon-1.3.1/lemon/concepts/graph.h +788 -0
  63. data/ext/lemon-1.3.1/lemon/concepts/graph_components.h +2134 -0
  64. data/ext/lemon-1.3.1/lemon/concepts/heap.h +324 -0
  65. data/ext/lemon-1.3.1/lemon/concepts/maps.h +223 -0
  66. data/ext/lemon-1.3.1/lemon/concepts/path.h +312 -0
  67. data/ext/lemon-1.3.1/lemon/config.h.in +22 -0
  68. data/ext/lemon-1.3.1/lemon/connectivity.h +1688 -0
  69. data/ext/lemon-1.3.1/lemon/core.h +2506 -0
  70. data/ext/lemon-1.3.1/lemon/cost_scaling.h +1607 -0
  71. data/ext/lemon-1.3.1/lemon/counter.h +249 -0
  72. data/ext/lemon-1.3.1/lemon/cplex.cc +994 -0
  73. data/ext/lemon-1.3.1/lemon/cplex.h +292 -0
  74. data/ext/lemon-1.3.1/lemon/cycle_canceling.h +1230 -0
  75. data/ext/lemon-1.3.1/lemon/dfs.h +1637 -0
  76. data/ext/lemon-1.3.1/lemon/dheap.h +352 -0
  77. data/ext/lemon-1.3.1/lemon/dijkstra.h +1303 -0
  78. data/ext/lemon-1.3.1/lemon/dim2.h +726 -0
  79. data/ext/lemon-1.3.1/lemon/dimacs.h +448 -0
  80. data/ext/lemon-1.3.1/lemon/edge_set.h +1420 -0
  81. data/ext/lemon-1.3.1/lemon/edmonds_karp.h +556 -0
  82. data/ext/lemon-1.3.1/lemon/elevator.h +982 -0
  83. data/ext/lemon-1.3.1/lemon/error.h +276 -0
  84. data/ext/lemon-1.3.1/lemon/euler.h +287 -0
  85. data/ext/lemon-1.3.1/lemon/fib_heap.h +475 -0
  86. data/ext/lemon-1.3.1/lemon/fractional_matching.h +2139 -0
  87. data/ext/lemon-1.3.1/lemon/full_graph.h +1082 -0
  88. data/ext/lemon-1.3.1/lemon/glpk.cc +1012 -0
  89. data/ext/lemon-1.3.1/lemon/glpk.h +263 -0
  90. data/ext/lemon-1.3.1/lemon/gomory_hu.h +568 -0
  91. data/ext/lemon-1.3.1/lemon/graph_to_eps.h +1186 -0
  92. data/ext/lemon-1.3.1/lemon/greedy_tsp.h +251 -0
  93. data/ext/lemon-1.3.1/lemon/grid_graph.h +699 -0
  94. data/ext/lemon-1.3.1/lemon/grosso_locatelli_pullan_mc.h +840 -0
  95. data/ext/lemon-1.3.1/lemon/hao_orlin.h +1015 -0
  96. data/ext/lemon-1.3.1/lemon/hartmann_orlin_mmc.h +654 -0
  97. data/ext/lemon-1.3.1/lemon/howard_mmc.h +651 -0
  98. data/ext/lemon-1.3.1/lemon/hypercube_graph.h +459 -0
  99. data/ext/lemon-1.3.1/lemon/insertion_tsp.h +533 -0
  100. data/ext/lemon-1.3.1/lemon/karp_mmc.h +590 -0
  101. data/ext/lemon-1.3.1/lemon/kruskal.h +324 -0
  102. data/ext/lemon-1.3.1/lemon/lemon.pc.in +10 -0
  103. data/ext/lemon-1.3.1/lemon/lgf_reader.h +3854 -0
  104. data/ext/lemon-1.3.1/lemon/lgf_writer.h +2687 -0
  105. data/ext/lemon-1.3.1/lemon/list_graph.h +2510 -0
  106. data/ext/lemon-1.3.1/lemon/lp.h +95 -0
  107. data/ext/lemon-1.3.1/lemon/lp_base.cc +30 -0
  108. data/ext/lemon-1.3.1/lemon/lp_base.h +2147 -0
  109. data/ext/lemon-1.3.1/lemon/lp_skeleton.cc +143 -0
  110. data/ext/lemon-1.3.1/lemon/lp_skeleton.h +234 -0
  111. data/ext/lemon-1.3.1/lemon/maps.h +4057 -0
  112. data/ext/lemon-1.3.1/lemon/matching.h +3505 -0
  113. data/ext/lemon-1.3.1/lemon/math.h +77 -0
  114. data/ext/lemon-1.3.1/lemon/max_cardinality_search.h +794 -0
  115. data/ext/lemon-1.3.1/lemon/min_cost_arborescence.h +808 -0
  116. data/ext/lemon-1.3.1/lemon/nagamochi_ibaraki.h +702 -0
  117. data/ext/lemon-1.3.1/lemon/nauty_reader.h +113 -0
  118. data/ext/lemon-1.3.1/lemon/nearest_neighbor_tsp.h +238 -0
  119. data/ext/lemon-1.3.1/lemon/network_simplex.h +1659 -0
  120. data/ext/lemon-1.3.1/lemon/opt2_tsp.h +367 -0
  121. data/ext/lemon-1.3.1/lemon/pairing_heap.h +474 -0
  122. data/ext/lemon-1.3.1/lemon/path.h +1164 -0
  123. data/ext/lemon-1.3.1/lemon/planarity.h +2754 -0
  124. data/ext/lemon-1.3.1/lemon/preflow.h +985 -0
  125. data/ext/lemon-1.3.1/lemon/quad_heap.h +343 -0
  126. data/ext/lemon-1.3.1/lemon/radix_heap.h +438 -0
  127. data/ext/lemon-1.3.1/lemon/radix_sort.h +487 -0
  128. data/ext/lemon-1.3.1/lemon/random.cc +29 -0
  129. data/ext/lemon-1.3.1/lemon/random.h +1005 -0
  130. data/ext/lemon-1.3.1/lemon/smart_graph.h +1344 -0
  131. data/ext/lemon-1.3.1/lemon/soplex.cc +465 -0
  132. data/ext/lemon-1.3.1/lemon/soplex.h +158 -0
  133. data/ext/lemon-1.3.1/lemon/static_graph.h +476 -0
  134. data/ext/lemon-1.3.1/lemon/suurballe.h +776 -0
  135. data/ext/lemon-1.3.1/lemon/time_measure.h +610 -0
  136. data/ext/lemon-1.3.1/lemon/tolerance.h +242 -0
  137. data/ext/lemon-1.3.1/lemon/unionfind.h +1824 -0
  138. data/ext/lemon-1.3.1/scripts/unify-sources.sh +390 -0
  139. data/ext/lemon-1.3.1/scripts/valgrind-wrapper.sh +22 -0
  140. data/ext/lemongraph/arc_map.cc +1007 -0
  141. data/ext/lemongraph/digraph.cc +282 -0
  142. data/ext/lemongraph/digraph_arc.cc +153 -0
  143. data/ext/lemongraph/digraph_node.cc +277 -0
  144. data/ext/lemongraph/edge_map.cc +770 -0
  145. data/ext/lemongraph/extconf.rb +53 -0
  146. data/ext/lemongraph/graph.cc +351 -0
  147. data/ext/lemongraph/graph_arc.cc +95 -0
  148. data/ext/lemongraph/graph_edge.cc +153 -0
  149. data/ext/lemongraph/graph_item.cc +76 -0
  150. data/ext/lemongraph/graph_node.cc +321 -0
  151. data/ext/lemongraph/lemongraph.cc +260 -0
  152. data/ext/lemongraph/lemongraph.hh +295 -0
  153. data/ext/lemongraph/lemongraph.map +6 -0
  154. data/ext/lemongraph/lemongraph_export.hh +31 -0
  155. data/ext/lemongraph/node_map.cc +1011 -0
  156. data/lemongraph.gemspec +176 -0
  157. data/lib/lemongraph/graphviz.rb +240 -0
  158. data/lib/lemongraph/version.rb +4 -0
  159. data/lib/lemongraph.rb +21 -0
  160. data/samples/lemondeps.rb +38 -0
  161. metadata +202 -0
@@ -0,0 +1,194 @@
1
+ /* -*- mode: C++; indent-tabs-mode: nil; -*-
2
+ *
3
+ * This file is a part of LEMON, a generic C++ optimization library.
4
+ *
5
+ * Copyright (C) 2003-2013
6
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
8
+ *
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.
12
+ *
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
15
+ * purpose.
16
+ *
17
+ */
18
+
19
+ #ifndef LEMON_BITS_SOLVER_BITS_H
20
+ #define LEMON_BITS_SOLVER_BITS_H
21
+
22
+ #include <vector>
23
+
24
+ namespace lemon {
25
+
26
+ namespace _solver_bits {
27
+
28
+ class VarIndex {
29
+ private:
30
+ struct ItemT {
31
+ int prev, next;
32
+ int index;
33
+ };
34
+ std::vector<ItemT> items;
35
+ int first_item, last_item, first_free_item;
36
+
37
+ std::vector<int> cross;
38
+
39
+ public:
40
+
41
+ VarIndex()
42
+ : first_item(-1), last_item(-1), first_free_item(-1) {
43
+ }
44
+
45
+ void clear() {
46
+ first_item = -1;
47
+ last_item = -1;
48
+ first_free_item = -1;
49
+ items.clear();
50
+ cross.clear();
51
+ }
52
+
53
+ int addIndex(int idx) {
54
+ int n;
55
+ if (first_free_item == -1) {
56
+ n = items.size();
57
+ items.push_back(ItemT());
58
+ } else {
59
+ n = first_free_item;
60
+ first_free_item = items[n].next;
61
+ if (first_free_item != -1) {
62
+ items[first_free_item].prev = -1;
63
+ }
64
+ }
65
+ items[n].index = idx;
66
+ if (static_cast<int>(cross.size()) <= idx) {
67
+ cross.resize(idx + 1, -1);
68
+ }
69
+ cross[idx] = n;
70
+
71
+ items[n].prev = last_item;
72
+ items[n].next = -1;
73
+ if (last_item != -1) {
74
+ items[last_item].next = n;
75
+ } else {
76
+ first_item = n;
77
+ }
78
+ last_item = n;
79
+
80
+ return n;
81
+ }
82
+
83
+ int addIndex(int idx, int n) {
84
+ while (n >= static_cast<int>(items.size())) {
85
+ items.push_back(ItemT());
86
+ items.back().prev = -1;
87
+ items.back().next = first_free_item;
88
+ if (first_free_item != -1) {
89
+ items[first_free_item].prev = items.size() - 1;
90
+ }
91
+ first_free_item = items.size() - 1;
92
+ }
93
+ if (items[n].next != -1) {
94
+ items[items[n].next].prev = items[n].prev;
95
+ }
96
+ if (items[n].prev != -1) {
97
+ items[items[n].prev].next = items[n].next;
98
+ } else {
99
+ first_free_item = items[n].next;
100
+ }
101
+
102
+ items[n].index = idx;
103
+ if (static_cast<int>(cross.size()) <= idx) {
104
+ cross.resize(idx + 1, -1);
105
+ }
106
+ cross[idx] = n;
107
+
108
+ items[n].prev = last_item;
109
+ items[n].next = -1;
110
+ if (last_item != -1) {
111
+ items[last_item].next = n;
112
+ } else {
113
+ first_item = n;
114
+ }
115
+ last_item = n;
116
+
117
+ return n;
118
+ }
119
+
120
+ void eraseIndex(int idx) {
121
+ int n = cross[idx];
122
+
123
+ if (items[n].prev != -1) {
124
+ items[items[n].prev].next = items[n].next;
125
+ } else {
126
+ first_item = items[n].next;
127
+ }
128
+ if (items[n].next != -1) {
129
+ items[items[n].next].prev = items[n].prev;
130
+ } else {
131
+ last_item = items[n].prev;
132
+ }
133
+
134
+ if (first_free_item != -1) {
135
+ items[first_free_item].prev = n;
136
+ }
137
+ items[n].next = first_free_item;
138
+ items[n].prev = -1;
139
+ first_free_item = n;
140
+
141
+ while (!cross.empty() && cross.back() == -1) {
142
+ cross.pop_back();
143
+ }
144
+ }
145
+
146
+ int maxIndex() const {
147
+ return cross.size() - 1;
148
+ }
149
+
150
+ void shiftIndices(int idx) {
151
+ for (int i = idx + 1; i < static_cast<int>(cross.size()); ++i) {
152
+ cross[i - 1] = cross[i];
153
+ if (cross[i] != -1) {
154
+ --items[cross[i]].index;
155
+ }
156
+ }
157
+ cross.back() = -1;
158
+ cross.pop_back();
159
+ while (!cross.empty() && cross.back() == -1) {
160
+ cross.pop_back();
161
+ }
162
+ }
163
+
164
+ void relocateIndex(int idx, int jdx) {
165
+ cross[idx] = cross[jdx];
166
+ items[cross[jdx]].index = idx;
167
+ cross[jdx] = -1;
168
+
169
+ while (!cross.empty() && cross.back() == -1) {
170
+ cross.pop_back();
171
+ }
172
+ }
173
+
174
+ int operator[](int idx) const {
175
+ return cross[idx];
176
+ }
177
+
178
+ int operator()(int fdx) const {
179
+ return items[fdx].index;
180
+ }
181
+
182
+ void firstItem(int& fdx) const {
183
+ fdx = first_item;
184
+ }
185
+
186
+ void nextItem(int& fdx) const {
187
+ fdx = items[fdx].next;
188
+ }
189
+
190
+ };
191
+ }
192
+ }
193
+
194
+ #endif
@@ -0,0 +1,388 @@
1
+ /* -*- mode: C++; indent-tabs-mode: nil; -*-
2
+ *
3
+ * This file is a part of LEMON, a generic C++ optimization library.
4
+ *
5
+ * Copyright (C) 2003-2013
6
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
8
+ *
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.
12
+ *
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
15
+ * purpose.
16
+ *
17
+ */
18
+
19
+ #ifndef LEMON_BITS_TRAITS_H
20
+ #define LEMON_BITS_TRAITS_H
21
+
22
+ //\file
23
+ //\brief Traits for graphs and maps
24
+ //
25
+
26
+ #include <lemon/bits/enable_if.h>
27
+
28
+ namespace lemon {
29
+
30
+ struct InvalidType {};
31
+
32
+ template <typename GR, typename _Item>
33
+ class ItemSetTraits {};
34
+
35
+
36
+ template <typename GR, typename Enable = void>
37
+ struct NodeNotifierIndicator {
38
+ typedef InvalidType Type;
39
+ };
40
+ template <typename GR>
41
+ struct NodeNotifierIndicator<
42
+ GR,
43
+ typename enable_if<typename GR::NodeNotifier::Notifier, void>::type
44
+ > {
45
+ typedef typename GR::NodeNotifier Type;
46
+ };
47
+
48
+ template <typename GR>
49
+ class ItemSetTraits<GR, typename GR::Node> {
50
+ public:
51
+
52
+ typedef GR Graph;
53
+ typedef GR Digraph;
54
+
55
+ typedef typename GR::Node Item;
56
+ typedef typename GR::NodeIt ItemIt;
57
+
58
+ typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier;
59
+
60
+ template <typename V>
61
+ class Map : public GR::template NodeMap<V> {
62
+ typedef typename GR::template NodeMap<V> Parent;
63
+
64
+ public:
65
+ typedef typename GR::template NodeMap<V> Type;
66
+ typedef typename Parent::Value Value;
67
+
68
+ Map(const GR& _digraph) : Parent(_digraph) {}
69
+ Map(const GR& _digraph, const Value& _value)
70
+ : Parent(_digraph, _value) {}
71
+
72
+ };
73
+
74
+ };
75
+
76
+ template <typename GR, typename Enable = void>
77
+ struct ArcNotifierIndicator {
78
+ typedef InvalidType Type;
79
+ };
80
+ template <typename GR>
81
+ struct ArcNotifierIndicator<
82
+ GR,
83
+ typename enable_if<typename GR::ArcNotifier::Notifier, void>::type
84
+ > {
85
+ typedef typename GR::ArcNotifier Type;
86
+ };
87
+
88
+ template <typename GR>
89
+ class ItemSetTraits<GR, typename GR::Arc> {
90
+ public:
91
+
92
+ typedef GR Graph;
93
+ typedef GR Digraph;
94
+
95
+ typedef typename GR::Arc Item;
96
+ typedef typename GR::ArcIt ItemIt;
97
+
98
+ typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier;
99
+
100
+ template <typename V>
101
+ class Map : public GR::template ArcMap<V> {
102
+ typedef typename GR::template ArcMap<V> Parent;
103
+
104
+ public:
105
+ typedef typename GR::template ArcMap<V> Type;
106
+ typedef typename Parent::Value Value;
107
+
108
+ Map(const GR& _digraph) : Parent(_digraph) {}
109
+ Map(const GR& _digraph, const Value& _value)
110
+ : Parent(_digraph, _value) {}
111
+ };
112
+
113
+ };
114
+
115
+ template <typename GR, typename Enable = void>
116
+ struct EdgeNotifierIndicator {
117
+ typedef InvalidType Type;
118
+ };
119
+ template <typename GR>
120
+ struct EdgeNotifierIndicator<
121
+ GR,
122
+ typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type
123
+ > {
124
+ typedef typename GR::EdgeNotifier Type;
125
+ };
126
+
127
+ template <typename GR>
128
+ class ItemSetTraits<GR, typename GR::Edge> {
129
+ public:
130
+
131
+ typedef GR Graph;
132
+ typedef GR Digraph;
133
+
134
+ typedef typename GR::Edge Item;
135
+ typedef typename GR::EdgeIt ItemIt;
136
+
137
+ typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier;
138
+
139
+ template <typename V>
140
+ class Map : public GR::template EdgeMap<V> {
141
+ typedef typename GR::template EdgeMap<V> Parent;
142
+
143
+ public:
144
+ typedef typename GR::template EdgeMap<V> Type;
145
+ typedef typename Parent::Value Value;
146
+
147
+ Map(const GR& _digraph) : Parent(_digraph) {}
148
+ Map(const GR& _digraph, const Value& _value)
149
+ : Parent(_digraph, _value) {}
150
+ };
151
+
152
+ };
153
+
154
+ template <typename GR, typename Enable = void>
155
+ struct RedNodeNotifierIndicator {
156
+ typedef InvalidType Type;
157
+ };
158
+ template <typename GR>
159
+ struct RedNodeNotifierIndicator<
160
+ GR,
161
+ typename enable_if<typename GR::RedNodeNotifier::Notifier, void>::type
162
+ > {
163
+ typedef typename GR::RedNodeNotifier Type;
164
+ };
165
+
166
+ template <typename GR>
167
+ class ItemSetTraits<GR, typename GR::RedNode> {
168
+ public:
169
+
170
+ typedef GR BpGraph;
171
+ typedef GR Graph;
172
+ typedef GR Digraph;
173
+
174
+ typedef typename GR::RedNode Item;
175
+ typedef typename GR::RedNodeIt ItemIt;
176
+
177
+ typedef typename RedNodeNotifierIndicator<GR>::Type ItemNotifier;
178
+
179
+ template <typename V>
180
+ class Map : public GR::template RedNodeMap<V> {
181
+ typedef typename GR::template RedNodeMap<V> Parent;
182
+
183
+ public:
184
+ typedef typename GR::template RedNodeMap<V> Type;
185
+ typedef typename Parent::Value Value;
186
+
187
+ Map(const GR& _bpgraph) : Parent(_bpgraph) {}
188
+ Map(const GR& _bpgraph, const Value& _value)
189
+ : Parent(_bpgraph, _value) {}
190
+
191
+ };
192
+
193
+ };
194
+
195
+ template <typename GR, typename Enable = void>
196
+ struct BlueNodeNotifierIndicator {
197
+ typedef InvalidType Type;
198
+ };
199
+ template <typename GR>
200
+ struct BlueNodeNotifierIndicator<
201
+ GR,
202
+ typename enable_if<typename GR::BlueNodeNotifier::Notifier, void>::type
203
+ > {
204
+ typedef typename GR::BlueNodeNotifier Type;
205
+ };
206
+
207
+ template <typename GR>
208
+ class ItemSetTraits<GR, typename GR::BlueNode> {
209
+ public:
210
+
211
+ typedef GR BpGraph;
212
+ typedef GR Graph;
213
+ typedef GR Digraph;
214
+
215
+ typedef typename GR::BlueNode Item;
216
+ typedef typename GR::BlueNodeIt ItemIt;
217
+
218
+ typedef typename BlueNodeNotifierIndicator<GR>::Type ItemNotifier;
219
+
220
+ template <typename V>
221
+ class Map : public GR::template BlueNodeMap<V> {
222
+ typedef typename GR::template BlueNodeMap<V> Parent;
223
+
224
+ public:
225
+ typedef typename GR::template BlueNodeMap<V> Type;
226
+ typedef typename Parent::Value Value;
227
+
228
+ Map(const GR& _bpgraph) : Parent(_bpgraph) {}
229
+ Map(const GR& _bpgraph, const Value& _value)
230
+ : Parent(_bpgraph, _value) {}
231
+
232
+ };
233
+
234
+ };
235
+
236
+ template <typename Map, typename Enable = void>
237
+ struct MapTraits {
238
+ typedef False ReferenceMapTag;
239
+
240
+ typedef typename Map::Key Key;
241
+ typedef typename Map::Value Value;
242
+
243
+ typedef Value ConstReturnValue;
244
+ typedef Value ReturnValue;
245
+ };
246
+
247
+ template <typename Map>
248
+ struct MapTraits<
249
+ Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
250
+ {
251
+ typedef True ReferenceMapTag;
252
+
253
+ typedef typename Map::Key Key;
254
+ typedef typename Map::Value Value;
255
+
256
+ typedef typename Map::ConstReference ConstReturnValue;
257
+ typedef typename Map::Reference ReturnValue;
258
+
259
+ typedef typename Map::ConstReference ConstReference;
260
+ typedef typename Map::Reference Reference;
261
+ };
262
+
263
+ template <typename MatrixMap, typename Enable = void>
264
+ struct MatrixMapTraits {
265
+ typedef False ReferenceMapTag;
266
+
267
+ typedef typename MatrixMap::FirstKey FirstKey;
268
+ typedef typename MatrixMap::SecondKey SecondKey;
269
+ typedef typename MatrixMap::Value Value;
270
+
271
+ typedef Value ConstReturnValue;
272
+ typedef Value ReturnValue;
273
+ };
274
+
275
+ template <typename MatrixMap>
276
+ struct MatrixMapTraits<
277
+ MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag,
278
+ void>::type >
279
+ {
280
+ typedef True ReferenceMapTag;
281
+
282
+ typedef typename MatrixMap::FirstKey FirstKey;
283
+ typedef typename MatrixMap::SecondKey SecondKey;
284
+ typedef typename MatrixMap::Value Value;
285
+
286
+ typedef typename MatrixMap::ConstReference ConstReturnValue;
287
+ typedef typename MatrixMap::Reference ReturnValue;
288
+
289
+ typedef typename MatrixMap::ConstReference ConstReference;
290
+ typedef typename MatrixMap::Reference Reference;
291
+ };
292
+
293
+ // Indicators for the tags
294
+
295
+ template <typename GR, typename Enable = void>
296
+ struct NodeNumTagIndicator {
297
+ static const bool value = false;
298
+ };
299
+
300
+ template <typename GR>
301
+ struct NodeNumTagIndicator<
302
+ GR,
303
+ typename enable_if<typename GR::NodeNumTag, void>::type
304
+ > {
305
+ static const bool value = true;
306
+ };
307
+
308
+ template <typename GR, typename Enable = void>
309
+ struct ArcNumTagIndicator {
310
+ static const bool value = false;
311
+ };
312
+
313
+ template <typename GR>
314
+ struct ArcNumTagIndicator<
315
+ GR,
316
+ typename enable_if<typename GR::ArcNumTag, void>::type
317
+ > {
318
+ static const bool value = true;
319
+ };
320
+
321
+ template <typename GR, typename Enable = void>
322
+ struct EdgeNumTagIndicator {
323
+ static const bool value = false;
324
+ };
325
+
326
+ template <typename GR>
327
+ struct EdgeNumTagIndicator<
328
+ GR,
329
+ typename enable_if<typename GR::EdgeNumTag, void>::type
330
+ > {
331
+ static const bool value = true;
332
+ };
333
+
334
+ template <typename GR, typename Enable = void>
335
+ struct FindArcTagIndicator {
336
+ static const bool value = false;
337
+ };
338
+
339
+ template <typename GR>
340
+ struct FindArcTagIndicator<
341
+ GR,
342
+ typename enable_if<typename GR::FindArcTag, void>::type
343
+ > {
344
+ static const bool value = true;
345
+ };
346
+
347
+ template <typename GR, typename Enable = void>
348
+ struct FindEdgeTagIndicator {
349
+ static const bool value = false;
350
+ };
351
+
352
+ template <typename GR>
353
+ struct FindEdgeTagIndicator<
354
+ GR,
355
+ typename enable_if<typename GR::FindEdgeTag, void>::type
356
+ > {
357
+ static const bool value = true;
358
+ };
359
+
360
+ template <typename GR, typename Enable = void>
361
+ struct UndirectedTagIndicator {
362
+ static const bool value = false;
363
+ };
364
+
365
+ template <typename GR>
366
+ struct UndirectedTagIndicator<
367
+ GR,
368
+ typename enable_if<typename GR::UndirectedTag, void>::type
369
+ > {
370
+ static const bool value = true;
371
+ };
372
+
373
+ template <typename GR, typename Enable = void>
374
+ struct BuildTagIndicator {
375
+ static const bool value = false;
376
+ };
377
+
378
+ template <typename GR>
379
+ struct BuildTagIndicator<
380
+ GR,
381
+ typename enable_if<typename GR::BuildTag, void>::type
382
+ > {
383
+ static const bool value = true;
384
+ };
385
+
386
+ }
387
+
388
+ #endif