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,131 @@
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-2009
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
+ // This file contains a modified version of the enable_if library from BOOST.
20
+ // See the appropriate copyright notice below.
21
+
22
+ // Boost enable_if library
23
+
24
+ // Copyright 2003 (c) The Trustees of Indiana University.
25
+
26
+ // Use, modification, and distribution is subject to the Boost Software
27
+ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
28
+ // http://www.boost.org/LICENSE_1_0.txt)
29
+
30
+ // Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
31
+ // Jeremiah Willcock (jewillco at osl.iu.edu)
32
+ // Andrew Lumsdaine (lums at osl.iu.edu)
33
+
34
+
35
+ #ifndef LEMON_BITS_ENABLE_IF_H
36
+ #define LEMON_BITS_ENABLE_IF_H
37
+
38
+ //\file
39
+ //\brief Miscellaneous basic utilities
40
+
41
+ namespace lemon
42
+ {
43
+
44
+ // Basic type for defining "tags". A "YES" condition for \c enable_if.
45
+
46
+ // Basic type for defining "tags". A "YES" condition for \c enable_if.
47
+ //
48
+ //\sa False
49
+ struct True {
50
+ //\e
51
+ static const bool value = true;
52
+ };
53
+
54
+ // Basic type for defining "tags". A "NO" condition for \c enable_if.
55
+
56
+ // Basic type for defining "tags". A "NO" condition for \c enable_if.
57
+ //
58
+ //\sa True
59
+ struct False {
60
+ //\e
61
+ static const bool value = false;
62
+ };
63
+
64
+
65
+
66
+ template <typename T>
67
+ struct Wrap {
68
+ const T &value;
69
+ Wrap(const T &t) : value(t) {}
70
+ };
71
+
72
+ /**************** dummy class to avoid ambiguity ****************/
73
+
74
+ template<int T> struct dummy { dummy(int) {} };
75
+
76
+ /**************** enable_if from BOOST ****************/
77
+
78
+ template <typename Type, typename T = void>
79
+ struct exists {
80
+ typedef T type;
81
+ };
82
+
83
+
84
+ template <bool B, class T = void>
85
+ struct enable_if_c {
86
+ typedef T type;
87
+ };
88
+
89
+ template <class T>
90
+ struct enable_if_c<false, T> {};
91
+
92
+ template <class Cond, class T = void>
93
+ struct enable_if : public enable_if_c<Cond::value, T> {};
94
+
95
+ template <bool B, class T>
96
+ struct lazy_enable_if_c {
97
+ typedef typename T::type type;
98
+ };
99
+
100
+ template <class T>
101
+ struct lazy_enable_if_c<false, T> {};
102
+
103
+ template <class Cond, class T>
104
+ struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
105
+
106
+
107
+ template <bool B, class T = void>
108
+ struct disable_if_c {
109
+ typedef T type;
110
+ };
111
+
112
+ template <class T>
113
+ struct disable_if_c<true, T> {};
114
+
115
+ template <class Cond, class T = void>
116
+ struct disable_if : public disable_if_c<Cond::value, T> {};
117
+
118
+ template <bool B, class T>
119
+ struct lazy_disable_if_c {
120
+ typedef typename T::type type;
121
+ };
122
+
123
+ template <class T>
124
+ struct lazy_disable_if_c<true, T> {};
125
+
126
+ template <class Cond, class T>
127
+ struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
128
+
129
+ } // namespace lemon
130
+
131
+ #endif
@@ -0,0 +1,401 @@
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_GRAPH_ADAPTOR_EXTENDER_H
20
+ #define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
21
+
22
+ #include <lemon/core.h>
23
+ #include <lemon/error.h>
24
+
25
+ namespace lemon {
26
+
27
+ template <typename _Digraph>
28
+ class DigraphAdaptorExtender : public _Digraph {
29
+ typedef _Digraph Parent;
30
+
31
+ public:
32
+
33
+ typedef _Digraph Digraph;
34
+ typedef DigraphAdaptorExtender Adaptor;
35
+
36
+ // Base extensions
37
+
38
+ typedef typename Parent::Node Node;
39
+ typedef typename Parent::Arc Arc;
40
+
41
+ int maxId(Node) const {
42
+ return Parent::maxNodeId();
43
+ }
44
+
45
+ int maxId(Arc) const {
46
+ return Parent::maxArcId();
47
+ }
48
+
49
+ Node fromId(int id, Node) const {
50
+ return Parent::nodeFromId(id);
51
+ }
52
+
53
+ Arc fromId(int id, Arc) const {
54
+ return Parent::arcFromId(id);
55
+ }
56
+
57
+ Node oppositeNode(const Node &n, const Arc &e) const {
58
+ if (n == Parent::source(e))
59
+ return Parent::target(e);
60
+ else if(n==Parent::target(e))
61
+ return Parent::source(e);
62
+ else
63
+ return INVALID;
64
+ }
65
+
66
+ class NodeIt : public Node {
67
+ const Adaptor* _adaptor;
68
+ public:
69
+
70
+ NodeIt() {}
71
+
72
+ NodeIt(Invalid i) : Node(i) { }
73
+
74
+ explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
75
+ _adaptor->first(static_cast<Node&>(*this));
76
+ }
77
+
78
+ NodeIt(const Adaptor& adaptor, const Node& node)
79
+ : Node(node), _adaptor(&adaptor) {}
80
+
81
+ NodeIt& operator++() {
82
+ _adaptor->next(*this);
83
+ return *this;
84
+ }
85
+
86
+ };
87
+
88
+
89
+ class ArcIt : public Arc {
90
+ const Adaptor* _adaptor;
91
+ public:
92
+
93
+ ArcIt() { }
94
+
95
+ ArcIt(Invalid i) : Arc(i) { }
96
+
97
+ explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
98
+ _adaptor->first(static_cast<Arc&>(*this));
99
+ }
100
+
101
+ ArcIt(const Adaptor& adaptor, const Arc& e) :
102
+ Arc(e), _adaptor(&adaptor) { }
103
+
104
+ ArcIt& operator++() {
105
+ _adaptor->next(*this);
106
+ return *this;
107
+ }
108
+
109
+ };
110
+
111
+
112
+ class OutArcIt : public Arc {
113
+ const Adaptor* _adaptor;
114
+ public:
115
+
116
+ OutArcIt() { }
117
+
118
+ OutArcIt(Invalid i) : Arc(i) { }
119
+
120
+ OutArcIt(const Adaptor& adaptor, const Node& node)
121
+ : _adaptor(&adaptor) {
122
+ _adaptor->firstOut(*this, node);
123
+ }
124
+
125
+ OutArcIt(const Adaptor& adaptor, const Arc& arc)
126
+ : Arc(arc), _adaptor(&adaptor) {}
127
+
128
+ OutArcIt& operator++() {
129
+ _adaptor->nextOut(*this);
130
+ return *this;
131
+ }
132
+
133
+ };
134
+
135
+
136
+ class InArcIt : public Arc {
137
+ const Adaptor* _adaptor;
138
+ public:
139
+
140
+ InArcIt() { }
141
+
142
+ InArcIt(Invalid i) : Arc(i) { }
143
+
144
+ InArcIt(const Adaptor& adaptor, const Node& node)
145
+ : _adaptor(&adaptor) {
146
+ _adaptor->firstIn(*this, node);
147
+ }
148
+
149
+ InArcIt(const Adaptor& adaptor, const Arc& arc) :
150
+ Arc(arc), _adaptor(&adaptor) {}
151
+
152
+ InArcIt& operator++() {
153
+ _adaptor->nextIn(*this);
154
+ return *this;
155
+ }
156
+
157
+ };
158
+
159
+ Node baseNode(const OutArcIt &e) const {
160
+ return Parent::source(e);
161
+ }
162
+ Node runningNode(const OutArcIt &e) const {
163
+ return Parent::target(e);
164
+ }
165
+
166
+ Node baseNode(const InArcIt &e) const {
167
+ return Parent::target(e);
168
+ }
169
+ Node runningNode(const InArcIt &e) const {
170
+ return Parent::source(e);
171
+ }
172
+
173
+ };
174
+
175
+ template <typename _Graph>
176
+ class GraphAdaptorExtender : public _Graph {
177
+ typedef _Graph Parent;
178
+
179
+ public:
180
+
181
+ typedef _Graph Graph;
182
+ typedef GraphAdaptorExtender Adaptor;
183
+
184
+ typedef True UndirectedTag;
185
+
186
+ typedef typename Parent::Node Node;
187
+ typedef typename Parent::Arc Arc;
188
+ typedef typename Parent::Edge Edge;
189
+
190
+ // Graph extension
191
+
192
+ int maxId(Node) const {
193
+ return Parent::maxNodeId();
194
+ }
195
+
196
+ int maxId(Arc) const {
197
+ return Parent::maxArcId();
198
+ }
199
+
200
+ int maxId(Edge) const {
201
+ return Parent::maxEdgeId();
202
+ }
203
+
204
+ Node fromId(int id, Node) const {
205
+ return Parent::nodeFromId(id);
206
+ }
207
+
208
+ Arc fromId(int id, Arc) const {
209
+ return Parent::arcFromId(id);
210
+ }
211
+
212
+ Edge fromId(int id, Edge) const {
213
+ return Parent::edgeFromId(id);
214
+ }
215
+
216
+ Node oppositeNode(const Node &n, const Edge &e) const {
217
+ if( n == Parent::u(e))
218
+ return Parent::v(e);
219
+ else if( n == Parent::v(e))
220
+ return Parent::u(e);
221
+ else
222
+ return INVALID;
223
+ }
224
+
225
+ Arc oppositeArc(const Arc &a) const {
226
+ return Parent::direct(a, !Parent::direction(a));
227
+ }
228
+
229
+ using Parent::direct;
230
+ Arc direct(const Edge &e, const Node &s) const {
231
+ return Parent::direct(e, Parent::u(e) == s);
232
+ }
233
+
234
+
235
+ class NodeIt : public Node {
236
+ const Adaptor* _adaptor;
237
+ public:
238
+
239
+ NodeIt() {}
240
+
241
+ NodeIt(Invalid i) : Node(i) { }
242
+
243
+ explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
244
+ _adaptor->first(static_cast<Node&>(*this));
245
+ }
246
+
247
+ NodeIt(const Adaptor& adaptor, const Node& node)
248
+ : Node(node), _adaptor(&adaptor) {}
249
+
250
+ NodeIt& operator++() {
251
+ _adaptor->next(*this);
252
+ return *this;
253
+ }
254
+
255
+ };
256
+
257
+
258
+ class ArcIt : public Arc {
259
+ const Adaptor* _adaptor;
260
+ public:
261
+
262
+ ArcIt() { }
263
+
264
+ ArcIt(Invalid i) : Arc(i) { }
265
+
266
+ explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
267
+ _adaptor->first(static_cast<Arc&>(*this));
268
+ }
269
+
270
+ ArcIt(const Adaptor& adaptor, const Arc& e) :
271
+ Arc(e), _adaptor(&adaptor) { }
272
+
273
+ ArcIt& operator++() {
274
+ _adaptor->next(*this);
275
+ return *this;
276
+ }
277
+
278
+ };
279
+
280
+
281
+ class OutArcIt : public Arc {
282
+ const Adaptor* _adaptor;
283
+ public:
284
+
285
+ OutArcIt() { }
286
+
287
+ OutArcIt(Invalid i) : Arc(i) { }
288
+
289
+ OutArcIt(const Adaptor& adaptor, const Node& node)
290
+ : _adaptor(&adaptor) {
291
+ _adaptor->firstOut(*this, node);
292
+ }
293
+
294
+ OutArcIt(const Adaptor& adaptor, const Arc& arc)
295
+ : Arc(arc), _adaptor(&adaptor) {}
296
+
297
+ OutArcIt& operator++() {
298
+ _adaptor->nextOut(*this);
299
+ return *this;
300
+ }
301
+
302
+ };
303
+
304
+
305
+ class InArcIt : public Arc {
306
+ const Adaptor* _adaptor;
307
+ public:
308
+
309
+ InArcIt() { }
310
+
311
+ InArcIt(Invalid i) : Arc(i) { }
312
+
313
+ InArcIt(const Adaptor& adaptor, const Node& node)
314
+ : _adaptor(&adaptor) {
315
+ _adaptor->firstIn(*this, node);
316
+ }
317
+
318
+ InArcIt(const Adaptor& adaptor, const Arc& arc) :
319
+ Arc(arc), _adaptor(&adaptor) {}
320
+
321
+ InArcIt& operator++() {
322
+ _adaptor->nextIn(*this);
323
+ return *this;
324
+ }
325
+
326
+ };
327
+
328
+ class EdgeIt : public Parent::Edge {
329
+ const Adaptor* _adaptor;
330
+ public:
331
+
332
+ EdgeIt() { }
333
+
334
+ EdgeIt(Invalid i) : Edge(i) { }
335
+
336
+ explicit EdgeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
337
+ _adaptor->first(static_cast<Edge&>(*this));
338
+ }
339
+
340
+ EdgeIt(const Adaptor& adaptor, const Edge& e) :
341
+ Edge(e), _adaptor(&adaptor) { }
342
+
343
+ EdgeIt& operator++() {
344
+ _adaptor->next(*this);
345
+ return *this;
346
+ }
347
+
348
+ };
349
+
350
+ class IncEdgeIt : public Edge {
351
+ friend class GraphAdaptorExtender;
352
+ const Adaptor* _adaptor;
353
+ bool direction;
354
+ public:
355
+
356
+ IncEdgeIt() { }
357
+
358
+ IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
359
+
360
+ IncEdgeIt(const Adaptor& adaptor, const Node &n) : _adaptor(&adaptor) {
361
+ _adaptor->firstInc(static_cast<Edge&>(*this), direction, n);
362
+ }
363
+
364
+ IncEdgeIt(const Adaptor& adaptor, const Edge &e, const Node &n)
365
+ : _adaptor(&adaptor), Edge(e) {
366
+ direction = (_adaptor->u(e) == n);
367
+ }
368
+
369
+ IncEdgeIt& operator++() {
370
+ _adaptor->nextInc(*this, direction);
371
+ return *this;
372
+ }
373
+ };
374
+
375
+ Node baseNode(const OutArcIt &a) const {
376
+ return Parent::source(a);
377
+ }
378
+ Node runningNode(const OutArcIt &a) const {
379
+ return Parent::target(a);
380
+ }
381
+
382
+ Node baseNode(const InArcIt &a) const {
383
+ return Parent::target(a);
384
+ }
385
+ Node runningNode(const InArcIt &a) const {
386
+ return Parent::source(a);
387
+ }
388
+
389
+ Node baseNode(const IncEdgeIt &e) const {
390
+ return e.direction ? Parent::u(e) : Parent::v(e);
391
+ }
392
+ Node runningNode(const IncEdgeIt &e) const {
393
+ return e.direction ? Parent::v(e) : Parent::u(e);
394
+ }
395
+
396
+ };
397
+
398
+ }
399
+
400
+
401
+ #endif