Distribute Doxyfile.in and lemon.pc.in.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
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
19 #ifndef LEMON_CONCEPT_GRAPH_H
20 #define LEMON_CONCEPT_GRAPH_H
22 ///\ingroup graph_concepts
24 ///\brief Declaration of Graph.
26 #include <lemon/bits/invalid.h>
27 #include <lemon/bits/utility.h>
28 #include <lemon/concept/maps.h>
29 #include <lemon/concept_check.h>
30 #include <lemon/concept/graph_component.h>
36 /**************** The full-featured graph concepts ****************/
39 // \brief Modular static graph class.
41 // It should be the same as the \c Graph class.
43 : virtual public BaseGraphComponent,
44 public IterableGraphComponent, public MappableGraphComponent {
47 typedef BaseGraphComponent::Node Node;
48 typedef BaseGraphComponent::Edge Edge;
50 template <typename _Graph>
53 checkConcept<IterableGraphComponent, _Graph>();
54 checkConcept<MappableGraphComponent, _Graph>();
59 /// \addtogroup graph_concepts
62 /// The directed graph concept
64 /// This class describes the \ref concept "concept" of the
65 /// immutable directed graphs.
67 /// Note that actual graph implementation like @ref ListGraph or
68 /// @ref SmartGraph may have several additional functionality.
75 /// Defalult constructor.
77 /// Defalult constructor.
81 /// The base type of node iterators,
82 /// or in other words, the trivial node iterator.
84 /// This is the base type of each node iterator,
85 /// thus each kind of node iterator converts to this.
86 /// More precisely each kind of node iterator should be inherited
87 /// from the trivial node iterator.
90 /// Default constructor
92 /// @warning The default constructor sets the iterator
93 /// to an undefined value.
101 /// Invalid constructor \& conversion.
103 /// This constructor initializes the iterator to be invalid.
104 /// \sa Invalid for more details.
106 /// Equality operator
108 /// Two iterators are equal if and only if they point to the
109 /// same object or both are invalid.
110 bool operator==(Node) const { return true; }
112 /// Inequality operator
114 /// \sa operator==(Node n)
116 bool operator!=(Node) const { return true; }
118 /// Artificial ordering operator.
120 /// To allow the use of graph descriptors as key type in std::map or
121 /// similar associative container we require this.
123 /// \note This operator only have to define some strict ordering of
124 /// the items; this order has nothing to do with the iteration
125 /// ordering of the items.
127 /// \bug This is a technical requirement. Do we really need this?
128 bool operator<(Node) const { return false; }
132 /// This iterator goes through each node.
134 /// This iterator goes through each node.
135 /// Its usage is quite simple, for example you can count the number
136 /// of nodes in graph \c g of type \c Graph like this:
139 /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
141 class NodeIt : public Node {
143 /// Default constructor
145 /// @warning The default constructor sets the iterator
146 /// to an undefined value.
148 /// Copy constructor.
150 /// Copy constructor.
152 NodeIt(const NodeIt& n) : Node(n) { }
153 /// Invalid constructor \& conversion.
155 /// Initialize the iterator to be invalid.
156 /// \sa Invalid for more details.
158 /// Sets the iterator to the first node.
160 /// Sets the iterator to the first node of \c g.
162 NodeIt(const Graph&) { }
163 /// Node -> NodeIt conversion.
165 /// Sets the iterator to the node of \c the graph pointed by
166 /// the trivial iterator.
167 /// This feature necessitates that each time we
168 /// iterate the edge-set, the iteration order is the same.
169 NodeIt(const Graph&, const Node&) { }
172 /// Assign the iterator to the next node.
174 NodeIt& operator++() { return *this; }
178 /// The base type of the edge iterators.
180 /// The base type of the edge iterators.
184 /// Default constructor
186 /// @warning The default constructor sets the iterator
187 /// to an undefined value.
189 /// Copy constructor.
191 /// Copy constructor.
193 Edge(const Edge&) { }
194 /// Initialize the iterator to be invalid.
196 /// Initialize the iterator to be invalid.
199 /// Equality operator
201 /// Two iterators are equal if and only if they point to the
202 /// same object or both are invalid.
203 bool operator==(Edge) const { return true; }
204 /// Inequality operator
206 /// \sa operator==(Edge n)
208 bool operator!=(Edge) const { return true; }
210 /// Artificial ordering operator.
212 /// To allow the use of graph descriptors as key type in std::map or
213 /// similar associative container we require this.
215 /// \note This operator only have to define some strict ordering of
216 /// the items; this order has nothing to do with the iteration
217 /// ordering of the items.
219 /// \bug This is a technical requirement. Do we really need this?
220 bool operator<(Edge) const { return false; }
223 /// This iterator goes trough the outgoing edges of a node.
225 /// This iterator goes trough the \e outgoing edges of a certain node
227 /// Its usage is quite simple, for example you can count the number
228 /// of outgoing edges of a node \c n
229 /// in graph \c g of type \c Graph as follows.
232 /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
235 class OutEdgeIt : public Edge {
237 /// Default constructor
239 /// @warning The default constructor sets the iterator
240 /// to an undefined value.
242 /// Copy constructor.
244 /// Copy constructor.
246 OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
247 /// Initialize the iterator to be invalid.
249 /// Initialize the iterator to be invalid.
251 OutEdgeIt(Invalid) { }
252 /// This constructor sets the iterator to the first outgoing edge.
254 /// This constructor sets the iterator to the first outgoing edge of
256 OutEdgeIt(const Graph&, const Node&) { }
257 /// Edge -> OutEdgeIt conversion
259 /// Sets the iterator to the value of the trivial iterator.
260 /// This feature necessitates that each time we
261 /// iterate the edge-set, the iteration order is the same.
262 OutEdgeIt(const Graph&, const Edge&) { }
263 ///Next outgoing edge
265 /// Assign the iterator to the next
266 /// outgoing edge of the corresponding node.
267 OutEdgeIt& operator++() { return *this; }
270 /// This iterator goes trough the incoming edges of a node.
272 /// This iterator goes trough the \e incoming edges of a certain node
274 /// Its usage is quite simple, for example you can count the number
275 /// of outgoing edges of a node \c n
276 /// in graph \c g of type \c Graph as follows.
279 /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
282 class InEdgeIt : public Edge {
284 /// Default constructor
286 /// @warning The default constructor sets the iterator
287 /// to an undefined value.
289 /// Copy constructor.
291 /// Copy constructor.
293 InEdgeIt(const InEdgeIt& e) : Edge(e) { }
294 /// Initialize the iterator to be invalid.
296 /// Initialize the iterator to be invalid.
298 InEdgeIt(Invalid) { }
299 /// This constructor sets the iterator to first incoming edge.
301 /// This constructor set the iterator to the first incoming edge of
303 InEdgeIt(const Graph&, const Node&) { }
304 /// Edge -> InEdgeIt conversion
306 /// Sets the iterator to the value of the trivial iterator \c e.
307 /// This feature necessitates that each time we
308 /// iterate the edge-set, the iteration order is the same.
309 InEdgeIt(const Graph&, const Edge&) { }
310 /// Next incoming edge
312 /// Assign the iterator to the next inedge of the corresponding node.
314 InEdgeIt& operator++() { return *this; }
316 /// This iterator goes through each edge.
318 /// This iterator goes through each edge of a graph.
319 /// Its usage is quite simple, for example you can count the number
320 /// of edges in a graph \c g of type \c Graph as follows:
323 /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
325 class EdgeIt : public Edge {
327 /// Default constructor
329 /// @warning The default constructor sets the iterator
330 /// to an undefined value.
332 /// Copy constructor.
334 /// Copy constructor.
336 EdgeIt(const EdgeIt& e) : Edge(e) { }
337 /// Initialize the iterator to be invalid.
339 /// Initialize the iterator to be invalid.
342 /// This constructor sets the iterator to the first edge.
344 /// This constructor sets the iterator to the first edge of \c g.
345 ///@param g the graph
346 EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); }
347 /// Edge -> EdgeIt conversion
349 /// Sets the iterator to the value of the trivial iterator \c e.
350 /// This feature necessitates that each time we
351 /// iterate the edge-set, the iteration order is the same.
352 EdgeIt(const Graph&, const Edge&) { }
355 /// Assign the iterator to the next edge.
356 EdgeIt& operator++() { return *this; }
358 ///Gives back the target node of an edge.
360 ///Gives back the target node of an edge.
362 Node target(Edge) const { return INVALID; }
363 ///Gives back the source node of an edge.
365 ///Gives back the source node of an edge.
367 Node source(Edge) const { return INVALID; }
369 void first(Node&) const {}
370 void next(Node&) const {}
372 void first(Edge&) const {}
373 void next(Edge&) const {}
376 void firstIn(Edge&, const Node&) const {}
377 void nextIn(Edge&) const {}
379 void firstOut(Edge&, const Node&) const {}
380 void nextOut(Edge&) const {}
382 /// \brief The base node of the iterator.
384 /// Gives back the base node of the iterator.
385 /// It is always the target of the pointed edge.
386 Node baseNode(const InEdgeIt&) const { return INVALID; }
388 /// \brief The running node of the iterator.
390 /// Gives back the running node of the iterator.
391 /// It is always the source of the pointed edge.
392 Node runningNode(const InEdgeIt&) const { return INVALID; }
394 /// \brief The base node of the iterator.
396 /// Gives back the base node of the iterator.
397 /// It is always the source of the pointed edge.
398 Node baseNode(const OutEdgeIt&) const { return INVALID; }
400 /// \brief The running node of the iterator.
402 /// Gives back the running node of the iterator.
403 /// It is always the target of the pointed edge.
404 Node runningNode(const OutEdgeIt&) const { return INVALID; }
406 /// \brief The opposite node on the given edge.
408 /// Gives back the opposite node on the given edge.
409 Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
411 /// \brief Read write map of the nodes to type \c T.
413 /// ReadWrite map of the nodes to type \c T.
415 /// \warning Making maps that can handle bool type (NodeMap<bool>)
416 /// needs some extra attention!
417 /// \todo Wrong documentation
419 class NodeMap : public ReadWriteMap< Node, T >
424 NodeMap(const Graph&) { }
426 NodeMap(const Graph&, T) { }
429 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
430 ///Assignment operator
431 NodeMap& operator=(const NodeMap&) { return *this; }
432 // \todo fix this concept
435 /// \brief Read write map of the edges to type \c T.
437 /// Reference map of the edges to type \c T.
439 /// \warning Making maps that can handle bool type (EdgeMap<bool>)
440 /// needs some extra attention!
441 /// \todo Wrong documentation
443 class EdgeMap : public ReadWriteMap<Edge,T>
448 EdgeMap(const Graph&) { }
450 EdgeMap(const Graph&, T) { }
452 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
453 ///Assignment operator
454 EdgeMap& operator=(const EdgeMap&) { return *this; }
455 // \todo fix this concept
458 template <typename RGraph>
459 struct Constraints : public _Graph::Constraints<RGraph> {};
464 } //namespace concept
469 #endif // LEMON_CONCEPT_GRAPH_H