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,788 @@
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
+ ///\ingroup graph_concepts
20
+ ///\file
21
+ ///\brief The concept of undirected graphs.
22
+
23
+ #ifndef LEMON_CONCEPTS_GRAPH_H
24
+ #define LEMON_CONCEPTS_GRAPH_H
25
+
26
+ #include <lemon/concepts/graph_components.h>
27
+ #include <lemon/concepts/maps.h>
28
+ #include <lemon/concept_check.h>
29
+ #include <lemon/core.h>
30
+
31
+ namespace lemon {
32
+ namespace concepts {
33
+
34
+ /// \ingroup graph_concepts
35
+ ///
36
+ /// \brief Class describing the concept of undirected graphs.
37
+ ///
38
+ /// This class describes the common interface of all undirected
39
+ /// graphs.
40
+ ///
41
+ /// Like all concept classes, it only provides an interface
42
+ /// without any sensible implementation. So any general algorithm for
43
+ /// undirected graphs should compile with this class, but it will not
44
+ /// run properly, of course.
45
+ /// An actual graph implementation like \ref ListGraph or
46
+ /// \ref SmartGraph may have additional functionality.
47
+ ///
48
+ /// The undirected graphs also fulfill the concept of \ref Digraph
49
+ /// "directed graphs", since each edge can also be regarded as two
50
+ /// oppositely directed arcs.
51
+ /// Undirected graphs provide an Edge type for the undirected edges and
52
+ /// an Arc type for the directed arcs. The Arc type is convertible to
53
+ /// Edge or inherited from it, i.e. the corresponding edge can be
54
+ /// obtained from an arc.
55
+ /// EdgeIt and EdgeMap classes can be used for the edges, while ArcIt
56
+ /// and ArcMap classes can be used for the arcs (just like in digraphs).
57
+ /// Both InArcIt and OutArcIt iterates on the same edges but with
58
+ /// opposite direction. IncEdgeIt also iterates on the same edges
59
+ /// as OutArcIt and InArcIt, but it is not convertible to Arc,
60
+ /// only to Edge.
61
+ ///
62
+ /// In LEMON, each undirected edge has an inherent orientation.
63
+ /// Thus it can defined if an arc is forward or backward oriented in
64
+ /// an undirected graph with respect to this default oriantation of
65
+ /// the represented edge.
66
+ /// With the direction() and direct() functions the direction
67
+ /// of an arc can be obtained and set, respectively.
68
+ ///
69
+ /// Only nodes and edges can be added to or removed from an undirected
70
+ /// graph and the corresponding arcs are added or removed automatically.
71
+ ///
72
+ /// \sa Digraph
73
+ class Graph {
74
+ private:
75
+ /// Graphs are \e not copy constructible. Use GraphCopy instead.
76
+ Graph(const Graph&) {}
77
+ /// \brief Assignment of a graph to another one is \e not allowed.
78
+ /// Use GraphCopy instead.
79
+ void operator=(const Graph&) {}
80
+
81
+ public:
82
+ /// Default constructor.
83
+ Graph() {}
84
+
85
+ /// \brief Undirected graphs should be tagged with \c UndirectedTag.
86
+ ///
87
+ /// Undirected graphs should be tagged with \c UndirectedTag.
88
+ ///
89
+ /// This tag helps the \c enable_if technics to make compile time
90
+ /// specializations for undirected graphs.
91
+ typedef True UndirectedTag;
92
+
93
+ /// The node type of the graph
94
+
95
+ /// This class identifies a node of the graph. It also serves
96
+ /// as a base class of the node iterators,
97
+ /// thus they convert to this type.
98
+ class Node {
99
+ public:
100
+ /// Default constructor
101
+
102
+ /// Default constructor.
103
+ /// \warning It sets the object to an undefined value.
104
+ Node() { }
105
+ /// Copy constructor.
106
+
107
+ /// Copy constructor.
108
+ ///
109
+ Node(const Node&) { }
110
+
111
+ /// %Invalid constructor \& conversion.
112
+
113
+ /// Initializes the object to be invalid.
114
+ /// \sa Invalid for more details.
115
+ Node(Invalid) { }
116
+ /// Equality operator
117
+
118
+ /// Equality operator.
119
+ ///
120
+ /// Two iterators are equal if and only if they point to the
121
+ /// same object or both are \c INVALID.
122
+ bool operator==(Node) const { return true; }
123
+
124
+ /// Inequality operator
125
+
126
+ /// Inequality operator.
127
+ bool operator!=(Node) const { return true; }
128
+
129
+ /// Artificial ordering operator.
130
+
131
+ /// Artificial ordering operator.
132
+ ///
133
+ /// \note This operator only has to define some strict ordering of
134
+ /// the items; this order has nothing to do with the iteration
135
+ /// ordering of the items.
136
+ bool operator<(Node) const { return false; }
137
+
138
+ };
139
+
140
+ /// Iterator class for the nodes.
141
+
142
+ /// This iterator goes through each node of the graph.
143
+ /// Its usage is quite simple, for example, you can count the number
144
+ /// of nodes in a graph \c g of type \c %Graph like this:
145
+ ///\code
146
+ /// int count=0;
147
+ /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
148
+ ///\endcode
149
+ class NodeIt : public Node {
150
+ public:
151
+ /// Default constructor
152
+
153
+ /// Default constructor.
154
+ /// \warning It sets the iterator to an undefined value.
155
+ NodeIt() { }
156
+ /// Copy constructor.
157
+
158
+ /// Copy constructor.
159
+ ///
160
+ NodeIt(const NodeIt& n) : Node(n) { }
161
+ /// %Invalid constructor \& conversion.
162
+
163
+ /// Initializes the iterator to be invalid.
164
+ /// \sa Invalid for more details.
165
+ NodeIt(Invalid) { }
166
+ /// Sets the iterator to the first node.
167
+
168
+ /// Sets the iterator to the first node of the given digraph.
169
+ ///
170
+ explicit NodeIt(const Graph&) { }
171
+ /// Sets the iterator to the given node.
172
+
173
+ /// Sets the iterator to the given node of the given digraph.
174
+ ///
175
+ NodeIt(const Graph&, const Node&) { }
176
+ /// Next node.
177
+
178
+ /// Assign the iterator to the next node.
179
+ ///
180
+ NodeIt& operator++() { return *this; }
181
+ };
182
+
183
+
184
+ /// The edge type of the graph
185
+
186
+ /// This class identifies an edge of the graph. It also serves
187
+ /// as a base class of the edge iterators,
188
+ /// thus they will convert to this type.
189
+ class Edge {
190
+ public:
191
+ /// Default constructor
192
+
193
+ /// Default constructor.
194
+ /// \warning It sets the object to an undefined value.
195
+ Edge() { }
196
+ /// Copy constructor.
197
+
198
+ /// Copy constructor.
199
+ ///
200
+ Edge(const Edge&) { }
201
+ /// %Invalid constructor \& conversion.
202
+
203
+ /// Initializes the object to be invalid.
204
+ /// \sa Invalid for more details.
205
+ Edge(Invalid) { }
206
+ /// Equality operator
207
+
208
+ /// Equality operator.
209
+ ///
210
+ /// Two iterators are equal if and only if they point to the
211
+ /// same object or both are \c INVALID.
212
+ bool operator==(Edge) const { return true; }
213
+ /// Inequality operator
214
+
215
+ /// Inequality operator.
216
+ bool operator!=(Edge) const { return true; }
217
+
218
+ /// Artificial ordering operator.
219
+
220
+ /// Artificial ordering operator.
221
+ ///
222
+ /// \note This operator only has to define some strict ordering of
223
+ /// the edges; this order has nothing to do with the iteration
224
+ /// ordering of the edges.
225
+ bool operator<(Edge) const { return false; }
226
+ };
227
+
228
+ /// Iterator class for the edges.
229
+
230
+ /// This iterator goes through each edge of the graph.
231
+ /// Its usage is quite simple, for example, you can count the number
232
+ /// of edges in a graph \c g of type \c %Graph as follows:
233
+ ///\code
234
+ /// int count=0;
235
+ /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
236
+ ///\endcode
237
+ class EdgeIt : public Edge {
238
+ public:
239
+ /// Default constructor
240
+
241
+ /// Default constructor.
242
+ /// \warning It sets the iterator to an undefined value.
243
+ EdgeIt() { }
244
+ /// Copy constructor.
245
+
246
+ /// Copy constructor.
247
+ ///
248
+ EdgeIt(const EdgeIt& e) : Edge(e) { }
249
+ /// %Invalid constructor \& conversion.
250
+
251
+ /// Initializes the iterator to be invalid.
252
+ /// \sa Invalid for more details.
253
+ EdgeIt(Invalid) { }
254
+ /// Sets the iterator to the first edge.
255
+
256
+ /// Sets the iterator to the first edge of the given graph.
257
+ ///
258
+ explicit EdgeIt(const Graph&) { }
259
+ /// Sets the iterator to the given edge.
260
+
261
+ /// Sets the iterator to the given edge of the given graph.
262
+ ///
263
+ EdgeIt(const Graph&, const Edge&) { }
264
+ /// Next edge
265
+
266
+ /// Assign the iterator to the next edge.
267
+ ///
268
+ EdgeIt& operator++() { return *this; }
269
+ };
270
+
271
+ /// Iterator class for the incident edges of a node.
272
+
273
+ /// This iterator goes trough the incident undirected edges
274
+ /// of a certain node of a graph.
275
+ /// Its usage is quite simple, for example, you can compute the
276
+ /// degree (i.e. the number of incident edges) of a node \c n
277
+ /// in a graph \c g of type \c %Graph as follows.
278
+ ///
279
+ ///\code
280
+ /// int count=0;
281
+ /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
282
+ ///\endcode
283
+ ///
284
+ /// \warning Loop edges will be iterated twice.
285
+ class IncEdgeIt : public Edge {
286
+ public:
287
+ /// Default constructor
288
+
289
+ /// Default constructor.
290
+ /// \warning It sets the iterator to an undefined value.
291
+ IncEdgeIt() { }
292
+ /// Copy constructor.
293
+
294
+ /// Copy constructor.
295
+ ///
296
+ IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
297
+ /// %Invalid constructor \& conversion.
298
+
299
+ /// Initializes the iterator to be invalid.
300
+ /// \sa Invalid for more details.
301
+ IncEdgeIt(Invalid) { }
302
+ /// Sets the iterator to the first incident edge.
303
+
304
+ /// Sets the iterator to the first incident edge of the given node.
305
+ ///
306
+ IncEdgeIt(const Graph&, const Node&) { }
307
+ /// Sets the iterator to the given edge.
308
+
309
+ /// Sets the iterator to the given edge of the given graph.
310
+ ///
311
+ IncEdgeIt(const Graph&, const Edge&) { }
312
+ /// Next incident edge
313
+
314
+ /// Assign the iterator to the next incident edge
315
+ /// of the corresponding node.
316
+ IncEdgeIt& operator++() { return *this; }
317
+ };
318
+
319
+ /// The arc type of the graph
320
+
321
+ /// This class identifies a directed arc of the graph. It also serves
322
+ /// as a base class of the arc iterators,
323
+ /// thus they will convert to this type.
324
+ class Arc {
325
+ public:
326
+ /// Default constructor
327
+
328
+ /// Default constructor.
329
+ /// \warning It sets the object to an undefined value.
330
+ Arc() { }
331
+ /// Copy constructor.
332
+
333
+ /// Copy constructor.
334
+ ///
335
+ Arc(const Arc&) { }
336
+ /// %Invalid constructor \& conversion.
337
+
338
+ /// Initializes the object to be invalid.
339
+ /// \sa Invalid for more details.
340
+ Arc(Invalid) { }
341
+ /// Equality operator
342
+
343
+ /// Equality operator.
344
+ ///
345
+ /// Two iterators are equal if and only if they point to the
346
+ /// same object or both are \c INVALID.
347
+ bool operator==(Arc) const { return true; }
348
+ /// Inequality operator
349
+
350
+ /// Inequality operator.
351
+ bool operator!=(Arc) const { return true; }
352
+
353
+ /// Artificial ordering operator.
354
+
355
+ /// Artificial ordering operator.
356
+ ///
357
+ /// \note This operator only has to define some strict ordering of
358
+ /// the arcs; this order has nothing to do with the iteration
359
+ /// ordering of the arcs.
360
+ bool operator<(Arc) const { return false; }
361
+
362
+ /// Converison to \c Edge
363
+
364
+ /// Converison to \c Edge.
365
+ ///
366
+ operator Edge() const { return Edge(); }
367
+ };
368
+
369
+ /// Iterator class for the arcs.
370
+
371
+ /// This iterator goes through each directed arc of the graph.
372
+ /// Its usage is quite simple, for example, you can count the number
373
+ /// of arcs in a graph \c g of type \c %Graph as follows:
374
+ ///\code
375
+ /// int count=0;
376
+ /// for(Graph::ArcIt a(g); a!=INVALID; ++a) ++count;
377
+ ///\endcode
378
+ class ArcIt : public Arc {
379
+ public:
380
+ /// Default constructor
381
+
382
+ /// Default constructor.
383
+ /// \warning It sets the iterator to an undefined value.
384
+ ArcIt() { }
385
+ /// Copy constructor.
386
+
387
+ /// Copy constructor.
388
+ ///
389
+ ArcIt(const ArcIt& e) : Arc(e) { }
390
+ /// %Invalid constructor \& conversion.
391
+
392
+ /// Initializes the iterator to be invalid.
393
+ /// \sa Invalid for more details.
394
+ ArcIt(Invalid) { }
395
+ /// Sets the iterator to the first arc.
396
+
397
+ /// Sets the iterator to the first arc of the given graph.
398
+ ///
399
+ explicit ArcIt(const Graph &g) {
400
+ ::lemon::ignore_unused_variable_warning(g);
401
+ }
402
+ /// Sets the iterator to the given arc.
403
+
404
+ /// Sets the iterator to the given arc of the given graph.
405
+ ///
406
+ ArcIt(const Graph&, const Arc&) { }
407
+ /// Next arc
408
+
409
+ /// Assign the iterator to the next arc.
410
+ ///
411
+ ArcIt& operator++() { return *this; }
412
+ };
413
+
414
+ /// Iterator class for the outgoing arcs of a node.
415
+
416
+ /// This iterator goes trough the \e outgoing directed arcs of a
417
+ /// certain node of a graph.
418
+ /// Its usage is quite simple, for example, you can count the number
419
+ /// of outgoing arcs of a node \c n
420
+ /// in a graph \c g of type \c %Graph as follows.
421
+ ///\code
422
+ /// int count=0;
423
+ /// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count;
424
+ ///\endcode
425
+ class OutArcIt : public Arc {
426
+ public:
427
+ /// Default constructor
428
+
429
+ /// Default constructor.
430
+ /// \warning It sets the iterator to an undefined value.
431
+ OutArcIt() { }
432
+ /// Copy constructor.
433
+
434
+ /// Copy constructor.
435
+ ///
436
+ OutArcIt(const OutArcIt& e) : Arc(e) { }
437
+ /// %Invalid constructor \& conversion.
438
+
439
+ /// Initializes the iterator to be invalid.
440
+ /// \sa Invalid for more details.
441
+ OutArcIt(Invalid) { }
442
+ /// Sets the iterator to the first outgoing arc.
443
+
444
+ /// Sets the iterator to the first outgoing arc of the given node.
445
+ ///
446
+ OutArcIt(const Graph& n, const Node& g) {
447
+ ::lemon::ignore_unused_variable_warning(n);
448
+ ::lemon::ignore_unused_variable_warning(g);
449
+ }
450
+ /// Sets the iterator to the given arc.
451
+
452
+ /// Sets the iterator to the given arc of the given graph.
453
+ ///
454
+ OutArcIt(const Graph&, const Arc&) { }
455
+ /// Next outgoing arc
456
+
457
+ /// Assign the iterator to the next
458
+ /// outgoing arc of the corresponding node.
459
+ OutArcIt& operator++() { return *this; }
460
+ };
461
+
462
+ /// Iterator class for the incoming arcs of a node.
463
+
464
+ /// This iterator goes trough the \e incoming directed arcs of a
465
+ /// certain node of a graph.
466
+ /// Its usage is quite simple, for example, you can count the number
467
+ /// of incoming arcs of a node \c n
468
+ /// in a graph \c g of type \c %Graph as follows.
469
+ ///\code
470
+ /// int count=0;
471
+ /// for (Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count;
472
+ ///\endcode
473
+ class InArcIt : public Arc {
474
+ public:
475
+ /// Default constructor
476
+
477
+ /// Default constructor.
478
+ /// \warning It sets the iterator to an undefined value.
479
+ InArcIt() { }
480
+ /// Copy constructor.
481
+
482
+ /// Copy constructor.
483
+ ///
484
+ InArcIt(const InArcIt& e) : Arc(e) { }
485
+ /// %Invalid constructor \& conversion.
486
+
487
+ /// Initializes the iterator to be invalid.
488
+ /// \sa Invalid for more details.
489
+ InArcIt(Invalid) { }
490
+ /// Sets the iterator to the first incoming arc.
491
+
492
+ /// Sets the iterator to the first incoming arc of the given node.
493
+ ///
494
+ InArcIt(const Graph& g, const Node& n) {
495
+ ::lemon::ignore_unused_variable_warning(n);
496
+ ::lemon::ignore_unused_variable_warning(g);
497
+ }
498
+ /// Sets the iterator to the given arc.
499
+
500
+ /// Sets the iterator to the given arc of the given graph.
501
+ ///
502
+ InArcIt(const Graph&, const Arc&) { }
503
+ /// Next incoming arc
504
+
505
+ /// Assign the iterator to the next
506
+ /// incoming arc of the corresponding node.
507
+ InArcIt& operator++() { return *this; }
508
+ };
509
+
510
+ /// \brief Standard graph map type for the nodes.
511
+ ///
512
+ /// Standard graph map type for the nodes.
513
+ /// It conforms to the ReferenceMap concept.
514
+ template<class T>
515
+ class NodeMap : public ReferenceMap<Node, T, T&, const T&>
516
+ {
517
+ public:
518
+
519
+ /// Constructor
520
+ explicit NodeMap(const Graph&) { }
521
+ /// Constructor with given initial value
522
+ NodeMap(const Graph&, T) { }
523
+
524
+ private:
525
+ ///Copy constructor
526
+ NodeMap(const NodeMap& nm) :
527
+ ReferenceMap<Node, T, T&, const T&>(nm) { }
528
+ ///Assignment operator
529
+ template <typename CMap>
530
+ NodeMap& operator=(const CMap&) {
531
+ checkConcept<ReadMap<Node, T>, CMap>();
532
+ return *this;
533
+ }
534
+ };
535
+
536
+ /// \brief Standard graph map type for the arcs.
537
+ ///
538
+ /// Standard graph map type for the arcs.
539
+ /// It conforms to the ReferenceMap concept.
540
+ template<class T>
541
+ class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
542
+ {
543
+ public:
544
+
545
+ /// Constructor
546
+ explicit ArcMap(const Graph&) { }
547
+ /// Constructor with given initial value
548
+ ArcMap(const Graph&, T) { }
549
+
550
+ private:
551
+ ///Copy constructor
552
+ ArcMap(const ArcMap& em) :
553
+ ReferenceMap<Arc, T, T&, const T&>(em) { }
554
+ ///Assignment operator
555
+ template <typename CMap>
556
+ ArcMap& operator=(const CMap&) {
557
+ checkConcept<ReadMap<Arc, T>, CMap>();
558
+ return *this;
559
+ }
560
+ };
561
+
562
+ /// \brief Standard graph map type for the edges.
563
+ ///
564
+ /// Standard graph map type for the edges.
565
+ /// It conforms to the ReferenceMap concept.
566
+ template<class T>
567
+ class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
568
+ {
569
+ public:
570
+
571
+ /// Constructor
572
+ explicit EdgeMap(const Graph&) { }
573
+ /// Constructor with given initial value
574
+ EdgeMap(const Graph&, T) { }
575
+
576
+ private:
577
+ ///Copy constructor
578
+ EdgeMap(const EdgeMap& em) :
579
+ ReferenceMap<Edge, T, T&, const T&>(em) {}
580
+ ///Assignment operator
581
+ template <typename CMap>
582
+ EdgeMap& operator=(const CMap&) {
583
+ checkConcept<ReadMap<Edge, T>, CMap>();
584
+ return *this;
585
+ }
586
+ };
587
+
588
+ /// \brief The first node of the edge.
589
+ ///
590
+ /// Returns the first node of the given edge.
591
+ ///
592
+ /// Edges don't have source and target nodes, however, methods
593
+ /// u() and v() are used to query the two end-nodes of an edge.
594
+ /// The orientation of an edge that arises this way is called
595
+ /// the inherent direction, it is used to define the default
596
+ /// direction for the corresponding arcs.
597
+ /// \sa v()
598
+ /// \sa direction()
599
+ Node u(Edge) const { return INVALID; }
600
+
601
+ /// \brief The second node of the edge.
602
+ ///
603
+ /// Returns the second node of the given edge.
604
+ ///
605
+ /// Edges don't have source and target nodes, however, methods
606
+ /// u() and v() are used to query the two end-nodes of an edge.
607
+ /// The orientation of an edge that arises this way is called
608
+ /// the inherent direction, it is used to define the default
609
+ /// direction for the corresponding arcs.
610
+ /// \sa u()
611
+ /// \sa direction()
612
+ Node v(Edge) const { return INVALID; }
613
+
614
+ /// \brief The source node of the arc.
615
+ ///
616
+ /// Returns the source node of the given arc.
617
+ Node source(Arc) const { return INVALID; }
618
+
619
+ /// \brief The target node of the arc.
620
+ ///
621
+ /// Returns the target node of the given arc.
622
+ Node target(Arc) const { return INVALID; }
623
+
624
+ /// \brief The ID of the node.
625
+ ///
626
+ /// Returns the ID of the given node.
627
+ int id(Node) const { return -1; }
628
+
629
+ /// \brief The ID of the edge.
630
+ ///
631
+ /// Returns the ID of the given edge.
632
+ int id(Edge) const { return -1; }
633
+
634
+ /// \brief The ID of the arc.
635
+ ///
636
+ /// Returns the ID of the given arc.
637
+ int id(Arc) const { return -1; }
638
+
639
+ /// \brief The node with the given ID.
640
+ ///
641
+ /// Returns the node with the given ID.
642
+ /// \pre The argument should be a valid node ID in the graph.
643
+ Node nodeFromId(int) const { return INVALID; }
644
+
645
+ /// \brief The edge with the given ID.
646
+ ///
647
+ /// Returns the edge with the given ID.
648
+ /// \pre The argument should be a valid edge ID in the graph.
649
+ Edge edgeFromId(int) const { return INVALID; }
650
+
651
+ /// \brief The arc with the given ID.
652
+ ///
653
+ /// Returns the arc with the given ID.
654
+ /// \pre The argument should be a valid arc ID in the graph.
655
+ Arc arcFromId(int) const { return INVALID; }
656
+
657
+ /// \brief An upper bound on the node IDs.
658
+ ///
659
+ /// Returns an upper bound on the node IDs.
660
+ int maxNodeId() const { return -1; }
661
+
662
+ /// \brief An upper bound on the edge IDs.
663
+ ///
664
+ /// Returns an upper bound on the edge IDs.
665
+ int maxEdgeId() const { return -1; }
666
+
667
+ /// \brief An upper bound on the arc IDs.
668
+ ///
669
+ /// Returns an upper bound on the arc IDs.
670
+ int maxArcId() const { return -1; }
671
+
672
+ /// \brief The direction of the arc.
673
+ ///
674
+ /// Returns \c true if the direction of the given arc is the same as
675
+ /// the inherent orientation of the represented edge.
676
+ bool direction(Arc) const { return true; }
677
+
678
+ /// \brief Direct the edge.
679
+ ///
680
+ /// Direct the given edge. The returned arc
681
+ /// represents the given edge and its direction comes
682
+ /// from the bool parameter. If it is \c true, then the direction
683
+ /// of the arc is the same as the inherent orientation of the edge.
684
+ Arc direct(Edge, bool) const {
685
+ return INVALID;
686
+ }
687
+
688
+ /// \brief Direct the edge.
689
+ ///
690
+ /// Direct the given edge. The returned arc represents the given
691
+ /// edge and its source node is the given node.
692
+ Arc direct(Edge, Node) const {
693
+ return INVALID;
694
+ }
695
+
696
+ /// \brief The oppositely directed arc.
697
+ ///
698
+ /// Returns the oppositely directed arc representing the same edge.
699
+ Arc oppositeArc(Arc) const { return INVALID; }
700
+
701
+ /// \brief The opposite node on the edge.
702
+ ///
703
+ /// Returns the opposite node on the given edge.
704
+ Node oppositeNode(Node, Edge) const { return INVALID; }
705
+
706
+ void first(Node&) const {}
707
+ void next(Node&) const {}
708
+
709
+ void first(Edge&) const {}
710
+ void next(Edge&) const {}
711
+
712
+ void first(Arc&) const {}
713
+ void next(Arc&) const {}
714
+
715
+ void firstOut(Arc&, Node) const {}
716
+ void nextOut(Arc&) const {}
717
+
718
+ void firstIn(Arc&, Node) const {}
719
+ void nextIn(Arc&) const {}
720
+
721
+ void firstInc(Edge &, bool &, const Node &) const {}
722
+ void nextInc(Edge &, bool &) const {}
723
+
724
+ // The second parameter is dummy.
725
+ Node fromId(int, Node) const { return INVALID; }
726
+ // The second parameter is dummy.
727
+ Edge fromId(int, Edge) const { return INVALID; }
728
+ // The second parameter is dummy.
729
+ Arc fromId(int, Arc) const { return INVALID; }
730
+
731
+ // Dummy parameter.
732
+ int maxId(Node) const { return -1; }
733
+ // Dummy parameter.
734
+ int maxId(Edge) const { return -1; }
735
+ // Dummy parameter.
736
+ int maxId(Arc) const { return -1; }
737
+
738
+ /// \brief The base node of the iterator.
739
+ ///
740
+ /// Returns the base node of the given incident edge iterator.
741
+ Node baseNode(IncEdgeIt) const { return INVALID; }
742
+
743
+ /// \brief The running node of the iterator.
744
+ ///
745
+ /// Returns the running node of the given incident edge iterator.
746
+ Node runningNode(IncEdgeIt) const { return INVALID; }
747
+
748
+ /// \brief The base node of the iterator.
749
+ ///
750
+ /// Returns the base node of the given outgoing arc iterator
751
+ /// (i.e. the source node of the corresponding arc).
752
+ Node baseNode(OutArcIt) const { return INVALID; }
753
+
754
+ /// \brief The running node of the iterator.
755
+ ///
756
+ /// Returns the running node of the given outgoing arc iterator
757
+ /// (i.e. the target node of the corresponding arc).
758
+ Node runningNode(OutArcIt) const { return INVALID; }
759
+
760
+ /// \brief The base node of the iterator.
761
+ ///
762
+ /// Returns the base node of the given incoming arc iterator
763
+ /// (i.e. the target node of the corresponding arc).
764
+ Node baseNode(InArcIt) const { return INVALID; }
765
+
766
+ /// \brief The running node of the iterator.
767
+ ///
768
+ /// Returns the running node of the given incoming arc iterator
769
+ /// (i.e. the source node of the corresponding arc).
770
+ Node runningNode(InArcIt) const { return INVALID; }
771
+
772
+ template <typename _Graph>
773
+ struct Constraints {
774
+ void constraints() {
775
+ checkConcept<BaseGraphComponent, _Graph>();
776
+ checkConcept<IterableGraphComponent<>, _Graph>();
777
+ checkConcept<IDableGraphComponent<>, _Graph>();
778
+ checkConcept<MappableGraphComponent<>, _Graph>();
779
+ }
780
+ };
781
+
782
+ };
783
+
784
+ }
785
+
786
+ }
787
+
788
+ #endif