1.1 --- a/Makefile.am Tue Oct 24 16:49:41 2006 +0000
1.2 +++ b/Makefile.am Tue Oct 24 17:19:16 2006 +0000
1.3 @@ -13,7 +13,7 @@
1.4 pkgconfigdir = $(libdir)/pkgconfig
1.5 lemondir = $(pkgincludedir)
1.6 bitsdir = $(lemondir)/bits
1.7 -conceptdir = $(lemondir)/concept
1.8 +conceptdir = $(lemondir)/concepts
1.9 pkgconfig_DATA =
1.10 lib_LTLIBRARIES =
1.11 lemon_HEADERS =
2.1 --- a/doc/graphs.dox Tue Oct 24 16:49:41 2006 +0000
2.2 +++ b/doc/graphs.dox Tue Oct 24 17:19:16 2006 +0000
2.3 @@ -11,29 +11,29 @@
2.4 functionalities to list the nodes and the edges of the graph as well
2.5 as incoming and outgoing edges of a given node.
2.6
2.7 -Each graph should meet the \ref lemon::concept::Graph "Graph" concept.
2.8 +Each graph should meet the \ref lemon::concepts::Graph "Graph" concept.
2.9 This concept does not make it possible to change the graph (i.e. it is
2.10 not possible to add or delete edges or nodes). Most of the graph
2.11 algorithms will run on these graphs.
2.12
2.13
2.14 In case of graphs meeting the full feature
2.15 -\ref lemon::concept::ErasableGraph "ErasableGraph"
2.16 +\ref lemon::concepts::ErasableGraph "ErasableGraph"
2.17 concept
2.18 you can also erase individual edges and nodes in arbitrary order.
2.19
2.20 The implemented graph structures are the following.
2.21 \li \ref lemon::ListGraph "ListGraph" is the most versatile graph class. It meets
2.22 -the \ref lemon::concept::ErasableGraph "ErasableGraph" concept
2.23 +the \ref lemon::concepts::ErasableGraph "ErasableGraph" concept
2.24 and it also has some convenient extra features.
2.25 \li \ref lemon::SmartGraph "SmartGraph" is a more memory
2.26 efficient version of \ref lemon::ListGraph "ListGraph". The
2.27 price of this is that it only meets the
2.28 -\ref lemon::concept::ExtendableGraph "ExtendableGraph" concept,
2.29 +\ref lemon::concepts::ExtendableGraph "ExtendableGraph" concept,
2.30 so you cannot delete individual edges or nodes.
2.31 \li \ref lemon::FullGraph "FullGraph"
2.32 implements a complete graph. It is a
2.33 -\ref lemon::concept::Graph "Graph", so you cannot
2.34 +\ref lemon::concepts::Graph "Graph", so you cannot
2.35 change the number of nodes once it is constructed. It is extremely memory
2.36 efficient: it uses constant amount of memory independently from the number of
2.37 the nodes of the graph. Of course, the size of the \ref maps-page "NodeMap"'s and
3.1 --- a/doc/groups.dox Tue Oct 24 16:49:41 2006 +0000
3.2 +++ b/doc/groups.dox Tue Oct 24 17:19:16 2006 +0000
3.3 @@ -76,7 +76,7 @@
3.4
3.5 Map adaptors are used to create "implicit" maps from other maps.
3.6
3.7 -Most of them are \ref lemon::concept::ReadMap "ReadMap"s. They can
3.8 +Most of them are \ref lemon::concepts::ReadMap "ReadMap"s. They can
3.9 make arithmetic operations between one or two maps (negation, scaling,
3.10 addition, multiplication etc.) or e.g. convert a map to another one
3.11 of different Value type.
3.12 @@ -102,7 +102,7 @@
3.13 using a standard Builder subclass. This make is easy to have e.g. the Dijkstra
3.14 algorithm to store its result in any kind of path structure.
3.15
3.16 -\sa lemon::concept::Path
3.17 +\sa lemon::concepts::Path
3.18
3.19 */
3.20
4.1 --- a/doc/maps.dox Tue Oct 24 16:49:41 2006 +0000
4.2 +++ b/doc/maps.dox Tue Oct 24 17:19:16 2006 +0000
4.3 @@ -13,11 +13,11 @@
4.4 \endcode
4.5
4.6 A map can be
4.7 -\e readable (\ref lemon::concept::ReadMap "ReadMap", for short),
4.8 -\e writable (\ref lemon::concept::WriteMap "WriteMap") or both
4.9 -(\ref lemon::concept::ReadWriteMap "ReadWriteMap").
4.10 +\e readable (\ref lemon::concepts::ReadMap "ReadMap", for short),
4.11 +\e writable (\ref lemon::concepts::WriteMap "WriteMap") or both
4.12 +(\ref lemon::concepts::ReadWriteMap "ReadWriteMap").
4.13 There also exists a special type of
4.14 -ReadWrite map called \ref lemon::concept::ReferenceMap "reference map".
4.15 +ReadWrite map called \ref lemon::concepts::ReferenceMap "reference map".
4.16 In addition that you can
4.17 read and write the values of a key, a reference map
4.18 can also give you a reference to the
5.1 --- a/doc/namespaces.dox Tue Oct 24 16:49:41 2006 +0000
5.2 +++ b/doc/namespaces.dox Tue Oct 24 17:19:16 2006 +0000
5.3 @@ -8,5 +8,5 @@
5.4
5.5 /// The namespace of LEMON concepts and concept checking classes
5.6 ///
5.7 - namespace concept {}
5.8 + namespace concepts {}
5.9 }
6.1 --- a/lemon/Makefile.am Tue Oct 24 16:49:41 2006 +0000
6.2 +++ b/lemon/Makefile.am Tue Oct 24 17:19:16 2006 +0000
6.3 @@ -121,11 +121,11 @@
6.4
6.5 concept_HEADERS += \
6.6 lemon/concept_check.h \
6.7 - lemon/concept/bpugraph.h \
6.8 - lemon/concept/graph.h \
6.9 - lemon/concept/graph_components.h \
6.10 - lemon/concept/heap.h \
6.11 - lemon/concept/maps.h \
6.12 - lemon/concept/matrix_maps.h \
6.13 - lemon/concept/path.h \
6.14 - lemon/concept/ugraph.h
6.15 + lemon/concepts/bpugraph.h \
6.16 + lemon/concepts/graph.h \
6.17 + lemon/concepts/graph_components.h \
6.18 + lemon/concepts/heap.h \
6.19 + lemon/concepts/maps.h \
6.20 + lemon/concepts/matrix_maps.h \
6.21 + lemon/concepts/path.h \
6.22 + lemon/concepts/ugraph.h
7.1 --- a/lemon/bellman_ford.h Tue Oct 24 16:49:41 2006 +0000
7.2 +++ b/lemon/bellman_ford.h Tue Oct 24 17:19:16 2006 +0000
7.3 @@ -92,7 +92,7 @@
7.4 /// \brief The type of the map that stores the edge lengths.
7.5 ///
7.6 /// The type of the map that stores the edge lengths.
7.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
7.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
7.9 typedef _LengthMap LengthMap;
7.10
7.11 // The type of the length of the edges.
7.12 @@ -110,7 +110,7 @@
7.13 ///
7.14 /// The type of the map that stores the last
7.15 /// edges of the shortest paths.
7.16 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
7.17 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
7.18 ///
7.19 typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
7.20
7.21 @@ -125,7 +125,7 @@
7.22 /// \brief The type of the map that stores the dists of the nodes.
7.23 ///
7.24 /// The type of the map that stores the dists of the nodes.
7.25 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
7.26 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
7.27 ///
7.28 typedef typename Graph::template NodeMap<typename _LengthMap::Value>
7.29 DistMap;
7.30 @@ -146,7 +146,7 @@
7.31 /// \ingroup flowalgs
7.32 /// This class provides an efficient implementation of \c Bellman-Ford
7.33 /// algorithm. The edge lengths are passed to the algorithm using a
7.34 - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any
7.35 + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any
7.36 /// kind of length.
7.37 ///
7.38 /// The Bellman-Ford algorithm solves the shortest path from one node
7.39 @@ -158,13 +158,13 @@
7.40 /// The maximal time complexity of the algorithm is \f$ O(ne) \f$.
7.41 ///
7.42 /// The type of the length is determined by the
7.43 - /// \ref concept::ReadMap::Value "Value" of the length map.
7.44 + /// \ref concepts::ReadMap::Value "Value" of the length map.
7.45 ///
7.46 /// \param _Graph The graph type the algorithm runs on. The default value
7.47 /// is \ref ListGraph. The value of _Graph is not used directly by
7.48 /// BellmanFord, it is only passed to \ref BellmanFordDefaultTraits.
7.49 /// \param _LengthMap This read-only EdgeMap determines the lengths of the
7.50 - /// edges. The default map type is \ref concept::Graph::EdgeMap
7.51 + /// edges. The default map type is \ref concepts::Graph::EdgeMap
7.52 /// "Graph::EdgeMap<int>". The value of _LengthMap is not used directly
7.53 /// by BellmanFord, it is only passed to \ref BellmanFordDefaultTraits.
7.54 /// \param _Traits Traits class to set various data types used by the
7.55 @@ -790,7 +790,7 @@
7.56 /// \brief The type of the map that stores the edge lengths.
7.57 ///
7.58 /// The type of the map that stores the edge lengths.
7.59 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
7.60 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
7.61 typedef _LengthMap LengthMap;
7.62
7.63 /// \brief The value type of the length map.
7.64 @@ -808,7 +808,7 @@
7.65 ///
7.66 /// The type of the map that stores the last
7.67 /// edges of the shortest paths.
7.68 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
7.69 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
7.70 typedef NullMap <typename _Graph::Node,typename _Graph::Edge> PredMap;
7.71
7.72 /// \brief Instantiates a PredMap.
7.73 @@ -820,7 +820,7 @@
7.74 /// \brief The type of the map that stores the dists of the nodes.
7.75 ///
7.76 /// The type of the map that stores the dists of the nodes.
7.77 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
7.78 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
7.79 typedef NullMap<typename Graph::Node, Value> DistMap;
7.80 /// \brief Instantiates a DistMap.
7.81 ///
8.1 --- a/lemon/bfs.h Tue Oct 24 16:49:41 2006 +0000
8.2 +++ b/lemon/bfs.h Tue Oct 24 17:19:16 2006 +0000
8.3 @@ -47,7 +47,7 @@
8.4 ///
8.5 ///The type of the map that stores the last
8.6 ///edges of the shortest paths.
8.7 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.8 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.9 ///
8.10 typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
8.11 ///Instantiates a PredMap.
8.12 @@ -62,7 +62,7 @@
8.13 ///The type of the map that indicates which nodes are processed.
8.14
8.15 ///The type of the map that indicates which nodes are processed.
8.16 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.17 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.18 ///\todo named parameter to set this type, function to read and write.
8.19 typedef NullMap<typename Graph::Node,bool> ProcessedMap;
8.20 ///Instantiates a ProcessedMap.
8.21 @@ -81,7 +81,7 @@
8.22 ///The type of the map that indicates which nodes are reached.
8.23
8.24 ///The type of the map that indicates which nodes are reached.
8.25 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.26 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.27 ///\todo named parameter to set this type, function to read and write.
8.28 typedef typename Graph::template NodeMap<bool> ReachedMap;
8.29 ///Instantiates a ReachedMap.
8.30 @@ -96,7 +96,7 @@
8.31 ///The type of the map that stores the dists of the nodes.
8.32
8.33 ///The type of the map that stores the dists of the nodes.
8.34 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.35 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.36 ///
8.37 typedef typename Graph::template NodeMap<int> DistMap;
8.38 ///Instantiates a DistMap.
8.39 @@ -705,7 +705,7 @@
8.40 ///
8.41 ///The type of the map that stores the last
8.42 ///edges of the shortest paths.
8.43 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.44 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.45 ///
8.46 typedef NullMap<typename Graph::Node,typename GR::Edge> PredMap;
8.47 ///Instantiates a PredMap.
8.48 @@ -725,7 +725,7 @@
8.49 ///The type of the map that indicates which nodes are processed.
8.50
8.51 ///The type of the map that indicates which nodes are processed.
8.52 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.53 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.54 ///\todo named parameter to set this type, function to read and write.
8.55 typedef NullMap<typename Graph::Node,bool> ProcessedMap;
8.56 ///Instantiates a ProcessedMap.
8.57 @@ -744,7 +744,7 @@
8.58 ///The type of the map that indicates which nodes are reached.
8.59
8.60 ///The type of the map that indicates which nodes are reached.
8.61 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.62 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.63 ///\todo named parameter to set this type, function to read and write.
8.64 typedef typename Graph::template NodeMap<bool> ReachedMap;
8.65 ///Instantiates a ReachedMap.
8.66 @@ -759,7 +759,7 @@
8.67 ///The type of the map that stores the dists of the nodes.
8.68
8.69 ///The type of the map that stores the dists of the nodes.
8.70 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
8.71 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
8.72 ///
8.73 typedef NullMap<typename Graph::Node,int> DistMap;
8.74 ///Instantiates a DistMap.
9.1 --- a/lemon/bits/array_map.h Tue Oct 24 16:49:41 2006 +0000
9.2 +++ b/lemon/bits/array_map.h Tue Oct 24 17:19:16 2006 +0000
9.3 @@ -24,7 +24,7 @@
9.4 #include <lemon/bits/traits.h>
9.5 #include <lemon/bits/alteration_notifier.h>
9.6 #include <lemon/concept_check.h>
9.7 -#include <lemon/concept/maps.h>
9.8 +#include <lemon/concepts/maps.h>
9.9
9.10 /// \ingroup graphbits
9.11 /// \file
9.12 @@ -141,7 +141,7 @@
9.13 /// is assigned by the value of the given ReadMap.
9.14 template <typename CMap>
9.15 ArrayMap& operator=(const CMap& cmap) {
9.16 - checkConcept<concept::ReadMap<Key, _Value>, CMap>();
9.17 + checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
9.18 const typename Parent::Notifier* notifier = Parent::getNotifier();
9.19 Item it;
9.20 for (notifier->first(it); it != INVALID; notifier->next(it)) {
10.1 --- a/lemon/bits/base_extender.h Tue Oct 24 16:49:41 2006 +0000
10.2 +++ b/lemon/bits/base_extender.h Tue Oct 24 17:19:16 2006 +0000
10.3 @@ -26,7 +26,7 @@
10.4 #include <lemon/bits/default_map.h>
10.5
10.6 #include <lemon/concept_check.h>
10.7 -#include <lemon/concept/maps.h>
10.8 +#include <lemon/concepts/maps.h>
10.9
10.10 ///\ingroup graphbits
10.11 ///\file
11.1 --- a/lemon/bits/debug_map.h Tue Oct 24 16:49:41 2006 +0000
11.2 +++ b/lemon/bits/debug_map.h Tue Oct 24 17:19:16 2006 +0000
11.3 @@ -29,7 +29,7 @@
11.4 #include <lemon/bits/alteration_notifier.h>
11.5
11.6 #include <lemon/concept_check.h>
11.7 -#include <lemon/concept/maps.h>
11.8 +#include <lemon/concepts/maps.h>
11.9
11.10 ///\ingroup graphbits
11.11 ///
11.12 @@ -186,7 +186,7 @@
11.13 /// is assigned by the value of the given ReadMap.
11.14 template <typename CMap>
11.15 DebugMap& operator=(const CMap& cmap) {
11.16 - checkConcept<concept::ReadMap<Key, _Value>, CMap>();
11.17 + checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
11.18 const typename Parent::Notifier* notifier = Parent::getNotifier();
11.19 Item it;
11.20 for (notifier->first(it); it != INVALID; notifier->next(it)) {
12.1 --- a/lemon/bits/graph_extender.h Tue Oct 24 16:49:41 2006 +0000
12.2 +++ b/lemon/bits/graph_extender.h Tue Oct 24 17:19:16 2006 +0000
12.3 @@ -26,7 +26,7 @@
12.4 #include <lemon/bits/default_map.h>
12.5
12.6 #include <lemon/concept_check.h>
12.7 -#include <lemon/concept/maps.h>
12.8 +#include <lemon/concepts/maps.h>
12.9
12.10 ///\ingroup graphbits
12.11 ///\file
12.12 @@ -1128,7 +1128,7 @@
12.13
12.14 template <typename CMap>
12.15 NodeMap& operator=(const CMap& cmap) {
12.16 - checkConcept<concept::ReadMap<Node, _Value>, CMap>();
12.17 + checkConcept<concepts::ReadMap<Node, _Value>, CMap>();
12.18 aNodeMap = cmap;
12.19 bNodeMap = cmap;
12.20 return *this;
13.1 --- a/lemon/bits/map_extender.h Tue Oct 24 16:49:41 2006 +0000
13.2 +++ b/lemon/bits/map_extender.h Tue Oct 24 17:19:16 2006 +0000
13.3 @@ -24,7 +24,7 @@
13.4 #include <lemon/bits/traits.h>
13.5
13.6 #include <lemon/concept_check.h>
13.7 -#include <lemon/concept/maps.h>
13.8 +#include <lemon/concepts/maps.h>
13.9
13.10 ///\file
13.11 ///\brief Extenders for iterable maps.
13.12 @@ -206,7 +206,7 @@
13.13
13.14 template <typename CMap>
13.15 SubMapExtender& operator=(const CMap& cmap) {
13.16 - checkConcept<concept::ReadMap<Key, Value>, CMap>();
13.17 + checkConcept<concepts::ReadMap<Key, Value>, CMap>();
13.18 Item it;
13.19 for (graph.first(it); it != INVALID; graph.next(it)) {
13.20 Parent::set(it, cmap[it]);
14.1 --- a/lemon/bits/vector_map.h Tue Oct 24 16:49:41 2006 +0000
14.2 +++ b/lemon/bits/vector_map.h Tue Oct 24 17:19:16 2006 +0000
14.3 @@ -28,7 +28,7 @@
14.4 #include <lemon/bits/alteration_notifier.h>
14.5
14.6 #include <lemon/concept_check.h>
14.7 -#include <lemon/concept/maps.h>
14.8 +#include <lemon/concepts/maps.h>
14.9
14.10 ///\ingroup graphbits
14.11 ///
14.12 @@ -133,7 +133,7 @@
14.13 /// is assigned by the value of the given ReadMap.
14.14 template <typename CMap>
14.15 VectorMap& operator=(const CMap& cmap) {
14.16 - checkConcept<concept::ReadMap<Key, _Value>, CMap>();
14.17 + checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
14.18 const typename Parent::Notifier* notifier = Parent::getNotifier();
14.19 Item it;
14.20 for (notifier->first(it); it != INVALID; notifier->next(it)) {
15.1 --- a/lemon/color.h Tue Oct 24 16:49:41 2006 +0000
15.2 +++ b/lemon/color.h Tue Oct 24 17:19:16 2006 +0000
15.3 @@ -100,7 +100,7 @@
15.4 ///to each <tt>int</tt>. It is possible to change the colors as well as their
15.5 ///number. The integer range is cyclically mapped to the provided set of colors.
15.6 ///
15.7 -///This is a true \ref concept::ReferenceMap "reference map", so you can also
15.8 +///This is a true \ref concepts::ReferenceMap "reference map", so you can also
15.9 ///change the actual colors.
15.10
15.11 class Palette : public MapBase<int,Color>
16.1 --- a/lemon/concept/bpugraph.h Tue Oct 24 16:49:41 2006 +0000
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,1020 +0,0 @@
16.4 -/* -*- C++ -*-
16.5 - *
16.6 - * This file is a part of LEMON, a generic C++ optimization library
16.7 - *
16.8 - * Copyright (C) 2003-2006
16.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
16.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
16.11 - *
16.12 - * Permission to use, modify and distribute this software is granted
16.13 - * provided that this copyright notice appears in all copies. For
16.14 - * precise terms see the accompanying LICENSE file.
16.15 - *
16.16 - * This software is provided "AS IS" with no warranty of any kind,
16.17 - * express or implied, and with no claim as to its suitability for any
16.18 - * purpose.
16.19 - *
16.20 - */
16.21 -
16.22 -/// \ingroup graph_concepts
16.23 -/// \file
16.24 -/// \brief Undirected bipartite graphs and components of.
16.25 -
16.26 -
16.27 -#ifndef LEMON_CONCEPT_BPUGRAPH_H
16.28 -#define LEMON_CONCEPT_BPUGRAPH_H
16.29 -
16.30 -#include <lemon/concept/graph_components.h>
16.31 -
16.32 -#include <lemon/concept/graph.h>
16.33 -#include <lemon/concept/ugraph.h>
16.34 -
16.35 -#include <lemon/bits/utility.h>
16.36 -
16.37 -namespace lemon {
16.38 - namespace concept {
16.39 -
16.40 - /// \addtogroup graph_concepts
16.41 - /// @{
16.42 -
16.43 -
16.44 - /// \brief Class describing the concept of Bipartite Undirected Graphs.
16.45 - ///
16.46 - /// This class describes the common interface of all
16.47 - /// Undirected Bipartite Graphs.
16.48 - ///
16.49 - /// As all concept describing classes it provides only interface
16.50 - /// without any sensible implementation. So any algorithm for
16.51 - /// bipartite undirected graph should compile with this class, but it
16.52 - /// will not run properly, of course.
16.53 - ///
16.54 - /// In LEMON bipartite undirected graphs also fulfill the concept of
16.55 - /// the undirected graphs (\ref lemon::concept::UGraph "UGraph Concept").
16.56 - ///
16.57 - /// You can assume that all undirected bipartite graph can be handled
16.58 - /// as an undirected graph and consequently as a static graph.
16.59 - ///
16.60 - /// The bipartite graph stores two types of nodes which are named
16.61 - /// ANode and BNode. The graph type contains two types ANode and
16.62 - /// BNode which are inherited from Node type. Moreover they have
16.63 - /// constructor which converts Node to either ANode or BNode when
16.64 - /// it is possible. Therefor everywhere the Node type can be used
16.65 - /// instead of ANode and BNode. So the usage of the ANode and
16.66 - /// BNode is not suggested.
16.67 - ///
16.68 - /// The iteration on the partition can be done with the ANodeIt and
16.69 - /// BNodeIt classes. The node map can be used to map values to the nodes
16.70 - /// and similarly we can use to map values for just the ANodes and
16.71 - /// BNodes the ANodeMap and BNodeMap template classes.
16.72 -
16.73 - class BpUGraph {
16.74 - public:
16.75 - /// \brief The undirected graph should be tagged by the
16.76 - /// UndirectedTag.
16.77 - ///
16.78 - /// The undirected graph should be tagged by the UndirectedTag. This
16.79 - /// tag helps the enable_if technics to make compile time
16.80 - /// specializations for undirected graphs.
16.81 - typedef True UndirectedTag;
16.82 -
16.83 - /// \brief The base type of node iterators,
16.84 - /// or in other words, the trivial node iterator.
16.85 - ///
16.86 - /// This is the base type of each node iterator,
16.87 - /// thus each kind of node iterator converts to this.
16.88 - /// More precisely each kind of node iterator should be inherited
16.89 - /// from the trivial node iterator. The Node class represents
16.90 - /// both of two types of nodes.
16.91 - class Node {
16.92 - public:
16.93 - /// Default constructor
16.94 -
16.95 - /// @warning The default constructor sets the iterator
16.96 - /// to an undefined value.
16.97 - Node() { }
16.98 - /// Copy constructor.
16.99 -
16.100 - /// Copy constructor.
16.101 - ///
16.102 - Node(const Node&) { }
16.103 -
16.104 - /// Invalid constructor \& conversion.
16.105 -
16.106 - /// This constructor initializes the iterator to be invalid.
16.107 - /// \sa Invalid for more details.
16.108 - Node(Invalid) { }
16.109 - /// Equality operator
16.110 -
16.111 - /// Two iterators are equal if and only if they point to the
16.112 - /// same object or both are invalid.
16.113 - bool operator==(Node) const { return true; }
16.114 -
16.115 - /// Inequality operator
16.116 -
16.117 - /// \sa operator==(Node n)
16.118 - ///
16.119 - bool operator!=(Node) const { return true; }
16.120 -
16.121 - /// Artificial ordering operator.
16.122 -
16.123 - /// To allow the use of graph descriptors as key type in std::map or
16.124 - /// similar associative container we require this.
16.125 - ///
16.126 - /// \note This operator only have to define some strict ordering of
16.127 - /// the items; this order has nothing to do with the iteration
16.128 - /// ordering of the items.
16.129 - bool operator<(Node) const { return false; }
16.130 -
16.131 - };
16.132 -
16.133 - /// \brief Helper class for ANodes.
16.134 - ///
16.135 - /// This class is just a helper class for ANodes, it is not
16.136 - /// suggested to use it directly. It can be converted easily to
16.137 - /// node and vice versa. The usage of this class is limited
16.138 - /// to use just as template parameters for special map types.
16.139 - class ANode : public Node {
16.140 - public:
16.141 - /// Default constructor
16.142 -
16.143 - /// @warning The default constructor sets the iterator
16.144 - /// to an undefined value.
16.145 - ANode() : Node() { }
16.146 - /// Copy constructor.
16.147 -
16.148 - /// Copy constructor.
16.149 - ///
16.150 - ANode(const ANode&) : Node() { }
16.151 -
16.152 - /// Construct the same node as ANode.
16.153 -
16.154 - /// Construct the same node as ANode. It may throws assertion
16.155 - /// when the given node is from the BNode set.
16.156 - ANode(const Node&) : Node() { }
16.157 -
16.158 - /// Assign node to A-node.
16.159 -
16.160 - /// Besides the core graph item functionality each node should
16.161 - /// be convertible to the represented A-node if it is it possible.
16.162 - ANode& operator=(const Node&) { return *this; }
16.163 -
16.164 - /// Invalid constructor \& conversion.
16.165 -
16.166 - /// This constructor initializes the iterator to be invalid.
16.167 - /// \sa Invalid for more details.
16.168 - ANode(Invalid) { }
16.169 - /// Equality operator
16.170 -
16.171 - /// Two iterators are equal if and only if they point to the
16.172 - /// same object or both are invalid.
16.173 - bool operator==(ANode) const { return true; }
16.174 -
16.175 - /// Inequality operator
16.176 -
16.177 - /// \sa operator==(ANode n)
16.178 - ///
16.179 - bool operator!=(ANode) const { return true; }
16.180 -
16.181 - /// Artificial ordering operator.
16.182 -
16.183 - /// To allow the use of graph descriptors as key type in std::map or
16.184 - /// similar associative container we require this.
16.185 - ///
16.186 - /// \note This operator only have to define some strict ordering of
16.187 - /// the items; this order has nothing to do with the iteration
16.188 - /// ordering of the items.
16.189 - bool operator<(ANode) const { return false; }
16.190 -
16.191 - };
16.192 -
16.193 - /// \brief Helper class for BNodes.
16.194 - ///
16.195 - /// This class is just a helper class for BNodes, it is not
16.196 - /// suggested to use it directly. It can be converted easily to
16.197 - /// node and vice versa. The usage of this class is limited
16.198 - /// to use just as template parameters for special map types.
16.199 - class BNode : public Node {
16.200 - public:
16.201 - /// Default constructor
16.202 -
16.203 - /// @warning The default constructor sets the iterator
16.204 - /// to an undefined value.
16.205 - BNode() : Node() { }
16.206 - /// Copy constructor.
16.207 -
16.208 - /// Copy constructor.
16.209 - ///
16.210 - BNode(const BNode&) : Node() { }
16.211 -
16.212 - /// Construct the same node as BNode.
16.213 -
16.214 - /// Construct the same node as BNode. It may throws assertion
16.215 - /// when the given node is from the ANode set.
16.216 - BNode(const Node&) : Node() { }
16.217 -
16.218 - /// Assign node to B-node.
16.219 -
16.220 - /// Besides the core graph item functionality each node should
16.221 - /// be convertible to the represented B-node if it is it possible.
16.222 - BNode& operator=(const Node&) { return *this; }
16.223 -
16.224 - /// Invalid constructor \& conversion.
16.225 -
16.226 - /// This constructor initializes the iterator to be invalid.
16.227 - /// \sa Invalid for more details.
16.228 - BNode(Invalid) { }
16.229 - /// Equality operator
16.230 -
16.231 - /// Two iterators are equal if and only if they point to the
16.232 - /// same object or both are invalid.
16.233 - bool operator==(BNode) const { return true; }
16.234 -
16.235 - /// Inequality operator
16.236 -
16.237 - /// \sa operator==(BNode n)
16.238 - ///
16.239 - bool operator!=(BNode) const { return true; }
16.240 -
16.241 - /// Artificial ordering operator.
16.242 -
16.243 - /// To allow the use of graph descriptors as key type in std::map or
16.244 - /// similar associative container we require this.
16.245 - ///
16.246 - /// \note This operator only have to define some strict ordering of
16.247 - /// the items; this order has nothing to do with the iteration
16.248 - /// ordering of the items.
16.249 - bool operator<(BNode) const { return false; }
16.250 -
16.251 - };
16.252 -
16.253 - /// This iterator goes through each node.
16.254 -
16.255 - /// This iterator goes through each node.
16.256 - /// Its usage is quite simple, for example you can count the number
16.257 - /// of nodes in graph \c g of type \c Graph like this:
16.258 - ///\code
16.259 - /// int count=0;
16.260 - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
16.261 - ///\endcode
16.262 - class NodeIt : public Node {
16.263 - public:
16.264 - /// Default constructor
16.265 -
16.266 - /// @warning The default constructor sets the iterator
16.267 - /// to an undefined value.
16.268 - NodeIt() { }
16.269 - /// Copy constructor.
16.270 -
16.271 - /// Copy constructor.
16.272 - ///
16.273 - NodeIt(const NodeIt& n) : Node(n) { }
16.274 - /// Invalid constructor \& conversion.
16.275 -
16.276 - /// Initialize the iterator to be invalid.
16.277 - /// \sa Invalid for more details.
16.278 - NodeIt(Invalid) { }
16.279 - /// Sets the iterator to the first node.
16.280 -
16.281 - /// Sets the iterator to the first node of \c g.
16.282 - ///
16.283 - NodeIt(const BpUGraph&) { }
16.284 - /// Node -> NodeIt conversion.
16.285 -
16.286 - /// Sets the iterator to the node of \c the graph pointed by
16.287 - /// the trivial iterator.
16.288 - /// This feature necessitates that each time we
16.289 - /// iterate the edge-set, the iteration order is the same.
16.290 - NodeIt(const BpUGraph&, const Node&) { }
16.291 - /// Next node.
16.292 -
16.293 - /// Assign the iterator to the next node.
16.294 - ///
16.295 - NodeIt& operator++() { return *this; }
16.296 - };
16.297 -
16.298 - /// This iterator goes through each ANode.
16.299 -
16.300 - /// This iterator goes through each ANode.
16.301 - /// Its usage is quite simple, for example you can count the number
16.302 - /// of nodes in graph \c g of type \c Graph like this:
16.303 - ///\code
16.304 - /// int count=0;
16.305 - /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
16.306 - ///\endcode
16.307 - class ANodeIt : public Node {
16.308 - public:
16.309 - /// Default constructor
16.310 -
16.311 - /// @warning The default constructor sets the iterator
16.312 - /// to an undefined value.
16.313 - ANodeIt() { }
16.314 - /// Copy constructor.
16.315 -
16.316 - /// Copy constructor.
16.317 - ///
16.318 - ANodeIt(const ANodeIt& n) : Node(n) { }
16.319 - /// Invalid constructor \& conversion.
16.320 -
16.321 - /// Initialize the iterator to be invalid.
16.322 - /// \sa Invalid for more details.
16.323 - ANodeIt(Invalid) { }
16.324 - /// Sets the iterator to the first node.
16.325 -
16.326 - /// Sets the iterator to the first node of \c g.
16.327 - ///
16.328 - ANodeIt(const BpUGraph&) { }
16.329 - /// Node -> ANodeIt conversion.
16.330 -
16.331 - /// Sets the iterator to the node of \c the graph pointed by
16.332 - /// the trivial iterator.
16.333 - /// This feature necessitates that each time we
16.334 - /// iterate the edge-set, the iteration order is the same.
16.335 - ANodeIt(const BpUGraph&, const Node&) { }
16.336 - /// Next node.
16.337 -
16.338 - /// Assign the iterator to the next node.
16.339 - ///
16.340 - ANodeIt& operator++() { return *this; }
16.341 - };
16.342 -
16.343 - /// This iterator goes through each BNode.
16.344 -
16.345 - /// This iterator goes through each BNode.
16.346 - /// Its usage is quite simple, for example you can count the number
16.347 - /// of nodes in graph \c g of type \c Graph like this:
16.348 - ///\code
16.349 - /// int count=0;
16.350 - /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
16.351 - ///\endcode
16.352 - class BNodeIt : public Node {
16.353 - public:
16.354 - /// Default constructor
16.355 -
16.356 - /// @warning The default constructor sets the iterator
16.357 - /// to an undefined value.
16.358 - BNodeIt() { }
16.359 - /// Copy constructor.
16.360 -
16.361 - /// Copy constructor.
16.362 - ///
16.363 - BNodeIt(const BNodeIt& n) : Node(n) { }
16.364 - /// Invalid constructor \& conversion.
16.365 -
16.366 - /// Initialize the iterator to be invalid.
16.367 - /// \sa Invalid for more details.
16.368 - BNodeIt(Invalid) { }
16.369 - /// Sets the iterator to the first node.
16.370 -
16.371 - /// Sets the iterator to the first node of \c g.
16.372 - ///
16.373 - BNodeIt(const BpUGraph&) { }
16.374 - /// Node -> BNodeIt conversion.
16.375 -
16.376 - /// Sets the iterator to the node of \c the graph pointed by
16.377 - /// the trivial iterator.
16.378 - /// This feature necessitates that each time we
16.379 - /// iterate the edge-set, the iteration order is the same.
16.380 - BNodeIt(const BpUGraph&, const Node&) { }
16.381 - /// Next node.
16.382 -
16.383 - /// Assign the iterator to the next node.
16.384 - ///
16.385 - BNodeIt& operator++() { return *this; }
16.386 - };
16.387 -
16.388 -
16.389 - /// The base type of the undirected edge iterators.
16.390 -
16.391 - /// The base type of the undirected edge iterators.
16.392 - ///
16.393 - class UEdge {
16.394 - public:
16.395 - /// Default constructor
16.396 -
16.397 - /// @warning The default constructor sets the iterator
16.398 - /// to an undefined value.
16.399 - UEdge() { }
16.400 - /// Copy constructor.
16.401 -
16.402 - /// Copy constructor.
16.403 - ///
16.404 - UEdge(const UEdge&) { }
16.405 - /// Initialize the iterator to be invalid.
16.406 -
16.407 - /// Initialize the iterator to be invalid.
16.408 - ///
16.409 - UEdge(Invalid) { }
16.410 - /// Equality operator
16.411 -
16.412 - /// Two iterators are equal if and only if they point to the
16.413 - /// same object or both are invalid.
16.414 - bool operator==(UEdge) const { return true; }
16.415 - /// Inequality operator
16.416 -
16.417 - /// \sa operator==(UEdge n)
16.418 - ///
16.419 - bool operator!=(UEdge) const { return true; }
16.420 -
16.421 - /// Artificial ordering operator.
16.422 -
16.423 - /// To allow the use of graph descriptors as key type in std::map or
16.424 - /// similar associative container we require this.
16.425 - ///
16.426 - /// \note This operator only have to define some strict ordering of
16.427 - /// the items; this order has nothing to do with the iteration
16.428 - /// ordering of the items.
16.429 - bool operator<(UEdge) const { return false; }
16.430 - };
16.431 -
16.432 - /// This iterator goes through each undirected edge.
16.433 -
16.434 - /// This iterator goes through each undirected edge of a graph.
16.435 - /// Its usage is quite simple, for example you can count the number
16.436 - /// of undirected edges in a graph \c g of type \c Graph as follows:
16.437 - ///\code
16.438 - /// int count=0;
16.439 - /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
16.440 - ///\endcode
16.441 - class UEdgeIt : public UEdge {
16.442 - public:
16.443 - /// Default constructor
16.444 -
16.445 - /// @warning The default constructor sets the iterator
16.446 - /// to an undefined value.
16.447 - UEdgeIt() { }
16.448 - /// Copy constructor.
16.449 -
16.450 - /// Copy constructor.
16.451 - ///
16.452 - UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
16.453 - /// Initialize the iterator to be invalid.
16.454 -
16.455 - /// Initialize the iterator to be invalid.
16.456 - ///
16.457 - UEdgeIt(Invalid) { }
16.458 - /// This constructor sets the iterator to the first undirected edge.
16.459 -
16.460 - /// This constructor sets the iterator to the first undirected edge.
16.461 - UEdgeIt(const BpUGraph&) { }
16.462 - /// UEdge -> UEdgeIt conversion
16.463 -
16.464 - /// Sets the iterator to the value of the trivial iterator.
16.465 - /// This feature necessitates that each time we
16.466 - /// iterate the undirected edge-set, the iteration order is the
16.467 - /// same.
16.468 - UEdgeIt(const BpUGraph&, const UEdge&) { }
16.469 - /// Next undirected edge
16.470 -
16.471 - /// Assign the iterator to the next undirected edge.
16.472 - UEdgeIt& operator++() { return *this; }
16.473 - };
16.474 -
16.475 - /// \brief This iterator goes trough the incident undirected
16.476 - /// edges of a node.
16.477 - ///
16.478 - /// This iterator goes trough the incident undirected edges
16.479 - /// of a certain node
16.480 - /// of a graph.
16.481 - /// Its usage is quite simple, for example you can compute the
16.482 - /// degree (i.e. count the number
16.483 - /// of incident edges of a node \c n
16.484 - /// in graph \c g of type \c Graph as follows.
16.485 - ///\code
16.486 - /// int count=0;
16.487 - /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
16.488 - ///\endcode
16.489 - class IncEdgeIt : public UEdge {
16.490 - public:
16.491 - /// Default constructor
16.492 -
16.493 - /// @warning The default constructor sets the iterator
16.494 - /// to an undefined value.
16.495 - IncEdgeIt() { }
16.496 - /// Copy constructor.
16.497 -
16.498 - /// Copy constructor.
16.499 - ///
16.500 - IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
16.501 - /// Initialize the iterator to be invalid.
16.502 -
16.503 - /// Initialize the iterator to be invalid.
16.504 - ///
16.505 - IncEdgeIt(Invalid) { }
16.506 - /// This constructor sets the iterator to first incident edge.
16.507 -
16.508 - /// This constructor set the iterator to the first incident edge of
16.509 - /// the node.
16.510 - IncEdgeIt(const BpUGraph&, const Node&) { }
16.511 - /// UEdge -> IncEdgeIt conversion
16.512 -
16.513 - /// Sets the iterator to the value of the trivial iterator \c e.
16.514 - /// This feature necessitates that each time we
16.515 - /// iterate the edge-set, the iteration order is the same.
16.516 - IncEdgeIt(const BpUGraph&, const UEdge&) { }
16.517 - /// Next incident edge
16.518 -
16.519 - /// Assign the iterator to the next incident edge
16.520 - /// of the corresponding node.
16.521 - IncEdgeIt& operator++() { return *this; }
16.522 - };
16.523 -
16.524 - /// The directed edge type.
16.525 -
16.526 - /// The directed edge type. It can be converted to the
16.527 - /// undirected edge.
16.528 - class Edge : public UEdge {
16.529 - public:
16.530 - /// Default constructor
16.531 -
16.532 - /// @warning The default constructor sets the iterator
16.533 - /// to an undefined value.
16.534 - Edge() { }
16.535 - /// Copy constructor.
16.536 -
16.537 - /// Copy constructor.
16.538 - ///
16.539 - Edge(const Edge& e) : UEdge(e) { }
16.540 - /// Initialize the iterator to be invalid.
16.541 -
16.542 - /// Initialize the iterator to be invalid.
16.543 - ///
16.544 - Edge(Invalid) { }
16.545 - /// Equality operator
16.546 -
16.547 - /// Two iterators are equal if and only if they point to the
16.548 - /// same object or both are invalid.
16.549 - bool operator==(Edge) const { return true; }
16.550 - /// Inequality operator
16.551 -
16.552 - /// \sa operator==(Edge n)
16.553 - ///
16.554 - bool operator!=(Edge) const { return true; }
16.555 -
16.556 - /// Artificial ordering operator.
16.557 -
16.558 - /// To allow the use of graph descriptors as key type in std::map or
16.559 - /// similar associative container we require this.
16.560 - ///
16.561 - /// \note This operator only have to define some strict ordering of
16.562 - /// the items; this order has nothing to do with the iteration
16.563 - /// ordering of the items.
16.564 - bool operator<(Edge) const { return false; }
16.565 -
16.566 - };
16.567 - /// This iterator goes through each directed edge.
16.568 -
16.569 - /// This iterator goes through each edge of a graph.
16.570 - /// Its usage is quite simple, for example you can count the number
16.571 - /// of edges in a graph \c g of type \c Graph as follows:
16.572 - ///\code
16.573 - /// int count=0;
16.574 - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
16.575 - ///\endcode
16.576 - class EdgeIt : public Edge {
16.577 - public:
16.578 - /// Default constructor
16.579 -
16.580 - /// @warning The default constructor sets the iterator
16.581 - /// to an undefined value.
16.582 - EdgeIt() { }
16.583 - /// Copy constructor.
16.584 -
16.585 - /// Copy constructor.
16.586 - ///
16.587 - EdgeIt(const EdgeIt& e) : Edge(e) { }
16.588 - /// Initialize the iterator to be invalid.
16.589 -
16.590 - /// Initialize the iterator to be invalid.
16.591 - ///
16.592 - EdgeIt(Invalid) { }
16.593 - /// This constructor sets the iterator to the first edge.
16.594 -
16.595 - /// This constructor sets the iterator to the first edge of \c g.
16.596 - ///@param g the graph
16.597 - EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
16.598 - /// Edge -> EdgeIt conversion
16.599 -
16.600 - /// Sets the iterator to the value of the trivial iterator \c e.
16.601 - /// This feature necessitates that each time we
16.602 - /// iterate the edge-set, the iteration order is the same.
16.603 - EdgeIt(const BpUGraph&, const Edge&) { }
16.604 - ///Next edge
16.605 -
16.606 - /// Assign the iterator to the next edge.
16.607 - EdgeIt& operator++() { return *this; }
16.608 - };
16.609 -
16.610 - /// This iterator goes trough the outgoing directed edges of a node.
16.611 -
16.612 - /// This iterator goes trough the \e outgoing edges of a certain node
16.613 - /// of a graph.
16.614 - /// Its usage is quite simple, for example you can count the number
16.615 - /// of outgoing edges of a node \c n
16.616 - /// in graph \c g of type \c Graph as follows.
16.617 - ///\code
16.618 - /// int count=0;
16.619 - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
16.620 - ///\endcode
16.621 -
16.622 - class OutEdgeIt : public Edge {
16.623 - public:
16.624 - /// Default constructor
16.625 -
16.626 - /// @warning The default constructor sets the iterator
16.627 - /// to an undefined value.
16.628 - OutEdgeIt() { }
16.629 - /// Copy constructor.
16.630 -
16.631 - /// Copy constructor.
16.632 - ///
16.633 - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
16.634 - /// Initialize the iterator to be invalid.
16.635 -
16.636 - /// Initialize the iterator to be invalid.
16.637 - ///
16.638 - OutEdgeIt(Invalid) { }
16.639 - /// This constructor sets the iterator to the first outgoing edge.
16.640 -
16.641 - /// This constructor sets the iterator to the first outgoing edge of
16.642 - /// the node.
16.643 - ///@param n the node
16.644 - ///@param g the graph
16.645 - OutEdgeIt(const BpUGraph& n, const Node& g) {
16.646 - ignore_unused_variable_warning(n);
16.647 - ignore_unused_variable_warning(g);
16.648 - }
16.649 - /// Edge -> OutEdgeIt conversion
16.650 -
16.651 - /// Sets the iterator to the value of the trivial iterator.
16.652 - /// This feature necessitates that each time we
16.653 - /// iterate the edge-set, the iteration order is the same.
16.654 - OutEdgeIt(const BpUGraph&, const Edge&) { }
16.655 - ///Next outgoing edge
16.656 -
16.657 - /// Assign the iterator to the next
16.658 - /// outgoing edge of the corresponding node.
16.659 - OutEdgeIt& operator++() { return *this; }
16.660 - };
16.661 -
16.662 - /// This iterator goes trough the incoming directed edges of a node.
16.663 -
16.664 - /// This iterator goes trough the \e incoming edges of a certain node
16.665 - /// of a graph.
16.666 - /// Its usage is quite simple, for example you can count the number
16.667 - /// of outgoing edges of a node \c n
16.668 - /// in graph \c g of type \c Graph as follows.
16.669 - ///\code
16.670 - /// int count=0;
16.671 - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
16.672 - ///\endcode
16.673 -
16.674 - class InEdgeIt : public Edge {
16.675 - public:
16.676 - /// Default constructor
16.677 -
16.678 - /// @warning The default constructor sets the iterator
16.679 - /// to an undefined value.
16.680 - InEdgeIt() { }
16.681 - /// Copy constructor.
16.682 -
16.683 - /// Copy constructor.
16.684 - ///
16.685 - InEdgeIt(const InEdgeIt& e) : Edge(e) { }
16.686 - /// Initialize the iterator to be invalid.
16.687 -
16.688 - /// Initialize the iterator to be invalid.
16.689 - ///
16.690 - InEdgeIt(Invalid) { }
16.691 - /// This constructor sets the iterator to first incoming edge.
16.692 -
16.693 - /// This constructor set the iterator to the first incoming edge of
16.694 - /// the node.
16.695 - ///@param n the node
16.696 - ///@param g the graph
16.697 - InEdgeIt(const BpUGraph& g, const Node& n) {
16.698 - ignore_unused_variable_warning(n);
16.699 - ignore_unused_variable_warning(g);
16.700 - }
16.701 - /// Edge -> InEdgeIt conversion
16.702 -
16.703 - /// Sets the iterator to the value of the trivial iterator \c e.
16.704 - /// This feature necessitates that each time we
16.705 - /// iterate the edge-set, the iteration order is the same.
16.706 - InEdgeIt(const BpUGraph&, const Edge&) { }
16.707 - /// Next incoming edge
16.708 -
16.709 - /// Assign the iterator to the next inedge of the corresponding node.
16.710 - ///
16.711 - InEdgeIt& operator++() { return *this; }
16.712 - };
16.713 -
16.714 - /// \brief Read write map of the nodes to type \c T.
16.715 - ///
16.716 - /// ReadWrite map of the nodes to type \c T.
16.717 - /// \sa Reference
16.718 - /// \warning Making maps that can handle bool type (NodeMap<bool>)
16.719 - /// needs some extra attention!
16.720 - /// \todo Wrong documentation
16.721 - template<class T>
16.722 - class NodeMap : public ReadWriteMap< Node, T >
16.723 - {
16.724 - public:
16.725 -
16.726 - ///\e
16.727 - NodeMap(const BpUGraph&) { }
16.728 - ///\e
16.729 - NodeMap(const BpUGraph&, T) { }
16.730 -
16.731 - ///Copy constructor
16.732 - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
16.733 - ///Assignment operator
16.734 - NodeMap& operator=(const NodeMap&) { return *this; }
16.735 - ///Assignment operator
16.736 - template <typename CMap>
16.737 - NodeMap& operator=(const CMap&) {
16.738 - checkConcept<ReadMap<Node, T>, CMap>();
16.739 - return *this;
16.740 - }
16.741 - };
16.742 -
16.743 - /// \brief Read write map of the ANodes to type \c T.
16.744 - ///
16.745 - /// ReadWrite map of the ANodes to type \c T.
16.746 - /// \sa Reference
16.747 - /// \warning Making maps that can handle bool type (NodeMap<bool>)
16.748 - /// needs some extra attention!
16.749 - /// \todo Wrong documentation
16.750 - template<class T>
16.751 - class ANodeMap : public ReadWriteMap< Node, T >
16.752 - {
16.753 - public:
16.754 -
16.755 - ///\e
16.756 - ANodeMap(const BpUGraph&) { }
16.757 - ///\e
16.758 - ANodeMap(const BpUGraph&, T) { }
16.759 -
16.760 - ///Copy constructor
16.761 - ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
16.762 - ///Assignment operator
16.763 - ANodeMap& operator=(const ANodeMap&) { return *this; }
16.764 - ///Assignment operator
16.765 - template <typename CMap>
16.766 - ANodeMap& operator=(const CMap&) {
16.767 - checkConcept<ReadMap<Node, T>, CMap>();
16.768 - return *this;
16.769 - }
16.770 - };
16.771 -
16.772 - /// \brief Read write map of the BNodes to type \c T.
16.773 - ///
16.774 - /// ReadWrite map of the BNodes to type \c T.
16.775 - /// \sa Reference
16.776 - /// \warning Making maps that can handle bool type (NodeMap<bool>)
16.777 - /// needs some extra attention!
16.778 - /// \todo Wrong documentation
16.779 - template<class T>
16.780 - class BNodeMap : public ReadWriteMap< Node, T >
16.781 - {
16.782 - public:
16.783 -
16.784 - ///\e
16.785 - BNodeMap(const BpUGraph&) { }
16.786 - ///\e
16.787 - BNodeMap(const BpUGraph&, T) { }
16.788 -
16.789 - ///Copy constructor
16.790 - BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
16.791 - ///Assignment operator
16.792 - BNodeMap& operator=(const BNodeMap&) { return *this; }
16.793 - ///Assignment operator
16.794 - template <typename CMap>
16.795 - BNodeMap& operator=(const CMap&) {
16.796 - checkConcept<ReadMap<Node, T>, CMap>();
16.797 - return *this;
16.798 - }
16.799 - };
16.800 -
16.801 - /// \brief Read write map of the directed edges to type \c T.
16.802 - ///
16.803 - /// Reference map of the directed edges to type \c T.
16.804 - /// \sa Reference
16.805 - /// \warning Making maps that can handle bool type (EdgeMap<bool>)
16.806 - /// needs some extra attention!
16.807 - /// \todo Wrong documentation
16.808 - template<class T>
16.809 - class EdgeMap : public ReadWriteMap<Edge,T>
16.810 - {
16.811 - public:
16.812 -
16.813 - ///\e
16.814 - EdgeMap(const BpUGraph&) { }
16.815 - ///\e
16.816 - EdgeMap(const BpUGraph&, T) { }
16.817 - ///Copy constructor
16.818 - EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
16.819 - ///Assignment operator
16.820 - EdgeMap& operator=(const EdgeMap&) { return *this; }
16.821 - ///Assignment operator
16.822 - template <typename CMap>
16.823 - EdgeMap& operator=(const CMap&) {
16.824 - checkConcept<ReadMap<Edge, T>, CMap>();
16.825 - return *this;
16.826 - }
16.827 - };
16.828 -
16.829 - /// Read write map of the undirected edges to type \c T.
16.830 -
16.831 - /// Reference map of the edges to type \c T.
16.832 - /// \sa Reference
16.833 - /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
16.834 - /// needs some extra attention!
16.835 - /// \todo Wrong documentation
16.836 - template<class T>
16.837 - class UEdgeMap : public ReadWriteMap<UEdge,T>
16.838 - {
16.839 - public:
16.840 -
16.841 - ///\e
16.842 - UEdgeMap(const BpUGraph&) { }
16.843 - ///\e
16.844 - UEdgeMap(const BpUGraph&, T) { }
16.845 - ///Copy constructor
16.846 - UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
16.847 - ///Assignment operator
16.848 - UEdgeMap &operator=(const UEdgeMap&) { return *this; }
16.849 - ///Assignment operator
16.850 - template <typename CMap>
16.851 - UEdgeMap& operator=(const CMap&) {
16.852 - checkConcept<ReadMap<UEdge, T>, CMap>();
16.853 - return *this;
16.854 - }
16.855 - };
16.856 -
16.857 - /// \brief Direct the given undirected edge.
16.858 - ///
16.859 - /// Direct the given undirected edge. The returned edge source
16.860 - /// will be the given node.
16.861 - Edge direct(const UEdge&, const Node&) const {
16.862 - return INVALID;
16.863 - }
16.864 -
16.865 - /// \brief Direct the given undirected edge.
16.866 - ///
16.867 - /// Direct the given undirected edge. The returned edge
16.868 - /// represents the given undireted edge and the direction comes
16.869 - /// from the given bool. The source of the undirected edge and
16.870 - /// the directed edge is the same when the given bool is true.
16.871 - Edge direct(const UEdge&, bool) const {
16.872 - return INVALID;
16.873 - }
16.874 -
16.875 - /// \brief Returns true when the given node is an ANode.
16.876 - ///
16.877 - /// Returns true when the given node is an ANode.
16.878 - bool aNode(Node) const { return true;}
16.879 -
16.880 - /// \brief Returns true when the given node is an BNode.
16.881 - ///
16.882 - /// Returns true when the given node is an BNode.
16.883 - bool bNode(Node) const { return true;}
16.884 -
16.885 - /// \brief Returns the edge's end node which is in the ANode set.
16.886 - ///
16.887 - /// Returns the edge's end node which is in the ANode set.
16.888 - Node aNode(UEdge) const { return INVALID;}
16.889 -
16.890 - /// \brief Returns the edge's end node which is in the BNode set.
16.891 - ///
16.892 - /// Returns the edge's end node which is in the BNode set.
16.893 - Node bNode(UEdge) const { return INVALID;}
16.894 -
16.895 - /// \brief Returns true if the edge has default orientation.
16.896 - ///
16.897 - /// Returns whether the given directed edge is same orientation as
16.898 - /// the corresponding undirected edge's default orientation.
16.899 - bool direction(Edge) const { return true; }
16.900 -
16.901 - /// \brief Returns the opposite directed edge.
16.902 - ///
16.903 - /// Returns the opposite directed edge.
16.904 - Edge oppositeEdge(Edge) const { return INVALID; }
16.905 -
16.906 - /// \brief Opposite node on an edge
16.907 - ///
16.908 - /// \return the opposite of the given Node on the given UEdge
16.909 - Node oppositeNode(Node, UEdge) const { return INVALID; }
16.910 -
16.911 - /// \brief First node of the undirected edge.
16.912 - ///
16.913 - /// \return the first node of the given UEdge.
16.914 - ///
16.915 - /// Naturally undirected edges don't have direction and thus
16.916 - /// don't have source and target node. But we use these two methods
16.917 - /// to query the two endnodes of the edge. The direction of the edge
16.918 - /// which arises this way is called the inherent direction of the
16.919 - /// undirected edge, and is used to define the "default" direction
16.920 - /// of the directed versions of the edges.
16.921 - /// \sa direction
16.922 - Node source(UEdge) const { return INVALID; }
16.923 -
16.924 - /// \brief Second node of the undirected edge.
16.925 - Node target(UEdge) const { return INVALID; }
16.926 -
16.927 - /// \brief Source node of the directed edge.
16.928 - Node source(Edge) const { return INVALID; }
16.929 -
16.930 - /// \brief Target node of the directed edge.
16.931 - Node target(Edge) const { return INVALID; }
16.932 -
16.933 - /// \brief Base node of the iterator
16.934 - ///
16.935 - /// Returns the base node (the source in this case) of the iterator
16.936 - Node baseNode(OutEdgeIt e) const {
16.937 - return source(e);
16.938 - }
16.939 -
16.940 - /// \brief Running node of the iterator
16.941 - ///
16.942 - /// Returns the running node (the target in this case) of the
16.943 - /// iterator
16.944 - Node runningNode(OutEdgeIt e) const {
16.945 - return target(e);
16.946 - }
16.947 -
16.948 - /// \brief Base node of the iterator
16.949 - ///
16.950 - /// Returns the base node (the target in this case) of the iterator
16.951 - Node baseNode(InEdgeIt e) const {
16.952 - return target(e);
16.953 - }
16.954 - /// \brief Running node of the iterator
16.955 - ///
16.956 - /// Returns the running node (the source in this case) of the
16.957 - /// iterator
16.958 - Node runningNode(InEdgeIt e) const {
16.959 - return source(e);
16.960 - }
16.961 -
16.962 - /// \brief Base node of the iterator
16.963 - ///
16.964 - /// Returns the base node of the iterator
16.965 - Node baseNode(IncEdgeIt) const {
16.966 - return INVALID;
16.967 - }
16.968 -
16.969 - /// \brief Running node of the iterator
16.970 - ///
16.971 - /// Returns the running node of the iterator
16.972 - Node runningNode(IncEdgeIt) const {
16.973 - return INVALID;
16.974 - }
16.975 -
16.976 - void first(Node&) const {}
16.977 - void next(Node&) const {}
16.978 -
16.979 - void first(Edge&) const {}
16.980 - void next(Edge&) const {}
16.981 -
16.982 - void first(UEdge&) const {}
16.983 - void next(UEdge&) const {}
16.984 -
16.985 - void firstANode(Node&) const {}
16.986 - void nextANode(Node&) const {}
16.987 -
16.988 - void firstBNode(Node&) const {}
16.989 - void nextBNode(Node&) const {}
16.990 -
16.991 - void firstIn(Edge&, const Node&) const {}
16.992 - void nextIn(Edge&) const {}
16.993 -
16.994 - void firstOut(Edge&, const Node&) const {}
16.995 - void nextOut(Edge&) const {}
16.996 -
16.997 - void firstInc(UEdge &, bool &, const Node &) const {}
16.998 - void nextInc(UEdge &, bool &) const {}
16.999 -
16.1000 - void firstFromANode(UEdge&, const Node&) const {}
16.1001 - void nextFromANode(UEdge&) const {}
16.1002 -
16.1003 - void firstFromBNode(UEdge&, const Node&) const {}
16.1004 - void nextFromBNode(UEdge&) const {}
16.1005 -
16.1006 - template <typename Graph>
16.1007 - struct Constraints {
16.1008 - void constraints() {
16.1009 - checkConcept<IterableBpUGraphComponent<>, Graph>();
16.1010 - checkConcept<MappableBpUGraphComponent<>, Graph>();
16.1011 - }
16.1012 - };
16.1013 -
16.1014 - };
16.1015 -
16.1016 -
16.1017 - /// @}
16.1018 -
16.1019 - }
16.1020 -
16.1021 -}
16.1022 -
16.1023 -#endif
17.1 --- a/lemon/concept/graph.h Tue Oct 24 16:49:41 2006 +0000
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,455 +0,0 @@
17.4 -/* -*- C++ -*-
17.5 - *
17.6 - * This file is a part of LEMON, a generic C++ optimization library
17.7 - *
17.8 - * Copyright (C) 2003-2006
17.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
17.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
17.11 - *
17.12 - * Permission to use, modify and distribute this software is granted
17.13 - * provided that this copyright notice appears in all copies. For
17.14 - * precise terms see the accompanying LICENSE file.
17.15 - *
17.16 - * This software is provided "AS IS" with no warranty of any kind,
17.17 - * express or implied, and with no claim as to its suitability for any
17.18 - * purpose.
17.19 - *
17.20 - */
17.21 -
17.22 -#ifndef LEMON_CONCEPT_GRAPH_H
17.23 -#define LEMON_CONCEPT_GRAPH_H
17.24 -
17.25 -///\ingroup graph_concepts
17.26 -///\file
17.27 -///\brief Declaration of Graph.
17.28 -
17.29 -#include <lemon/bits/invalid.h>
17.30 -#include <lemon/bits/utility.h>
17.31 -#include <lemon/concept/maps.h>
17.32 -#include <lemon/concept_check.h>
17.33 -#include <lemon/concept/graph_components.h>
17.34 -
17.35 -namespace lemon {
17.36 - namespace concept {
17.37 -
17.38 - /// \addtogroup graph_concepts
17.39 - /// @{
17.40 -
17.41 - /// The directed graph concept
17.42 -
17.43 - /// This class describes the \ref concept "concept" of the
17.44 - /// immutable directed graphs.
17.45 - ///
17.46 - /// Note that actual graph implementation like @ref ListGraph or
17.47 - /// @ref SmartGraph may have several additional functionality.
17.48 - ///
17.49 - /// \sa concept
17.50 - class Graph {
17.51 - private:
17.52 - ///Graphs are \e not copy constructible. Use GraphCopy() instead.
17.53 -
17.54 - ///Graphs are \e not copy constructible. Use GraphCopy() instead.
17.55 - ///
17.56 - Graph(const Graph &) {};
17.57 - ///\brief Assignment of \ref Graph "Graph"s to another ones are
17.58 - ///\e not allowed. Use GraphCopy() instead.
17.59 -
17.60 - ///Assignment of \ref Graph "Graph"s to another ones are
17.61 - ///\e not allowed. Use GraphCopy() instead.
17.62 -
17.63 - void operator=(const Graph &) {}
17.64 - public:
17.65 - ///\e
17.66 -
17.67 - /// Defalult constructor.
17.68 -
17.69 - /// Defalult constructor.
17.70 - ///
17.71 - Graph() { }
17.72 - /// Class for identifying a node of the graph
17.73 -
17.74 - /// This class identifies a node of the graph. It also serves
17.75 - /// as a base class of the node iterators,
17.76 - /// thus they will convert to this type.
17.77 - class Node {
17.78 - public:
17.79 - /// Default constructor
17.80 -
17.81 - /// @warning The default constructor sets the iterator
17.82 - /// to an undefined value.
17.83 - Node() { }
17.84 - /// Copy constructor.
17.85 -
17.86 - /// Copy constructor.
17.87 - ///
17.88 - Node(const Node&) { }
17.89 -
17.90 - /// Invalid constructor \& conversion.
17.91 -
17.92 - /// This constructor initializes the iterator to be invalid.
17.93 - /// \sa Invalid for more details.
17.94 - Node(Invalid) { }
17.95 - /// Equality operator
17.96 -
17.97 - /// Two iterators are equal if and only if they point to the
17.98 - /// same object or both are invalid.
17.99 - bool operator==(Node) const { return true; }
17.100 -
17.101 - /// Inequality operator
17.102 -
17.103 - /// \sa operator==(Node n)
17.104 - ///
17.105 - bool operator!=(Node) const { return true; }
17.106 -
17.107 - /// Artificial ordering operator.
17.108 -
17.109 - /// To allow the use of graph descriptors as key type in std::map or
17.110 - /// similar associative container we require this.
17.111 - ///
17.112 - /// \note This operator only have to define some strict ordering of
17.113 - /// the items; this order has nothing to do with the iteration
17.114 - /// ordering of the items.
17.115 - bool operator<(Node) const { return false; }
17.116 -
17.117 - };
17.118 -
17.119 - /// This iterator goes through each node.
17.120 -
17.121 - /// This iterator goes through each node.
17.122 - /// Its usage is quite simple, for example you can count the number
17.123 - /// of nodes in graph \c g of type \c Graph like this:
17.124 - ///\code
17.125 - /// int count=0;
17.126 - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
17.127 - ///\endcode
17.128 - class NodeIt : public Node {
17.129 - public:
17.130 - /// Default constructor
17.131 -
17.132 - /// @warning The default constructor sets the iterator
17.133 - /// to an undefined value.
17.134 - NodeIt() { }
17.135 - /// Copy constructor.
17.136 -
17.137 - /// Copy constructor.
17.138 - ///
17.139 - NodeIt(const NodeIt& n) : Node(n) { }
17.140 - /// Invalid constructor \& conversion.
17.141 -
17.142 - /// Initialize the iterator to be invalid.
17.143 - /// \sa Invalid for more details.
17.144 - NodeIt(Invalid) { }
17.145 - /// Sets the iterator to the first node.
17.146 -
17.147 - /// Sets the iterator to the first node of \c g.
17.148 - ///
17.149 - NodeIt(const Graph&) { }
17.150 - /// Node -> NodeIt conversion.
17.151 -
17.152 - /// Sets the iterator to the node of \c the graph pointed by
17.153 - /// the trivial iterator.
17.154 - /// This feature necessitates that each time we
17.155 - /// iterate the edge-set, the iteration order is the same.
17.156 - NodeIt(const Graph&, const Node&) { }
17.157 - /// Next node.
17.158 -
17.159 - /// Assign the iterator to the next node.
17.160 - ///
17.161 - NodeIt& operator++() { return *this; }
17.162 - };
17.163 -
17.164 -
17.165 - /// Class for identifying an edge of the graph
17.166 -
17.167 - /// This class identifies an edge of the graph. It also serves
17.168 - /// as a base class of the edge iterators,
17.169 - /// thus they will convert to this type.
17.170 - class Edge {
17.171 - public:
17.172 - /// Default constructor
17.173 -
17.174 - /// @warning The default constructor sets the iterator
17.175 - /// to an undefined value.
17.176 - Edge() { }
17.177 - /// Copy constructor.
17.178 -
17.179 - /// Copy constructor.
17.180 - ///
17.181 - Edge(const Edge&) { }
17.182 - /// Initialize the iterator to be invalid.
17.183 -
17.184 - /// Initialize the iterator to be invalid.
17.185 - ///
17.186 - Edge(Invalid) { }
17.187 - /// Equality operator
17.188 -
17.189 - /// Two iterators are equal if and only if they point to the
17.190 - /// same object or both are invalid.
17.191 - bool operator==(Edge) const { return true; }
17.192 - /// Inequality operator
17.193 -
17.194 - /// \sa operator==(Edge n)
17.195 - ///
17.196 - bool operator!=(Edge) const { return true; }
17.197 -
17.198 - /// Artificial ordering operator.
17.199 -
17.200 - /// To allow the use of graph descriptors as key type in std::map or
17.201 - /// similar associative container we require this.
17.202 - ///
17.203 - /// \note This operator only have to define some strict ordering of
17.204 - /// the items; this order has nothing to do with the iteration
17.205 - /// ordering of the items.
17.206 - bool operator<(Edge) const { return false; }
17.207 - };
17.208 -
17.209 - /// This iterator goes trough the outgoing edges of a node.
17.210 -
17.211 - /// This iterator goes trough the \e outgoing edges of a certain node
17.212 - /// of a graph.
17.213 - /// Its usage is quite simple, for example you can count the number
17.214 - /// of outgoing edges of a node \c n
17.215 - /// in graph \c g of type \c Graph as follows.
17.216 - ///\code
17.217 - /// int count=0;
17.218 - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
17.219 - ///\endcode
17.220 -
17.221 - class OutEdgeIt : public Edge {
17.222 - public:
17.223 - /// Default constructor
17.224 -
17.225 - /// @warning The default constructor sets the iterator
17.226 - /// to an undefined value.
17.227 - OutEdgeIt() { }
17.228 - /// Copy constructor.
17.229 -
17.230 - /// Copy constructor.
17.231 - ///
17.232 - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
17.233 - /// Initialize the iterator to be invalid.
17.234 -
17.235 - /// Initialize the iterator to be invalid.
17.236 - ///
17.237 - OutEdgeIt(Invalid) { }
17.238 - /// This constructor sets the iterator to the first outgoing edge.
17.239 -
17.240 - /// This constructor sets the iterator to the first outgoing edge of
17.241 - /// the node.
17.242 - OutEdgeIt(const Graph&, const Node&) { }
17.243 - /// Edge -> OutEdgeIt conversion
17.244 -
17.245 - /// Sets the iterator to the value of the trivial iterator.
17.246 - /// This feature necessitates that each time we
17.247 - /// iterate the edge-set, the iteration order is the same.
17.248 - OutEdgeIt(const Graph&, const Edge&) { }
17.249 - ///Next outgoing edge
17.250 -
17.251 - /// Assign the iterator to the next
17.252 - /// outgoing edge of the corresponding node.
17.253 - OutEdgeIt& operator++() { return *this; }
17.254 - };
17.255 -
17.256 - /// This iterator goes trough the incoming edges of a node.
17.257 -
17.258 - /// This iterator goes trough the \e incoming edges of a certain node
17.259 - /// of a graph.
17.260 - /// Its usage is quite simple, for example you can count the number
17.261 - /// of outgoing edges of a node \c n
17.262 - /// in graph \c g of type \c Graph as follows.
17.263 - ///\code
17.264 - /// int count=0;
17.265 - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
17.266 - ///\endcode
17.267 -
17.268 - class InEdgeIt : public Edge {
17.269 - public:
17.270 - /// Default constructor
17.271 -
17.272 - /// @warning The default constructor sets the iterator
17.273 - /// to an undefined value.
17.274 - InEdgeIt() { }
17.275 - /// Copy constructor.
17.276 -
17.277 - /// Copy constructor.
17.278 - ///
17.279 - InEdgeIt(const InEdgeIt& e) : Edge(e) { }
17.280 - /// Initialize the iterator to be invalid.
17.281 -
17.282 - /// Initialize the iterator to be invalid.
17.283 - ///
17.284 - InEdgeIt(Invalid) { }
17.285 - /// This constructor sets the iterator to first incoming edge.
17.286 -
17.287 - /// This constructor set the iterator to the first incoming edge of
17.288 - /// the node.
17.289 - InEdgeIt(const Graph&, const Node&) { }
17.290 - /// Edge -> InEdgeIt conversion
17.291 -
17.292 - /// Sets the iterator to the value of the trivial iterator \c e.
17.293 - /// This feature necessitates that each time we
17.294 - /// iterate the edge-set, the iteration order is the same.
17.295 - InEdgeIt(const Graph&, const Edge&) { }
17.296 - /// Next incoming edge
17.297 -
17.298 - /// Assign the iterator to the next inedge of the corresponding node.
17.299 - ///
17.300 - InEdgeIt& operator++() { return *this; }
17.301 - };
17.302 - /// This iterator goes through each edge.
17.303 -
17.304 - /// This iterator goes through each edge of a graph.
17.305 - /// Its usage is quite simple, for example you can count the number
17.306 - /// of edges in a graph \c g of type \c Graph as follows:
17.307 - ///\code
17.308 - /// int count=0;
17.309 - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
17.310 - ///\endcode
17.311 - class EdgeIt : public Edge {
17.312 - public:
17.313 - /// Default constructor
17.314 -
17.315 - /// @warning The default constructor sets the iterator
17.316 - /// to an undefined value.
17.317 - EdgeIt() { }
17.318 - /// Copy constructor.
17.319 -
17.320 - /// Copy constructor.
17.321 - ///
17.322 - EdgeIt(const EdgeIt& e) : Edge(e) { }
17.323 - /// Initialize the iterator to be invalid.
17.324 -
17.325 - /// Initialize the iterator to be invalid.
17.326 - ///
17.327 - EdgeIt(Invalid) { }
17.328 - /// This constructor sets the iterator to the first edge.
17.329 -
17.330 - /// This constructor sets the iterator to the first edge of \c g.
17.331 - ///@param g the graph
17.332 - EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); }
17.333 - /// Edge -> EdgeIt conversion
17.334 -
17.335 - /// Sets the iterator to the value of the trivial iterator \c e.
17.336 - /// This feature necessitates that each time we
17.337 - /// iterate the edge-set, the iteration order is the same.
17.338 - EdgeIt(const Graph&, const Edge&) { }
17.339 - ///Next edge
17.340 -
17.341 - /// Assign the iterator to the next edge.
17.342 - EdgeIt& operator++() { return *this; }
17.343 - };
17.344 - ///Gives back the target node of an edge.
17.345 -
17.346 - ///Gives back the target node of an edge.
17.347 - ///
17.348 - Node target(Edge) const { return INVALID; }
17.349 - ///Gives back the source node of an edge.
17.350 -
17.351 - ///Gives back the source node of an edge.
17.352 - ///
17.353 - Node source(Edge) const { return INVALID; }
17.354 -
17.355 - void first(Node&) const {}
17.356 - void next(Node&) const {}
17.357 -
17.358 - void first(Edge&) const {}
17.359 - void next(Edge&) const {}
17.360 -
17.361 -
17.362 - void firstIn(Edge&, const Node&) const {}
17.363 - void nextIn(Edge&) const {}
17.364 -
17.365 - void firstOut(Edge&, const Node&) const {}
17.366 - void nextOut(Edge&) const {}
17.367 -
17.368 - /// \brief The base node of the iterator.
17.369 - ///
17.370 - /// Gives back the base node of the iterator.
17.371 - /// It is always the target of the pointed edge.
17.372 - Node baseNode(const InEdgeIt&) const { return INVALID; }
17.373 -
17.374 - /// \brief The running node of the iterator.
17.375 - ///
17.376 - /// Gives back the running node of the iterator.
17.377 - /// It is always the source of the pointed edge.
17.378 - Node runningNode(const InEdgeIt&) const { return INVALID; }
17.379 -
17.380 - /// \brief The base node of the iterator.
17.381 - ///
17.382 - /// Gives back the base node of the iterator.
17.383 - /// It is always the source of the pointed edge.
17.384 - Node baseNode(const OutEdgeIt&) const { return INVALID; }
17.385 -
17.386 - /// \brief The running node of the iterator.
17.387 - ///
17.388 - /// Gives back the running node of the iterator.
17.389 - /// It is always the target of the pointed edge.
17.390 - Node runningNode(const OutEdgeIt&) const { return INVALID; }
17.391 -
17.392 - /// \brief The opposite node on the given edge.
17.393 - ///
17.394 - /// Gives back the opposite node on the given edge.
17.395 - Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
17.396 -
17.397 - /// \brief Read write map of the nodes to type \c T.
17.398 - ///
17.399 - /// ReadWrite map of the nodes to type \c T.
17.400 - /// \sa Reference
17.401 - template<class T>
17.402 - class NodeMap : public ReadWriteMap< Node, T > {
17.403 - public:
17.404 -
17.405 - ///\e
17.406 - NodeMap(const Graph&) { }
17.407 - ///\e
17.408 - NodeMap(const Graph&, T) { }
17.409 -
17.410 - ///Copy constructor
17.411 - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
17.412 - ///Assignment operator
17.413 - template <typename CMap>
17.414 - NodeMap& operator=(const CMap&) {
17.415 - checkConcept<ReadMap<Node, T>, CMap>();
17.416 - return *this;
17.417 - }
17.418 - };
17.419 -
17.420 - /// \brief Read write map of the edges to type \c T.
17.421 - ///
17.422 - /// Reference map of the edges to type \c T.
17.423 - /// \sa Reference
17.424 - template<class T>
17.425 - class EdgeMap : public ReadWriteMap<Edge,T> {
17.426 - public:
17.427 -
17.428 - ///\e
17.429 - EdgeMap(const Graph&) { }
17.430 - ///\e
17.431 - EdgeMap(const Graph&, T) { }
17.432 - ///Copy constructor
17.433 - EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
17.434 - ///Assignment operator
17.435 - template <typename CMap>
17.436 - EdgeMap& operator=(const CMap&) {
17.437 - checkConcept<ReadMap<Edge, T>, CMap>();
17.438 - return *this;
17.439 - }
17.440 - };
17.441 -
17.442 - template <typename RGraph>
17.443 - struct Constraints {
17.444 - void constraints() {
17.445 - checkConcept<IterableGraphComponent<>, Graph>();
17.446 - checkConcept<MappableGraphComponent<>, Graph>();
17.447 - }
17.448 - };
17.449 -
17.450 - };
17.451 -
17.452 - // @}
17.453 - } //namespace concept
17.454 -} //namespace lemon
17.455 -
17.456 -
17.457 -
17.458 -#endif // LEMON_CONCEPT_GRAPH_H
18.1 --- a/lemon/concept/graph_components.h Tue Oct 24 16:49:41 2006 +0000
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,2103 +0,0 @@
18.4 -/* -*- C++ -*-
18.5 - *
18.6 - * This file is a part of LEMON, a generic C++ optimization library
18.7 - *
18.8 - * Copyright (C) 2003-2006
18.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
18.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
18.11 - *
18.12 - * Permission to use, modify and distribute this software is granted
18.13 - * provided that this copyright notice appears in all copies. For
18.14 - * precise terms see the accompanying LICENSE file.
18.15 - *
18.16 - * This software is provided "AS IS" with no warranty of any kind,
18.17 - * express or implied, and with no claim as to its suitability for any
18.18 - * purpose.
18.19 - *
18.20 - */
18.21 -
18.22 -///\ingroup graph_concepts
18.23 -///\file
18.24 -///\brief The concept of the graph components.
18.25 -
18.26 -
18.27 -#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
18.28 -#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
18.29 -
18.30 -#include <lemon/bits/invalid.h>
18.31 -#include <lemon/concept/maps.h>
18.32 -
18.33 -#include <lemon/bits/alteration_notifier.h>
18.34 -
18.35 -namespace lemon {
18.36 - namespace concept {
18.37 -
18.38 - /// \brief Skeleton class for graph Node and Edge types
18.39 - ///
18.40 - /// This class describes the interface of Node and Edge (and UEdge
18.41 - /// in undirected graphs) subtypes of graph types.
18.42 - ///
18.43 - /// \note This class is a template class so that we can use it to
18.44 - /// create graph skeleton classes. The reason for this is than Node
18.45 - /// and Edge types should \em not derive from the same base class.
18.46 - /// For Node you should instantiate it with character 'n' and for Edge
18.47 - /// with 'e'.
18.48 -
18.49 -#ifndef DOXYGEN
18.50 - template <char _selector = '0'>
18.51 -#endif
18.52 - class GraphItem {
18.53 - public:
18.54 - /// \brief Default constructor.
18.55 - ///
18.56 - /// \warning The default constructor is not required to set
18.57 - /// the item to some well-defined value. So you should consider it
18.58 - /// as uninitialized.
18.59 - GraphItem() {}
18.60 - /// \brief Copy constructor.
18.61 - ///
18.62 - /// Copy constructor.
18.63 - ///
18.64 - GraphItem(const GraphItem &) {}
18.65 - /// \brief Invalid constructor \& conversion.
18.66 - ///
18.67 - /// This constructor initializes the item to be invalid.
18.68 - /// \sa Invalid for more details.
18.69 - GraphItem(Invalid) {}
18.70 - /// \brief Assign operator for nodes.
18.71 - ///
18.72 - /// The nodes are assignable.
18.73 - ///
18.74 - GraphItem& operator=(GraphItem const&) { return *this; }
18.75 - /// \brief Equality operator.
18.76 - ///
18.77 - /// Two iterators are equal if and only if they represents the
18.78 - /// same node in the graph or both are invalid.
18.79 - bool operator==(GraphItem) const { return false; }
18.80 - /// \brief Inequality operator.
18.81 - ///
18.82 - /// \sa operator==(const Node& n)
18.83 - ///
18.84 - bool operator!=(GraphItem) const { return false; }
18.85 -
18.86 - /// \brief Artificial ordering operator.
18.87 - ///
18.88 - /// To allow the use of graph descriptors as key type in std::map or
18.89 - /// similar associative container we require this.
18.90 - ///
18.91 - /// \note This operator only have to define some strict ordering of
18.92 - /// the items; this order has nothing to do with the iteration
18.93 - /// ordering of the items.
18.94 - bool operator<(GraphItem) const { return false; }
18.95 -
18.96 - template<typename _GraphItem>
18.97 - struct Constraints {
18.98 - void constraints() {
18.99 - _GraphItem i1;
18.100 - _GraphItem i2 = i1;
18.101 - _GraphItem i3 = INVALID;
18.102 -
18.103 - i1 = i2 = i3;
18.104 -
18.105 - bool b;
18.106 - // b = (ia == ib) && (ia != ib) && (ia < ib);
18.107 - b = (ia == ib) && (ia != ib);
18.108 - b = (ia == INVALID) && (ib != INVALID);
18.109 - b = (ia < ib);
18.110 - }
18.111 -
18.112 - const _GraphItem &ia;
18.113 - const _GraphItem &ib;
18.114 - };
18.115 - };
18.116 -
18.117 - /// \brief An empty base graph class.
18.118 - ///
18.119 - /// This class provides the minimal set of features needed for a graph
18.120 - /// structure. All graph concepts have to be conform to this base
18.121 - /// graph. It just provides types for nodes and edges and functions to
18.122 - /// get the source and the target of the edges.
18.123 - class BaseGraphComponent {
18.124 - public:
18.125 -
18.126 - typedef BaseGraphComponent Graph;
18.127 -
18.128 - /// \brief Node class of the graph.
18.129 - ///
18.130 - /// This class represents the Nodes of the graph.
18.131 - ///
18.132 - typedef GraphItem<'n'> Node;
18.133 -
18.134 - /// \brief Edge class of the graph.
18.135 - ///
18.136 - /// This class represents the Edges of the graph.
18.137 - ///
18.138 - typedef GraphItem<'e'> Edge;
18.139 -
18.140 - /// \brief Gives back the target node of an edge.
18.141 - ///
18.142 - /// Gives back the target node of an edge.
18.143 - ///
18.144 - Node target(const Edge&) const { return INVALID;}
18.145 -
18.146 - /// \brief Gives back the source node of an edge.
18.147 - ///
18.148 - /// Gives back the source node of an edge.
18.149 - ///
18.150 - Node source(const Edge&) const { return INVALID;}
18.151 -
18.152 - /// \brief Gives back the opposite node on the given edge.
18.153 - ///
18.154 - /// Gives back the opposite node on the given edge.
18.155 - Node oppositeNode(const Node&, const Edge&) const {
18.156 - return INVALID;
18.157 - }
18.158 -
18.159 - template <typename _Graph>
18.160 - struct Constraints {
18.161 - typedef typename _Graph::Node Node;
18.162 - typedef typename _Graph::Edge Edge;
18.163 -
18.164 - void constraints() {
18.165 - checkConcept<GraphItem<'n'>, Node>();
18.166 - checkConcept<GraphItem<'e'>, Edge>();
18.167 - {
18.168 - Node n;
18.169 - Edge e(INVALID);
18.170 - n = graph.source(e);
18.171 - n = graph.target(e);
18.172 - n = graph.oppositeNode(n, e);
18.173 - }
18.174 - }
18.175 -
18.176 - const _Graph& graph;
18.177 - };
18.178 - };
18.179 -
18.180 - /// \brief An empty base undirected graph class.
18.181 - ///
18.182 - /// This class provides the minimal set of features needed for an
18.183 - /// undirected graph structure. All undirected graph concepts have
18.184 - /// to be conform to this base graph. It just provides types for
18.185 - /// nodes, edges and undirected edges and functions to get the
18.186 - /// source and the target of the edges and undirected edges,
18.187 - /// conversion from edges to undirected edges and function to get
18.188 - /// both direction of the undirected edges.
18.189 - class BaseUGraphComponent : public BaseGraphComponent {
18.190 - public:
18.191 - typedef BaseGraphComponent::Node Node;
18.192 - typedef BaseGraphComponent::Edge Edge;
18.193 - /// \brief Undirected edge class of the graph.
18.194 - ///
18.195 - /// This class represents the undirected edges of the graph.
18.196 - /// The undirected graphs can be used as a directed graph which
18.197 - /// for each edge contains the opposite edge too so the graph is
18.198 - /// bidirected. The undirected edge represents two opposite
18.199 - /// directed edges.
18.200 - class UEdge : public GraphItem<'u'> {
18.201 - public:
18.202 - typedef GraphItem<'u'> Parent;
18.203 - /// \brief Default constructor.
18.204 - ///
18.205 - /// \warning The default constructor is not required to set
18.206 - /// the item to some well-defined value. So you should consider it
18.207 - /// as uninitialized.
18.208 - UEdge() {}
18.209 - /// \brief Copy constructor.
18.210 - ///
18.211 - /// Copy constructor.
18.212 - ///
18.213 - UEdge(const UEdge &) : Parent() {}
18.214 - /// \brief Invalid constructor \& conversion.
18.215 - ///
18.216 - /// This constructor initializes the item to be invalid.
18.217 - /// \sa Invalid for more details.
18.218 - UEdge(Invalid) {}
18.219 - /// \brief Converter from edge to undirected edge.
18.220 - ///
18.221 - /// Besides the core graph item functionality each edge should
18.222 - /// be convertible to the represented undirected edge.
18.223 - UEdge(const Edge&) {}
18.224 - /// \brief Assign edge to undirected edge.
18.225 - ///
18.226 - /// Besides the core graph item functionality each edge should
18.227 - /// be convertible to the represented undirected edge.
18.228 - UEdge& operator=(const Edge&) { return *this; }
18.229 - };
18.230 -
18.231 - /// \brief Returns the direction of the edge.
18.232 - ///
18.233 - /// Returns the direction of the edge. Each edge represents an
18.234 - /// undirected edge with a direction. It gives back the
18.235 - /// direction.
18.236 - bool direction(const Edge&) const { return true; }
18.237 -
18.238 - /// \brief Returns the directed edge.
18.239 - ///
18.240 - /// Returns the directed edge from its direction and the
18.241 - /// represented undirected edge.
18.242 - Edge direct(const UEdge&, bool) const { return INVALID;}
18.243 -
18.244 - /// \brief Returns the directed edge.
18.245 - ///
18.246 - /// Returns the directed edge from its source and the
18.247 - /// represented undirected edge.
18.248 - Edge direct(const UEdge&, const Node&) const { return INVALID;}
18.249 -
18.250 - /// \brief Returns the opposite edge.
18.251 - ///
18.252 - /// Returns the opposite edge. It is the edge representing the
18.253 - /// same undirected edge and has opposite direction.
18.254 - Edge oppositeEdge(const Edge&) const { return INVALID;}
18.255 -
18.256 - /// \brief Gives back the target node of an undirected edge.
18.257 - ///
18.258 - /// Gives back the target node of an undirected edge. The name
18.259 - /// target is a little confusing because the undirected edge
18.260 - /// does not have target but it just means that one of the end
18.261 - /// node.
18.262 - Node target(const UEdge&) const { return INVALID;}
18.263 -
18.264 - /// \brief Gives back the source node of an undirected edge.
18.265 - ///
18.266 - /// Gives back the source node of an undirected edge. The name
18.267 - /// source is a little confusing because the undirected edge
18.268 - /// does not have source but it just means that one of the end
18.269 - /// node.
18.270 - Node source(const UEdge&) const { return INVALID;}
18.271 -
18.272 - template <typename _Graph>
18.273 - struct Constraints {
18.274 - typedef typename _Graph::Node Node;
18.275 - typedef typename _Graph::Edge Edge;
18.276 - typedef typename _Graph::UEdge UEdge;
18.277 -
18.278 - void constraints() {
18.279 - checkConcept<BaseGraphComponent, _Graph>();
18.280 - checkConcept<GraphItem<'u'>, UEdge>();
18.281 - {
18.282 - Node n;
18.283 - UEdge ue(INVALID);
18.284 - Edge e;
18.285 - n = graph.source(ue);
18.286 - n = graph.target(ue);
18.287 - e = graph.direct(ue, true);
18.288 - e = graph.direct(ue, n);
18.289 - e = graph.oppositeEdge(e);
18.290 - ue = e;
18.291 - bool d = graph.direction(e);
18.292 - ignore_unused_variable_warning(d);
18.293 - }
18.294 - }
18.295 -
18.296 - const _Graph& graph;
18.297 - };
18.298 -
18.299 - };
18.300 -
18.301 - /// \brief An empty base bipartite undirected graph class.
18.302 - ///
18.303 - /// This class provides the minimal set of features needed for an
18.304 - /// bipartite undirected graph structure. All bipartite undirected
18.305 - /// graph concepts have to be conform to this base graph. It just
18.306 - /// provides types for nodes, A-nodes, B-nodes, edges and
18.307 - /// undirected edges and functions to get the source and the
18.308 - /// target of the edges and undirected edges, conversion from
18.309 - /// edges to undirected edges and function to get both direction
18.310 - /// of the undirected edges.
18.311 - class BaseBpUGraphComponent : public BaseUGraphComponent {
18.312 - public:
18.313 - typedef BaseUGraphComponent::Node Node;
18.314 - typedef BaseUGraphComponent::Edge Edge;
18.315 - typedef BaseUGraphComponent::UEdge UEdge;
18.316 -
18.317 - /// \brief Helper class for A-nodes.
18.318 - ///
18.319 - /// This class is just a helper class for A-nodes, it is not
18.320 - /// suggested to use it directly. It can be converted easily to
18.321 - /// node and vice versa. The usage of this class is limited
18.322 - /// to use just as template parameters for special map types.
18.323 - class ANode : public Node {
18.324 - public:
18.325 - typedef Node Parent;
18.326 -
18.327 - /// \brief Default constructor.
18.328 - ///
18.329 - /// \warning The default constructor is not required to set
18.330 - /// the item to some well-defined value. So you should consider it
18.331 - /// as uninitialized.
18.332 - ANode() {}
18.333 - /// \brief Copy constructor.
18.334 - ///
18.335 - /// Copy constructor.
18.336 - ///
18.337 - ANode(const ANode &) : Parent() {}
18.338 - /// \brief Invalid constructor \& conversion.
18.339 - ///
18.340 - /// This constructor initializes the item to be invalid.
18.341 - /// \sa Invalid for more details.
18.342 - ANode(Invalid) {}
18.343 - /// \brief Converter from node to A-node.
18.344 - ///
18.345 - /// Besides the core graph item functionality each node should
18.346 - /// be convertible to the represented A-node if it is it possible.
18.347 - ANode(const Node&) {}
18.348 - /// \brief Assign node to A-node.
18.349 - ///
18.350 - /// Besides the core graph item functionality each node should
18.351 - /// be convertible to the represented A-node if it is it possible.
18.352 - ANode& operator=(const Node&) { return *this; }
18.353 - };
18.354 -
18.355 - /// \brief Helper class for B-nodes.
18.356 - ///
18.357 - /// This class is just a helper class for B-nodes, it is not
18.358 - /// suggested to use it directly. It can be converted easily to
18.359 - /// node and vice versa. The usage of this class is limited
18.360 - /// to use just as template parameters for special map types.
18.361 - class BNode : public Node {
18.362 - public:
18.363 - typedef Node Parent;
18.364 -
18.365 - /// \brief Default constructor.
18.366 - ///
18.367 - /// \warning The default constructor is not required to set
18.368 - /// the item to some well-defined value. So you should consider it
18.369 - /// as uninitialized.
18.370 - BNode() {}
18.371 - /// \brief Copy constructor.
18.372 - ///
18.373 - /// Copy constructor.
18.374 - ///
18.375 - BNode(const BNode &) : Parent() {}
18.376 - /// \brief Invalid constructor \& conversion.
18.377 - ///
18.378 - /// This constructor initializes the item to be invalid.
18.379 - /// \sa Invalid for more details.
18.380 - BNode(Invalid) {}
18.381 - /// \brief Converter from node to B-node.
18.382 - ///
18.383 - /// Besides the core graph item functionality each node should
18.384 - /// be convertible to the represented B-node if it is it possible.
18.385 - BNode(const Node&) {}
18.386 - /// \brief Assign node to B-node.
18.387 - ///
18.388 - /// Besides the core graph item functionality each node should
18.389 - /// be convertible to the represented B-node if it is it possible.
18.390 - BNode& operator=(const Node&) { return *this; }
18.391 - };
18.392 -
18.393 - /// \brief Gives back %true when the node is A-node.
18.394 - ///
18.395 - /// Gives back %true when the node is A-node.
18.396 - bool aNode(const Node&) const { return false; }
18.397 -
18.398 - /// \brief Gives back %true when the node is B-node.
18.399 - ///
18.400 - /// Gives back %true when the node is B-node.
18.401 - bool bNode(const Node&) const { return false; }
18.402 -
18.403 - /// \brief Gives back the A-node of the undirected edge.
18.404 - ///
18.405 - /// Gives back the A-node of the undirected edge.
18.406 - Node aNode(const UEdge&) const { return INVALID; }
18.407 -
18.408 - /// \brief Gives back the B-node of the undirected edge.
18.409 - ///
18.410 - /// Gives back the B-node of the undirected edge.
18.411 - Node bNode(const UEdge&) const { return INVALID; }
18.412 -
18.413 - template <typename _Graph>
18.414 - struct Constraints {
18.415 - typedef typename _Graph::Node Node;
18.416 - typedef typename _Graph::ANode ANode;
18.417 - typedef typename _Graph::BNode BNode;
18.418 - typedef typename _Graph::Edge Edge;
18.419 - typedef typename _Graph::UEdge UEdge;
18.420 -
18.421 - void constraints() {
18.422 - checkConcept<BaseUGraphComponent, _Graph>();
18.423 - checkConcept<GraphItem<'a'>, ANode>();
18.424 - checkConcept<GraphItem<'b'>, BNode>();
18.425 - {
18.426 - Node n;
18.427 - UEdge ue(INVALID);
18.428 - bool b;
18.429 - n = graph.aNode(ue);
18.430 - n = graph.bNode(ue);
18.431 - b = graph.aNode(n);
18.432 - b = graph.bNode(n);
18.433 - ANode an;
18.434 - an = n; n = an;
18.435 - BNode bn;
18.436 - bn = n; n = bn;
18.437 - ignore_unused_variable_warning(b);
18.438 - }
18.439 - }
18.440 -
18.441 - const _Graph& graph;
18.442 - };
18.443 -
18.444 - };
18.445 -
18.446 - /// \brief An empty idable base graph class.
18.447 - ///
18.448 - /// This class provides beside the core graph features
18.449 - /// core id functions for the graph structure.
18.450 - /// The most of the base graphs should be conform to this concept.
18.451 - /// The id's are unique and immutable.
18.452 - template <typename _Base = BaseGraphComponent>
18.453 - class IDableGraphComponent : public _Base {
18.454 - public:
18.455 -
18.456 - typedef _Base Base;
18.457 - typedef typename Base::Node Node;
18.458 - typedef typename Base::Edge Edge;
18.459 -
18.460 - /// \brief Gives back an unique integer id for the Node.
18.461 - ///
18.462 - /// Gives back an unique integer id for the Node.
18.463 - ///
18.464 - int id(const Node&) const { return -1;}
18.465 -
18.466 - /// \brief Gives back the node by the unique id.
18.467 - ///
18.468 - /// Gives back the node by the unique id.
18.469 - /// If the graph does not contain node with the given id
18.470 - /// then the result of the function is undetermined.
18.471 - Node nodeFromId(int) const { return INVALID;}
18.472 -
18.473 - /// \brief Gives back an unique integer id for the Edge.
18.474 - ///
18.475 - /// Gives back an unique integer id for the Edge.
18.476 - ///
18.477 - int id(const Edge&) const { return -1;}
18.478 -
18.479 - /// \brief Gives back the edge by the unique id.
18.480 - ///
18.481 - /// Gives back the edge by the unique id.
18.482 - /// If the graph does not contain edge with the given id
18.483 - /// then the result of the function is undetermined.
18.484 - Edge edgeFromId(int) const { return INVALID;}
18.485 -
18.486 - /// \brief Gives back an integer greater or equal to the maximum
18.487 - /// Node id.
18.488 - ///
18.489 - /// Gives back an integer greater or equal to the maximum Node
18.490 - /// id.
18.491 - int maxNodeId() const { return -1;}
18.492 -
18.493 - /// \brief Gives back an integer greater or equal to the maximum
18.494 - /// Edge id.
18.495 - ///
18.496 - /// Gives back an integer greater or equal to the maximum Edge
18.497 - /// id.
18.498 - int maxEdgeId() const { return -1;}
18.499 -
18.500 - template <typename _Graph>
18.501 - struct Constraints {
18.502 -
18.503 - void constraints() {
18.504 - checkConcept<Base, _Graph >();
18.505 - typename _Graph::Node node;
18.506 - int nid = graph.id(node);
18.507 - nid = graph.id(node);
18.508 - node = graph.nodeFromId(nid);
18.509 - typename _Graph::Edge edge;
18.510 - int eid = graph.id(edge);
18.511 - eid = graph.id(edge);
18.512 - edge = graph.edgeFromId(eid);
18.513 -
18.514 - nid = graph.maxNodeId();
18.515 - ignore_unused_variable_warning(nid);
18.516 - eid = graph.maxEdgeId();
18.517 - ignore_unused_variable_warning(eid);
18.518 - }
18.519 -
18.520 - const _Graph& graph;
18.521 - };
18.522 - };
18.523 -
18.524 - /// \brief An empty idable base undirected graph class.
18.525 - ///
18.526 - /// This class provides beside the core undirected graph features
18.527 - /// core id functions for the undirected graph structure. The
18.528 - /// most of the base undirected graphs should be conform to this
18.529 - /// concept. The id's are unique and immutable.
18.530 - template <typename _Base = BaseUGraphComponent>
18.531 - class IDableUGraphComponent : public IDableGraphComponent<_Base> {
18.532 - public:
18.533 -
18.534 - typedef _Base Base;
18.535 - typedef typename Base::UEdge UEdge;
18.536 -
18.537 - using IDableGraphComponent<_Base>::id;
18.538 -
18.539 - /// \brief Gives back an unique integer id for the UEdge.
18.540 - ///
18.541 - /// Gives back an unique integer id for the UEdge.
18.542 - ///
18.543 - int id(const UEdge&) const { return -1;}
18.544 -
18.545 - /// \brief Gives back the undirected edge by the unique id.
18.546 - ///
18.547 - /// Gives back the undirected edge by the unique id. If the
18.548 - /// graph does not contain edge with the given id then the
18.549 - /// result of the function is undetermined.
18.550 - UEdge uEdgeFromId(int) const { return INVALID;}
18.551 -
18.552 - /// \brief Gives back an integer greater or equal to the maximum
18.553 - /// UEdge id.
18.554 - ///
18.555 - /// Gives back an integer greater or equal to the maximum UEdge
18.556 - /// id.
18.557 - int maxUEdgeId() const { return -1;}
18.558 -
18.559 - template <typename _Graph>
18.560 - struct Constraints {
18.561 -
18.562 - void constraints() {
18.563 - checkConcept<Base, _Graph >();
18.564 - checkConcept<IDableGraphComponent<Base>, _Graph >();
18.565 - typename _Graph::UEdge uedge;
18.566 - int ueid = graph.id(uedge);
18.567 - ueid = graph.id(uedge);
18.568 - uedge = graph.uEdgeFromId(ueid);
18.569 - ueid = graph.maxUEdgeId();
18.570 - ignore_unused_variable_warning(ueid);
18.571 - }
18.572 -
18.573 - const _Graph& graph;
18.574 - };
18.575 - };
18.576 -
18.577 - /// \brief An empty idable base bipartite undirected graph class.
18.578 - ///
18.579 - /// This class provides beside the core bipartite undirected graph
18.580 - /// features core id functions for the bipartite undirected graph
18.581 - /// structure. The most of the base undirected graphs should be
18.582 - /// conform to this concept.
18.583 - template <typename _Base = BaseBpUGraphComponent>
18.584 - class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> {
18.585 - public:
18.586 -
18.587 - typedef _Base Base;
18.588 - typedef typename Base::Node Node;
18.589 -
18.590 - using IDableUGraphComponent<_Base>::id;
18.591 -
18.592 - /// \brief Gives back an unique integer id for the ANode.
18.593 - ///
18.594 - /// Gives back an unique integer id for the ANode.
18.595 - ///
18.596 - int aNodeId(const Node&) const { return -1;}
18.597 -
18.598 - /// \brief Gives back the undirected edge by the unique id.
18.599 - ///
18.600 - /// Gives back the undirected edge by the unique id. If the
18.601 - /// graph does not contain edge with the given id then the
18.602 - /// result of the function is undetermined.
18.603 - Node nodeFromANodeId(int) const { return INVALID;}
18.604 -
18.605 - /// \brief Gives back an integer greater or equal to the maximum
18.606 - /// ANode id.
18.607 - ///
18.608 - /// Gives back an integer greater or equal to the maximum ANode
18.609 - /// id.
18.610 - int maxANodeId() const { return -1;}
18.611 -
18.612 - /// \brief Gives back an unique integer id for the BNode.
18.613 - ///
18.614 - /// Gives back an unique integer id for the BNode.
18.615 - ///
18.616 - int bNodeId(const Node&) const { return -1;}
18.617 -
18.618 - /// \brief Gives back the undirected edge by the unique id.
18.619 - ///
18.620 - /// Gives back the undirected edge by the unique id. If the
18.621 - /// graph does not contain edge with the given id then the
18.622 - /// result of the function is undetermined.
18.623 - Node nodeFromBNodeId(int) const { return INVALID;}
18.624 -
18.625 - /// \brief Gives back an integer greater or equal to the maximum
18.626 - /// BNode id.
18.627 - ///
18.628 - /// Gives back an integer greater or equal to the maximum BNode
18.629 - /// id.
18.630 - int maxBNodeId() const { return -1;}
18.631 -
18.632 - template <typename _Graph>
18.633 - struct Constraints {
18.634 -
18.635 - void constraints() {
18.636 - checkConcept<Base, _Graph >();
18.637 - checkConcept<IDableGraphComponent<Base>, _Graph >();
18.638 - typename _Graph::Node node(INVALID);
18.639 - int id;
18.640 - id = graph.aNodeId(node);
18.641 - id = graph.bNodeId(node);
18.642 - node = graph.nodeFromANodeId(id);
18.643 - node = graph.nodeFromBNodeId(id);
18.644 - id = graph.maxANodeId();
18.645 - id = graph.maxBNodeId();
18.646 - }
18.647 -
18.648 - const _Graph& graph;
18.649 - };
18.650 - };
18.651 -
18.652 - /// \brief Skeleton class for graph NodeIt and EdgeIt
18.653 - ///
18.654 - /// Skeleton class for graph NodeIt and EdgeIt.
18.655 - ///
18.656 - template <typename _Graph, typename _Item>
18.657 - class GraphItemIt : public _Item {
18.658 - public:
18.659 - /// \brief Default constructor.
18.660 - ///
18.661 - /// @warning The default constructor sets the iterator
18.662 - /// to an undefined value.
18.663 - GraphItemIt() {}
18.664 - /// \brief Copy constructor.
18.665 - ///
18.666 - /// Copy constructor.
18.667 - ///
18.668 - GraphItemIt(const GraphItemIt& ) {}
18.669 - /// \brief Sets the iterator to the first item.
18.670 - ///
18.671 - /// Sets the iterator to the first item of \c the graph.
18.672 - ///
18.673 - explicit GraphItemIt(const _Graph&) {}
18.674 - /// \brief Invalid constructor \& conversion.
18.675 - ///
18.676 - /// This constructor initializes the item to be invalid.
18.677 - /// \sa Invalid for more details.
18.678 - GraphItemIt(Invalid) {}
18.679 - /// \brief Assign operator for items.
18.680 - ///
18.681 - /// The items are assignable.
18.682 - ///
18.683 - GraphItemIt& operator=(const GraphItemIt&) { return *this; }
18.684 - /// \brief Next item.
18.685 - ///
18.686 - /// Assign the iterator to the next item.
18.687 - ///
18.688 - GraphItemIt& operator++() { return *this; }
18.689 - /// \brief Equality operator
18.690 - ///
18.691 - /// Two iterators are equal if and only if they point to the
18.692 - /// same object or both are invalid.
18.693 - bool operator==(const GraphItemIt&) const { return true;}
18.694 - /// \brief Inequality operator
18.695 - ///
18.696 - /// \sa operator==(Node n)
18.697 - ///
18.698 - bool operator!=(const GraphItemIt&) const { return true;}
18.699 -
18.700 - template<typename _GraphItemIt>
18.701 - struct Constraints {
18.702 - void constraints() {
18.703 - _GraphItemIt it1(g);
18.704 - _GraphItemIt it2;
18.705 -
18.706 - it2 = ++it1;
18.707 - ++it2 = it1;
18.708 - ++(++it1);
18.709 -
18.710 - _Item bi = it1;
18.711 - bi = it2;
18.712 - }
18.713 - _Graph& g;
18.714 - };
18.715 - };
18.716 -
18.717 - /// \brief Skeleton class for graph InEdgeIt and OutEdgeIt
18.718 - ///
18.719 - /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same
18.720 - /// base class, the _selector is a additional template parameter. For
18.721 - /// InEdgeIt you should instantiate it with character 'i' and for
18.722 - /// OutEdgeIt with 'o'.
18.723 - template <typename _Graph,
18.724 - typename _Item = typename _Graph::Edge,
18.725 - typename _Base = typename _Graph::Node,
18.726 - char _selector = '0'>
18.727 - class GraphIncIt : public _Item {
18.728 - public:
18.729 - /// \brief Default constructor.
18.730 - ///
18.731 - /// @warning The default constructor sets the iterator
18.732 - /// to an undefined value.
18.733 - GraphIncIt() {}
18.734 - /// \brief Copy constructor.
18.735 - ///
18.736 - /// Copy constructor.
18.737 - ///
18.738 - GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
18.739 - /// \brief Sets the iterator to the first edge incoming into or outgoing
18.740 - /// from the node.
18.741 - ///
18.742 - /// Sets the iterator to the first edge incoming into or outgoing
18.743 - /// from the node.
18.744 - ///
18.745 - explicit GraphIncIt(const _Graph&, const _Base&) {}
18.746 - /// \brief Invalid constructor \& conversion.
18.747 - ///
18.748 - /// This constructor initializes the item to be invalid.
18.749 - /// \sa Invalid for more details.
18.750 - GraphIncIt(Invalid) {}
18.751 - /// \brief Assign operator for iterators.
18.752 - ///
18.753 - /// The iterators are assignable.
18.754 - ///
18.755 - GraphIncIt& operator=(GraphIncIt const&) { return *this; }
18.756 - /// \brief Next item.
18.757 - ///
18.758 - /// Assign the iterator to the next item.
18.759 - ///
18.760 - GraphIncIt& operator++() { return *this; }
18.761 -
18.762 - /// \brief Equality operator
18.763 - ///
18.764 - /// Two iterators are equal if and only if they point to the
18.765 - /// same object or both are invalid.
18.766 - bool operator==(const GraphIncIt&) const { return true;}
18.767 -
18.768 - /// \brief Inequality operator
18.769 - ///
18.770 - /// \sa operator==(Node n)
18.771 - ///
18.772 - bool operator!=(const GraphIncIt&) const { return true;}
18.773 -
18.774 - template <typename _GraphIncIt>
18.775 - struct Constraints {
18.776 - void constraints() {
18.777 - checkConcept<GraphItem<_selector>, _GraphIncIt>();
18.778 - _GraphIncIt it1(graph, node);
18.779 - _GraphIncIt it2;
18.780 -
18.781 - it2 = ++it1;
18.782 - ++it2 = it1;
18.783 - ++(++it1);
18.784 - _Item e = it1;
18.785 - e = it2;
18.786 -
18.787 - }
18.788 -
18.789 - _Item edge;
18.790 - _Base node;
18.791 - _Graph graph;
18.792 - _GraphIncIt it;
18.793 - };
18.794 - };
18.795 -
18.796 -
18.797 - /// \brief An empty iterable graph class.
18.798 - ///
18.799 - /// This class provides beside the core graph features
18.800 - /// iterator based iterable interface for the graph structure.
18.801 - /// This concept is part of the Graph concept.
18.802 - template <typename _Base = BaseGraphComponent>
18.803 - class IterableGraphComponent : public _Base {
18.804 -
18.805 - public:
18.806 -
18.807 - typedef _Base Base;
18.808 - typedef typename Base::Node Node;
18.809 - typedef typename Base::Edge Edge;
18.810 -
18.811 - typedef IterableGraphComponent Graph;
18.812 -
18.813 - /// \name Base iteration
18.814 - ///
18.815 - /// This interface provides functions for iteration on graph items
18.816 - ///
18.817 - /// @{
18.818 -
18.819 - /// \brief Gives back the first node in the iterating order.
18.820 - ///
18.821 - /// Gives back the first node in the iterating order.
18.822 - ///
18.823 - void first(Node&) const {}
18.824 -
18.825 - /// \brief Gives back the next node in the iterating order.
18.826 - ///
18.827 - /// Gives back the next node in the iterating order.
18.828 - ///
18.829 - void next(Node&) const {}
18.830 -
18.831 - /// \brief Gives back the first edge in the iterating order.
18.832 - ///
18.833 - /// Gives back the first edge in the iterating order.
18.834 - ///
18.835 - void first(Edge&) const {}
18.836 -
18.837 - /// \brief Gives back the next edge in the iterating order.
18.838 - ///
18.839 - /// Gives back the next edge in the iterating order.
18.840 - ///
18.841 - void next(Edge&) const {}
18.842 -
18.843 -
18.844 - /// \brief Gives back the first of the edges point to the given
18.845 - /// node.
18.846 - ///
18.847 - /// Gives back the first of the edges point to the given node.
18.848 - ///
18.849 - void firstIn(Edge&, const Node&) const {}
18.850 -
18.851 - /// \brief Gives back the next of the edges points to the given
18.852 - /// node.
18.853 - ///
18.854 - /// Gives back the next of the edges points to the given node.
18.855 - ///
18.856 - void nextIn(Edge&) const {}
18.857 -
18.858 - /// \brief Gives back the first of the edges start from the
18.859 - /// given node.
18.860 - ///
18.861 - /// Gives back the first of the edges start from the given node.
18.862 - ///
18.863 - void firstOut(Edge&, const Node&) const {}
18.864 -
18.865 - /// \brief Gives back the next of the edges start from the given
18.866 - /// node.
18.867 - ///
18.868 - /// Gives back the next of the edges start from the given node.
18.869 - ///
18.870 - void nextOut(Edge&) const {}
18.871 -
18.872 - /// @}
18.873 -
18.874 - /// \name Class based iteration
18.875 - ///
18.876 - /// This interface provides functions for iteration on graph items
18.877 - ///
18.878 - /// @{
18.879 -
18.880 - /// \brief This iterator goes through each node.
18.881 - ///
18.882 - /// This iterator goes through each node.
18.883 - ///
18.884 - typedef GraphItemIt<Graph, Node> NodeIt;
18.885 -
18.886 - /// \brief This iterator goes through each node.
18.887 - ///
18.888 - /// This iterator goes through each node.
18.889 - ///
18.890 - typedef GraphItemIt<Graph, Edge> EdgeIt;
18.891 -
18.892 - /// \brief This iterator goes trough the incoming edges of a node.
18.893 - ///
18.894 - /// This iterator goes trough the \e inccoming edges of a certain node
18.895 - /// of a graph.
18.896 - typedef GraphIncIt<Graph, Edge, Node, 'i'> InEdgeIt;
18.897 -
18.898 - /// \brief This iterator goes trough the outgoing edges of a node.
18.899 - ///
18.900 - /// This iterator goes trough the \e outgoing edges of a certain node
18.901 - /// of a graph.
18.902 - typedef GraphIncIt<Graph, Edge, Node, 'o'> OutEdgeIt;
18.903 -
18.904 - /// \brief The base node of the iterator.
18.905 - ///
18.906 - /// Gives back the base node of the iterator.
18.907 - /// It is always the target of the pointed edge.
18.908 - Node baseNode(const InEdgeIt&) const { return INVALID; }
18.909 -
18.910 - /// \brief The running node of the iterator.
18.911 - ///
18.912 - /// Gives back the running node of the iterator.
18.913 - /// It is always the source of the pointed edge.
18.914 - Node runningNode(const InEdgeIt&) const { return INVALID; }
18.915 -
18.916 - /// \brief The base node of the iterator.
18.917 - ///
18.918 - /// Gives back the base node of the iterator.
18.919 - /// It is always the source of the pointed edge.
18.920 - Node baseNode(const OutEdgeIt&) const { return INVALID; }
18.921 -
18.922 - /// \brief The running node of the iterator.
18.923 - ///
18.924 - /// Gives back the running node of the iterator.
18.925 - /// It is always the target of the pointed edge.
18.926 - Node runningNode(const OutEdgeIt&) const { return INVALID; }
18.927 -
18.928 - /// @}
18.929 -
18.930 - template <typename _Graph>
18.931 - struct Constraints {
18.932 - void constraints() {
18.933 - checkConcept<Base, _Graph>();
18.934 -
18.935 - {
18.936 - typename _Graph::Node node(INVALID);
18.937 - typename _Graph::Edge edge(INVALID);
18.938 - {
18.939 - graph.first(node);
18.940 - graph.next(node);
18.941 - }
18.942 - {
18.943 - graph.first(edge);
18.944 - graph.next(edge);
18.945 - }
18.946 - {
18.947 - graph.firstIn(edge, node);
18.948 - graph.nextIn(edge);
18.949 - }
18.950 - {
18.951 - graph.firstOut(edge, node);
18.952 - graph.nextOut(edge);
18.953 - }
18.954 - }
18.955 -
18.956 - {
18.957 - checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
18.958 - typename _Graph::EdgeIt >();
18.959 - checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
18.960 - typename _Graph::NodeIt >();
18.961 - checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
18.962 - typename _Graph::Node, 'i'>, typename _Graph::InEdgeIt>();
18.963 - checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
18.964 - typename _Graph::Node, 'o'>, typename _Graph::OutEdgeIt>();
18.965 -
18.966 - typename _Graph::Node n;
18.967 - typename _Graph::InEdgeIt ieit(INVALID);
18.968 - typename _Graph::OutEdgeIt oeit(INVALID);
18.969 - n = graph.baseNode(ieit);
18.970 - n = graph.runningNode(ieit);
18.971 - n = graph.baseNode(oeit);
18.972 - n = graph.runningNode(oeit);
18.973 - ignore_unused_variable_warning(n);
18.974 - }
18.975 - }
18.976 -
18.977 - const _Graph& graph;
18.978 -
18.979 - };
18.980 - };
18.981 -
18.982 - /// \brief An empty iterable undirected graph class.
18.983 - ///
18.984 - /// This class provides beside the core graph features iterator
18.985 - /// based iterable interface for the undirected graph structure.
18.986 - /// This concept is part of the UGraph concept.
18.987 - template <typename _Base = BaseUGraphComponent>
18.988 - class IterableUGraphComponent : public IterableGraphComponent<_Base> {
18.989 - public:
18.990 -
18.991 - typedef _Base Base;
18.992 - typedef typename Base::Node Node;
18.993 - typedef typename Base::Edge Edge;
18.994 - typedef typename Base::UEdge UEdge;
18.995 -
18.996 -
18.997 - typedef IterableUGraphComponent Graph;
18.998 -
18.999 - /// \name Base iteration
18.1000 - ///
18.1001 - /// This interface provides functions for iteration on graph items
18.1002 - /// @{
18.1003 -
18.1004 - using IterableGraphComponent<_Base>::first;
18.1005 - using IterableGraphComponent<_Base>::next;
18.1006 -
18.1007 - /// \brief Gives back the first undirected edge in the iterating
18.1008 - /// order.
18.1009 - ///
18.1010 - /// Gives back the first undirected edge in the iterating order.
18.1011 - ///
18.1012 - void first(UEdge&) const {}
18.1013 -
18.1014 - /// \brief Gives back the next undirected edge in the iterating
18.1015 - /// order.
18.1016 - ///
18.1017 - /// Gives back the next undirected edge in the iterating order.
18.1018 - ///
18.1019 - void next(UEdge&) const {}
18.1020 -
18.1021 -
18.1022 - /// \brief Gives back the first of the undirected edges from the
18.1023 - /// given node.
18.1024 - ///
18.1025 - /// Gives back the first of the undirected edges from the given
18.1026 - /// node. The bool parameter gives back that direction which
18.1027 - /// gives a good direction of the uedge so the source of the
18.1028 - /// directed edge is the given node.
18.1029 - void firstInc(UEdge&, bool&, const Node&) const {}
18.1030 -
18.1031 - /// \brief Gives back the next of the undirected edges from the
18.1032 - /// given node.
18.1033 - ///
18.1034 - /// Gives back the next of the undirected edges from the given
18.1035 - /// node. The bool parameter should be used as the \c firstInc()
18.1036 - /// use it.
18.1037 - void nextInc(UEdge&, bool&) const {}
18.1038 -
18.1039 - using IterableGraphComponent<_Base>::baseNode;
18.1040 - using IterableGraphComponent<_Base>::runningNode;
18.1041 -
18.1042 - /// @}
18.1043 -
18.1044 - /// \name Class based iteration
18.1045 - ///
18.1046 - /// This interface provides functions for iteration on graph items
18.1047 - ///
18.1048 - /// @{
18.1049 -
18.1050 - /// \brief This iterator goes through each node.
18.1051 - ///
18.1052 - /// This iterator goes through each node.
18.1053 - typedef GraphItemIt<Graph, UEdge> UEdgeIt;
18.1054 - /// \brief This iterator goes trough the incident edges of a
18.1055 - /// node.
18.1056 - ///
18.1057 - /// This iterator goes trough the incident edges of a certain
18.1058 - /// node of a graph.
18.1059 - typedef GraphIncIt<Graph, UEdge, Node, 'u'> IncEdgeIt;
18.1060 - /// \brief The base node of the iterator.
18.1061 - ///
18.1062 - /// Gives back the base node of the iterator.
18.1063 - Node baseNode(const IncEdgeIt&) const { return INVALID; }
18.1064 -
18.1065 - /// \brief The running node of the iterator.
18.1066 - ///
18.1067 - /// Gives back the running node of the iterator.
18.1068 - Node runningNode(const IncEdgeIt&) const { return INVALID; }
18.1069 -
18.1070 - /// @}
18.1071 -
18.1072 - template <typename _Graph>
18.1073 - struct Constraints {
18.1074 - void constraints() {
18.1075 - checkConcept<IterableGraphComponent<Base>, _Graph>();
18.1076 -
18.1077 - {
18.1078 - typename _Graph::Node node(INVALID);
18.1079 - typename _Graph::UEdge uedge(INVALID);
18.1080 - bool dir;
18.1081 - {
18.1082 - graph.first(uedge);
18.1083 - graph.next(uedge);
18.1084 - }
18.1085 - {
18.1086 - graph.firstInc(uedge, dir, node);
18.1087 - graph.nextInc(uedge, dir);
18.1088 - }
18.1089 -
18.1090 - }
18.1091 -
18.1092 - {
18.1093 - checkConcept<GraphItemIt<_Graph, typename _Graph::UEdge>,
18.1094 - typename _Graph::UEdgeIt >();
18.1095 - checkConcept<GraphIncIt<_Graph, typename _Graph::UEdge,
18.1096 - typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
18.1097 -
18.1098 - typename _Graph::Node n;
18.1099 - typename _Graph::IncEdgeIt ueit(INVALID);
18.1100 - n = graph.baseNode(ueit);
18.1101 - n = graph.runningNode(ueit);
18.1102 - }
18.1103 - }
18.1104 -
18.1105 - const _Graph& graph;
18.1106 -
18.1107 - };
18.1108 - };
18.1109 -
18.1110 - /// \brief An empty iterable bipartite undirected graph class.
18.1111 - ///
18.1112 - /// This class provides beside the core graph features iterator
18.1113 - /// based iterable interface for the bipartite undirected graph
18.1114 - /// structure. This concept is part of the BpUGraph concept.
18.1115 - template <typename _Base = BaseUGraphComponent>
18.1116 - class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> {
18.1117 - public:
18.1118 -
18.1119 - typedef _Base Base;
18.1120 - typedef typename Base::Node Node;
18.1121 - typedef typename Base::UEdge UEdge;
18.1122 -
18.1123 - typedef IterableBpUGraphComponent Graph;
18.1124 -
18.1125 - /// \name Base iteration
18.1126 - ///
18.1127 - /// This interface provides functions for iteration on graph items
18.1128 - /// @{
18.1129 -
18.1130 - using IterableUGraphComponent<_Base>::first;
18.1131 - using IterableUGraphComponent<_Base>::next;
18.1132 -
18.1133 - /// \brief Gives back the first A-node in the iterating order.
18.1134 - ///
18.1135 - /// Gives back the first undirected A-node in the iterating
18.1136 - /// order.
18.1137 - ///
18.1138 - void firstANode(Node&) const {}
18.1139 -
18.1140 - /// \brief Gives back the next A-node in the iterating order.
18.1141 - ///
18.1142 - /// Gives back the next A-node in the iterating order.
18.1143 - ///
18.1144 - void nextANode(Node&) const {}
18.1145 -
18.1146 - /// \brief Gives back the first B-node in the iterating order.
18.1147 - ///
18.1148 - /// Gives back the first undirected B-node in the iterating
18.1149 - /// order.
18.1150 - ///
18.1151 - void firstBNode(Node&) const {}
18.1152 -
18.1153 - /// \brief Gives back the next B-node in the iterating order.
18.1154 - ///
18.1155 - /// Gives back the next B-node in the iterating order.
18.1156 - ///
18.1157 - void nextBNode(Node&) const {}
18.1158 -
18.1159 -
18.1160 - /// \brief Gives back the first of the undirected edges start
18.1161 - /// from the given A-node.
18.1162 - ///
18.1163 - /// Gives back the first of the undirected edges start from the
18.1164 - /// given A-node.
18.1165 - void firstFromANode(UEdge&, const Node&) const {}
18.1166 -
18.1167 - /// \brief Gives back the next of the undirected edges start
18.1168 - /// from the given A-node.
18.1169 - ///
18.1170 - /// Gives back the next of the undirected edges start from the
18.1171 - /// given A-node.
18.1172 - void nextFromANode(UEdge&) const {}
18.1173 -
18.1174 - /// \brief Gives back the first of the undirected edges start
18.1175 - /// from the given B-node.
18.1176 - ///
18.1177 - /// Gives back the first of the undirected edges start from the
18.1178 - /// given B-node.
18.1179 - void firstFromBNode(UEdge&, const Node&) const {}
18.1180 -
18.1181 - /// \brief Gives back the next of the undirected edges start
18.1182 - /// from the given B-node.
18.1183 - ///
18.1184 - /// Gives back the next of the undirected edges start from the
18.1185 - /// given B-node.
18.1186 - void nextFromBNode(UEdge&) const {}
18.1187 -
18.1188 -
18.1189 - /// @}
18.1190 -
18.1191 - /// \name Class based iteration
18.1192 - ///
18.1193 - /// This interface provides functions for iteration on graph items
18.1194 - ///
18.1195 - /// @{
18.1196 -
18.1197 - /// \brief This iterator goes through each A-node.
18.1198 - ///
18.1199 - /// This iterator goes through each A-node.
18.1200 - typedef GraphItemIt<Graph, Node> ANodeIt;
18.1201 -
18.1202 - /// \brief This iterator goes through each B-node.
18.1203 - ///
18.1204 - /// This iterator goes through each B-node.
18.1205 - typedef GraphItemIt<Graph, Node> BNodeIt;
18.1206 -
18.1207 - /// @}
18.1208 -
18.1209 - template <typename _Graph>
18.1210 - struct Constraints {
18.1211 - void constraints() {
18.1212 - checkConcept<IterableUGraphComponent<Base>, _Graph>();
18.1213 -
18.1214 - {
18.1215 - typename _Graph::Node node(INVALID);
18.1216 - typename _Graph::UEdge uedge(INVALID);
18.1217 - graph.firstANode(node);
18.1218 - graph.nextANode(node);
18.1219 - graph.firstBNode(node);
18.1220 - graph.nextBNode(node);
18.1221 -
18.1222 - graph.firstFromANode(uedge, node);
18.1223 - graph.nextFromANode(uedge);
18.1224 - graph.firstFromBNode(uedge, node);
18.1225 - graph.nextFromBNode(uedge);
18.1226 - }
18.1227 - {
18.1228 - checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
18.1229 - typename _Graph::ANodeIt >();
18.1230 - checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
18.1231 - typename _Graph::BNodeIt >();
18.1232 - }
18.1233 -
18.1234 - }
18.1235 -
18.1236 - const _Graph& graph;
18.1237 -
18.1238 - };
18.1239 - };
18.1240 -
18.1241 - /// \brief An empty alteration notifier graph class.
18.1242 - ///
18.1243 - /// This class provides beside the core graph features alteration
18.1244 - /// notifier interface for the graph structure. This implements
18.1245 - /// an observer-notifier pattern for each graph item. More
18.1246 - /// obsevers can be registered into the notifier and whenever an
18.1247 - /// alteration occured in the graph all the observers will
18.1248 - /// notified about it.
18.1249 - template <typename _Base = BaseGraphComponent>
18.1250 - class AlterableGraphComponent : public _Base {
18.1251 - public:
18.1252 -
18.1253 - typedef _Base Base;
18.1254 - typedef typename Base::Node Node;
18.1255 - typedef typename Base::Edge Edge;
18.1256 -
18.1257 -
18.1258 - /// The node observer registry.
18.1259 - typedef AlterationNotifier<AlterableGraphComponent, Node>
18.1260 - NodeNotifier;
18.1261 - /// The edge observer registry.
18.1262 - typedef AlterationNotifier<AlterableGraphComponent, Edge>
18.1263 - EdgeNotifier;
18.1264 -
18.1265 - /// \brief Gives back the node alteration notifier.
18.1266 - ///
18.1267 - /// Gives back the node alteration notifier.
18.1268 - NodeNotifier& getNotifier(Node) const {
18.1269 - return NodeNotifier();
18.1270 - }
18.1271 -
18.1272 - /// \brief Gives back the edge alteration notifier.
18.1273 - ///
18.1274 - /// Gives back the edge alteration notifier.
18.1275 - EdgeNotifier& getNotifier(Edge) const {
18.1276 - return EdgeNotifier();
18.1277 - }
18.1278 -
18.1279 - template <typename _Graph>
18.1280 - struct Constraints {
18.1281 - void constraints() {
18.1282 - checkConcept<Base, _Graph>();
18.1283 - typename _Graph::NodeNotifier& nn
18.1284 - = graph.getNotifier(typename _Graph::Node());
18.1285 -
18.1286 - typename _Graph::EdgeNotifier& en
18.1287 - = graph.getNotifier(typename _Graph::Edge());
18.1288 -
18.1289 - ignore_unused_variable_warning(nn);
18.1290 - ignore_unused_variable_warning(en);
18.1291 - }
18.1292 -
18.1293 - const _Graph& graph;
18.1294 -
18.1295 - };
18.1296 -
18.1297 - };
18.1298 -
18.1299 - /// \brief An empty alteration notifier undirected graph class.
18.1300 - ///
18.1301 - /// This class provides beside the core graph features alteration
18.1302 - /// notifier interface for the graph structure. This implements
18.1303 - /// an observer-notifier pattern for each graph item. More
18.1304 - /// obsevers can be registered into the notifier and whenever an
18.1305 - /// alteration occured in the graph all the observers will
18.1306 - /// notified about it.
18.1307 - template <typename _Base = BaseUGraphComponent>
18.1308 - class AlterableUGraphComponent : public AlterableGraphComponent<_Base> {
18.1309 - public:
18.1310 -
18.1311 - typedef _Base Base;
18.1312 - typedef typename Base::UEdge UEdge;
18.1313 -
18.1314 -
18.1315 - /// The edge observer registry.
18.1316 - typedef AlterationNotifier<AlterableUGraphComponent, UEdge>
18.1317 - UEdgeNotifier;
18.1318 -
18.1319 - /// \brief Gives back the edge alteration notifier.
18.1320 - ///
18.1321 - /// Gives back the edge alteration notifier.
18.1322 - UEdgeNotifier& getNotifier(UEdge) const {
18.1323 - return UEdgeNotifier();
18.1324 - }
18.1325 -
18.1326 - template <typename _Graph>
18.1327 - struct Constraints {
18.1328 - void constraints() {
18.1329 - checkConcept<AlterableGraphComponent<Base>, _Graph>();
18.1330 - typename _Graph::UEdgeNotifier& uen
18.1331 - = graph.getNotifier(typename _Graph::UEdge());
18.1332 - ignore_unused_variable_warning(uen);
18.1333 - }
18.1334 -
18.1335 - const _Graph& graph;
18.1336 -
18.1337 - };
18.1338 -
18.1339 - };
18.1340 -
18.1341 - /// \brief An empty alteration notifier bipartite undirected graph
18.1342 - /// class.
18.1343 - ///
18.1344 - /// This class provides beside the core graph features alteration
18.1345 - /// notifier interface for the graph structure. This implements
18.1346 - /// an observer-notifier pattern for each graph item. More
18.1347 - /// obsevers can be registered into the notifier and whenever an
18.1348 - /// alteration occured in the graph all the observers will
18.1349 - /// notified about it.
18.1350 - template <typename _Base = BaseUGraphComponent>
18.1351 - class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> {
18.1352 - public:
18.1353 -
18.1354 - typedef _Base Base;
18.1355 - typedef typename Base::ANode ANode;
18.1356 - typedef typename Base::BNode BNode;
18.1357 -
18.1358 -
18.1359 - /// The A-node observer registry.
18.1360 - typedef AlterationNotifier<AlterableBpUGraphComponent, ANode>
18.1361 - ANodeNotifier;
18.1362 -
18.1363 - /// The B-node observer registry.
18.1364 - typedef AlterationNotifier<AlterableBpUGraphComponent, BNode>
18.1365 - BNodeNotifier;
18.1366 -
18.1367 - /// \brief Gives back the A-node alteration notifier.
18.1368 - ///
18.1369 - /// Gives back the A-node alteration notifier.
18.1370 - ANodeNotifier& getNotifier(ANode) const {
18.1371 - return ANodeNotifier();
18.1372 - }
18.1373 -
18.1374 - /// \brief Gives back the B-node alteration notifier.
18.1375 - ///
18.1376 - /// Gives back the B-node alteration notifier.
18.1377 - BNodeNotifier& getNotifier(BNode) const {
18.1378 - return BNodeNotifier();
18.1379 - }
18.1380 -
18.1381 - template <typename _Graph>
18.1382 - struct Constraints {
18.1383 - void constraints() {
18.1384 - checkConcept<AlterableUGraphComponent<Base>, _Graph>();
18.1385 - typename _Graph::ANodeNotifier& ann
18.1386 - = graph.getNotifier(typename _Graph::ANode());
18.1387 - typename _Graph::BNodeNotifier& bnn
18.1388 - = graph.getNotifier(typename _Graph::BNode());
18.1389 - ignore_unused_variable_warning(ann);
18.1390 - ignore_unused_variable_warning(bnn);
18.1391 - }
18.1392 -
18.1393 - const _Graph& graph;
18.1394 -
18.1395 - };
18.1396 -
18.1397 - };
18.1398 -
18.1399 -
18.1400 - /// \brief Class describing the concept of graph maps
18.1401 - ///
18.1402 - /// This class describes the common interface of the graph maps
18.1403 - /// (NodeMap, EdgeMap), that is \ref maps-page "maps" which can be used to
18.1404 - /// associate data to graph descriptors (nodes or edges).
18.1405 - template <typename _Graph, typename _Item, typename _Value>
18.1406 - class GraphMap : public ReadWriteMap<_Item, _Value> {
18.1407 - public:
18.1408 -
18.1409 - typedef ReadWriteMap<_Item, _Value> Parent;
18.1410 -
18.1411 - /// The graph type of the map.
18.1412 - typedef _Graph Graph;
18.1413 - /// The key type of the map.
18.1414 - typedef _Item Key;
18.1415 - /// The value type of the map.
18.1416 - typedef _Value Value;
18.1417 -
18.1418 - /// \brief Construct a new map.
18.1419 - ///
18.1420 - /// Construct a new map for the graph.
18.1421 - explicit GraphMap(const Graph&) {}
18.1422 - /// \brief Construct a new map with default value.
18.1423 - ///
18.1424 - /// Construct a new map for the graph and initalise the values.
18.1425 - GraphMap(const Graph&, const Value&) {}
18.1426 - /// \brief Copy constructor.
18.1427 - ///
18.1428 - /// Copy Constructor.
18.1429 - GraphMap(const GraphMap&) : Parent() {}
18.1430 -
18.1431 - /// \brief Assign operator.
18.1432 - ///
18.1433 - /// Assign operator. It does not mofify the underlying graph,
18.1434 - /// it just iterates on the current item set and set the map
18.1435 - /// with the value returned by the assigned map.
18.1436 - template <typename CMap>
18.1437 - GraphMap& operator=(const CMap&) {
18.1438 - checkConcept<ReadMap<Key, Value>, CMap>();
18.1439 - return *this;
18.1440 - }
18.1441 -
18.1442 - template<typename _Map>
18.1443 - struct Constraints {
18.1444 - void constraints() {
18.1445 - checkConcept<ReadWriteMap<Key, Value>, _Map >();
18.1446 - // Construction with a graph parameter
18.1447 - _Map a(g);
18.1448 - // Constructor with a graph and a default value parameter
18.1449 - _Map a2(g,t);
18.1450 - // Copy constructor.
18.1451 - _Map b(c);
18.1452 -
18.1453 - ReadMap<Key, Value> cmap;
18.1454 - b = cmap;
18.1455 -
18.1456 - ignore_unused_variable_warning(a2);
18.1457 - ignore_unused_variable_warning(b);
18.1458 - }
18.1459 -
18.1460 - const _Map &c;
18.1461 - const Graph &g;
18.1462 - const typename GraphMap::Value &t;
18.1463 - };
18.1464 -
18.1465 - };
18.1466 -
18.1467 - /// \brief An empty mappable graph class.
18.1468 - ///
18.1469 - /// This class provides beside the core graph features
18.1470 - /// map interface for the graph structure.
18.1471 - /// This concept is part of the Graph concept.
18.1472 - template <typename _Base = BaseGraphComponent>
18.1473 - class MappableGraphComponent : public _Base {
18.1474 - public:
18.1475 -
18.1476 - typedef _Base Base;
18.1477 - typedef typename Base::Node Node;
18.1478 - typedef typename Base::Edge Edge;
18.1479 -
18.1480 - typedef MappableGraphComponent Graph;
18.1481 -
18.1482 - /// \brief ReadWrite map of the nodes.
18.1483 - ///
18.1484 - /// ReadWrite map of the nodes.
18.1485 - ///
18.1486 - template <typename _Value>
18.1487 - class NodeMap : public GraphMap<Graph, Node, _Value> {
18.1488 - private:
18.1489 - NodeMap();
18.1490 - public:
18.1491 - typedef GraphMap<MappableGraphComponent, Node, _Value> Parent;
18.1492 -
18.1493 - /// \brief Construct a new map.
18.1494 - ///
18.1495 - /// Construct a new map for the graph.
18.1496 - /// \todo call the right parent class constructor
18.1497 - explicit NodeMap(const MappableGraphComponent& graph)
18.1498 - : Parent(graph) {}
18.1499 -
18.1500 - /// \brief Construct a new map with default value.
18.1501 - ///
18.1502 - /// Construct a new map for the graph and initalise the values.
18.1503 - NodeMap(const MappableGraphComponent& graph, const _Value& value)
18.1504 - : Parent(graph, value) {}
18.1505 -
18.1506 - /// \brief Copy constructor.
18.1507 - ///
18.1508 - /// Copy Constructor.
18.1509 - NodeMap(const NodeMap& nm) : Parent(nm) {}
18.1510 -
18.1511 - /// \brief Assign operator.
18.1512 - ///
18.1513 - /// Assign operator.
18.1514 - template <typename CMap>
18.1515 - NodeMap& operator=(const CMap&) {
18.1516 - checkConcept<ReadMap<Node, _Value>, CMap>();
18.1517 - return *this;
18.1518 - }
18.1519 -
18.1520 - };
18.1521 -
18.1522 - /// \brief ReadWrite map of the edges.
18.1523 - ///
18.1524 - /// ReadWrite map of the edges.
18.1525 - ///
18.1526 - template <typename _Value>
18.1527 - class EdgeMap : public GraphMap<Graph, Edge, _Value> {
18.1528 - private:
18.1529 - EdgeMap();
18.1530 - public:
18.1531 - typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
18.1532 -
18.1533 - /// \brief Construct a new map.
18.1534 - ///
18.1535 - /// Construct a new map for the graph.
18.1536 - /// \todo call the right parent class constructor
18.1537 - explicit EdgeMap(const MappableGraphComponent& graph)
18.1538 - : Parent(graph) {}
18.1539 -
18.1540 - /// \brief Construct a new map with default value.
18.1541 - ///
18.1542 - /// Construct a new map for the graph and initalise the values.
18.1543 - EdgeMap(const MappableGraphComponent& graph, const _Value& value)
18.1544 - : Parent(graph, value) {}
18.1545 -
18.1546 - /// \brief Copy constructor.
18.1547 - ///
18.1548 - /// Copy Constructor.
18.1549 - EdgeMap(const EdgeMap& nm) : Parent(nm) {}
18.1550 -
18.1551 - /// \brief Assign operator.
18.1552 - ///
18.1553 - /// Assign operator.
18.1554 - template <typename CMap>
18.1555 - EdgeMap& operator=(const CMap&) {
18.1556 - checkConcept<ReadMap<Edge, _Value>, CMap>();
18.1557 - return *this;
18.1558 - }
18.1559 -
18.1560 - };
18.1561 -
18.1562 -
18.1563 - template <typename _Graph>
18.1564 - struct Constraints {
18.1565 -
18.1566 - struct Dummy {
18.1567 - int value;
18.1568 - Dummy() : value(0) {}
18.1569 - Dummy(int _v) : value(_v) {}
18.1570 - };
18.1571 -
18.1572 - void constraints() {
18.1573 - checkConcept<Base, _Graph>();
18.1574 - { // int map test
18.1575 - typedef typename _Graph::template NodeMap<int> IntNodeMap;
18.1576 - checkConcept<GraphMap<_Graph, typename _Graph::Node, int>,
18.1577 - IntNodeMap >();
18.1578 - } { // bool map test
18.1579 - typedef typename _Graph::template NodeMap<bool> BoolNodeMap;
18.1580 - checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>,
18.1581 - BoolNodeMap >();
18.1582 - } { // Dummy map test
18.1583 - typedef typename _Graph::template NodeMap<Dummy> DummyNodeMap;
18.1584 - checkConcept<GraphMap<_Graph, typename _Graph::Node, Dummy>,
18.1585 - DummyNodeMap >();
18.1586 - }
18.1587 -
18.1588 - { // int map test
18.1589 - typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
18.1590 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
18.1591 - IntEdgeMap >();
18.1592 - } { // bool map test
18.1593 - typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
18.1594 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
18.1595 - BoolEdgeMap >();
18.1596 - } { // Dummy map test
18.1597 - typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
18.1598 - checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
18.1599 - DummyEdgeMap >();
18.1600 - }
18.1601 - }
18.1602 -
18.1603 - _Graph& graph;
18.1604 - };
18.1605 - };
18.1606 -
18.1607 - /// \brief An empty mappable base bipartite undirected graph class.
18.1608 - ///
18.1609 - /// This class provides beside the core graph features
18.1610 - /// map interface for the graph structure.
18.1611 - /// This concept is part of the UGraph concept.
18.1612 - template <typename _Base = BaseUGraphComponent>
18.1613 - class MappableUGraphComponent : public MappableGraphComponent<_Base> {
18.1614 - public:
18.1615 -
18.1616 - typedef _Base Base;
18.1617 - typedef typename Base::UEdge UEdge;
18.1618 -
18.1619 - typedef MappableUGraphComponent Graph;
18.1620 -
18.1621 - /// \brief ReadWrite map of the uedges.
18.1622 - ///
18.1623 - /// ReadWrite map of the uedges.
18.1624 - ///
18.1625 - template <typename _Value>
18.1626 - class UEdgeMap : public GraphMap<Graph, UEdge, _Value> {
18.1627 - public:
18.1628 - typedef GraphMap<MappableUGraphComponent, UEdge, _Value> Parent;
18.1629 -
18.1630 - /// \brief Construct a new map.
18.1631 - ///
18.1632 - /// Construct a new map for the graph.
18.1633 - /// \todo call the right parent class constructor
18.1634 - explicit UEdgeMap(const MappableUGraphComponent& graph)
18.1635 - : Parent(graph) {}
18.1636 -
18.1637 - /// \brief Construct a new map with default value.
18.1638 - ///
18.1639 - /// Construct a new map for the graph and initalise the values.
18.1640 - UEdgeMap(const MappableUGraphComponent& graph, const _Value& value)
18.1641 - : Parent(graph, value) {}
18.1642 -
18.1643 - /// \brief Copy constructor.
18.1644 - ///
18.1645 - /// Copy Constructor.
18.1646 - UEdgeMap(const UEdgeMap& nm) : Parent(nm) {}
18.1647 -
18.1648 - /// \brief Assign operator.
18.1649 - ///
18.1650 - /// Assign operator.
18.1651 - template <typename CMap>
18.1652 - UEdgeMap& operator=(const CMap&) {
18.1653 - checkConcept<ReadMap<UEdge, _Value>, CMap>();
18.1654 - return *this;
18.1655 - }
18.1656 -
18.1657 - };
18.1658 -
18.1659 -
18.1660 - template <typename _Graph>
18.1661 - struct Constraints {
18.1662 -
18.1663 - struct Dummy {
18.1664 - int value;
18.1665 - Dummy() : value(0) {}
18.1666 - Dummy(int _v) : value(_v) {}
18.1667 - };
18.1668 -
18.1669 - void constraints() {
18.1670 - checkConcept<MappableGraphComponent<Base>, _Graph>();
18.1671 -
18.1672 - { // int map test
18.1673 - typedef typename _Graph::template UEdgeMap<int> IntUEdgeMap;
18.1674 - checkConcept<GraphMap<_Graph, typename _Graph::UEdge, int>,
18.1675 - IntUEdgeMap >();
18.1676 - } { // bool map test
18.1677 - typedef typename _Graph::template UEdgeMap<bool> BoolUEdgeMap;
18.1678 - checkConcept<GraphMap<_Graph, typename _Graph::UEdge, bool>,
18.1679 - BoolUEdgeMap >();
18.1680 - } { // Dummy map test
18.1681 - typedef typename _Graph::template UEdgeMap<Dummy> DummyUEdgeMap;
18.1682 - checkConcept<GraphMap<_Graph, typename _Graph::UEdge, Dummy>,
18.1683 - DummyUEdgeMap >();
18.1684 - }
18.1685 - }
18.1686 -
18.1687 - _Graph& graph;
18.1688 - };
18.1689 - };
18.1690 -
18.1691 - /// \brief An empty mappable base bipartite undirected graph
18.1692 - /// class.
18.1693 - ///
18.1694 - /// This class provides beside the core graph features
18.1695 - /// map interface for the graph structure.
18.1696 - /// This concept is part of the BpUGraph concept.
18.1697 - template <typename _Base = BaseBpUGraphComponent>
18.1698 - class MappableBpUGraphComponent : public MappableUGraphComponent<_Base> {
18.1699 - public:
18.1700 -
18.1701 - typedef _Base Base;
18.1702 - typedef typename Base::Node Node;
18.1703 -
18.1704 - typedef MappableBpUGraphComponent Graph;
18.1705 -
18.1706 - /// \brief ReadWrite map of the A-nodes.
18.1707 - ///
18.1708 - /// ReadWrite map of the A-nodes.
18.1709 - ///
18.1710 - template <typename _Value>
18.1711 - class ANodeMap : public GraphMap<Graph, Node, _Value> {
18.1712 - public:
18.1713 - typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
18.1714 -
18.1715 - /// \brief Construct a new map.
18.1716 - ///
18.1717 - /// Construct a new map for the graph.
18.1718 - /// \todo call the right parent class constructor
18.1719 - explicit ANodeMap(const MappableBpUGraphComponent& graph)
18.1720 - : Parent(graph) {}
18.1721 -
18.1722 - /// \brief Construct a new map with default value.
18.1723 - ///
18.1724 - /// Construct a new map for the graph and initalise the values.
18.1725 - ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
18.1726 - : Parent(graph, value) {}
18.1727 -
18.1728 - /// \brief Copy constructor.
18.1729 - ///
18.1730 - /// Copy Constructor.
18.1731 - ANodeMap(const ANodeMap& nm) : Parent(nm) {}
18.1732 -
18.1733 - /// \brief Assign operator.
18.1734 - ///
18.1735 - /// Assign operator.
18.1736 - template <typename CMap>
18.1737 - ANodeMap& operator=(const CMap&) {
18.1738 - checkConcept<ReadMap<Node, _Value>, CMap>();
18.1739 - return *this;
18.1740 - }
18.1741 -
18.1742 - };
18.1743 -
18.1744 - /// \brief ReadWrite map of the B-nodes.
18.1745 - ///
18.1746 - /// ReadWrite map of the A-nodes.
18.1747 - ///
18.1748 - template <typename _Value>
18.1749 - class BNodeMap : public GraphMap<Graph, Node, _Value> {
18.1750 - public:
18.1751 - typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
18.1752 -
18.1753 - /// \brief Construct a new map.
18.1754 - ///
18.1755 - /// Construct a new map for the graph.
18.1756 - /// \todo call the right parent class constructor
18.1757 - explicit BNodeMap(const MappableBpUGraphComponent& graph)
18.1758 - : Parent(graph) {}
18.1759 -
18.1760 - /// \brief Construct a new map with default value.
18.1761 - ///
18.1762 - /// Construct a new map for the graph and initalise the values.
18.1763 - BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
18.1764 - : Parent(graph, value) {}
18.1765 -
18.1766 - /// \brief Copy constructor.
18.1767 - ///
18.1768 - /// Copy Constructor.
18.1769 - BNodeMap(const BNodeMap& nm) : Parent(nm) {}
18.1770 -
18.1771 - /// \brief Assign operator.
18.1772 - ///
18.1773 - /// Assign operator.
18.1774 - template <typename CMap>
18.1775 - BNodeMap& operator=(const CMap&) {
18.1776 - checkConcept<ReadMap<Node, _Value>, CMap>();
18.1777 - return *this;
18.1778 - }
18.1779 -
18.1780 - };
18.1781 -
18.1782 -
18.1783 - template <typename _Graph>
18.1784 - struct Constraints {
18.1785 -
18.1786 - struct Dummy {
18.1787 - int value;
18.1788 - Dummy() : value(0) {}
18.1789 - Dummy(int _v) : value(_v) {}
18.1790 - };
18.1791 -
18.1792 - void constraints() {
18.1793 - checkConcept<MappableUGraphComponent<Base>, _Graph>();
18.1794 -
18.1795 - { // int map test
18.1796 - typedef typename _Graph::template ANodeMap<int> IntANodeMap;
18.1797 - checkConcept<GraphMap<_Graph, typename _Graph::ANode, int>,
18.1798 - IntANodeMap >();
18.1799 - } { // bool map test
18.1800 - typedef typename _Graph::template ANodeMap<bool> BoolANodeMap;
18.1801 - checkConcept<GraphMap<_Graph, typename _Graph::ANode, bool>,
18.1802 - BoolANodeMap >();
18.1803 - } { // Dummy map test
18.1804 - typedef typename _Graph::template ANodeMap<Dummy> DummyANodeMap;
18.1805 - checkConcept<GraphMap<_Graph, typename _Graph::ANode, Dummy>,
18.1806 - DummyANodeMap >();
18.1807 - }
18.1808 - }
18.1809 -
18.1810 - _Graph& graph;
18.1811 - };
18.1812 - };
18.1813 -
18.1814 -
18.1815 - /// \brief An empty extendable graph class.
18.1816 - ///
18.1817 - /// This class provides beside the core graph features graph
18.1818 - /// extendable interface for the graph structure. The main
18.1819 - /// difference between the base and this interface is that the
18.1820 - /// graph alterations should handled already on this level.
18.1821 - template <typename _Base = BaseGraphComponent>
18.1822 - class ExtendableGraphComponent : public _Base {
18.1823 - public:
18.1824 - typedef _Base Base;
18.1825 -
18.1826 - typedef typename _Base::Node Node;
18.1827 - typedef typename _Base::Edge Edge;
18.1828 -
18.1829 - /// \brief Adds a new node to the graph.
18.1830 - ///
18.1831 - /// Adds a new node to the graph.
18.1832 - ///
18.1833 - Node addNode() {
18.1834 - return INVALID;
18.1835 - }
18.1836 -
18.1837 - /// \brief Adds a new edge connects the given two nodes.
18.1838 - ///
18.1839 - /// Adds a new edge connects the the given two nodes.
18.1840 - Edge addEdge(const Node&, const Node&) {
18.1841 - return INVALID;
18.1842 - }
18.1843 -
18.1844 - template <typename _Graph>
18.1845 - struct Constraints {
18.1846 - void constraints() {
18.1847 - checkConcept<Base, _Graph>();
18.1848 - typename _Graph::Node node_a, node_b;
18.1849 - node_a = graph.addNode();
18.1850 - node_b = graph.addNode();
18.1851 - typename _Graph::Edge edge;
18.1852 - edge = graph.addEdge(node_a, node_b);
18.1853 - }
18.1854 -
18.1855 - _Graph& graph;
18.1856 - };
18.1857 - };
18.1858 -
18.1859 - /// \brief An empty extendable base undirected graph class.
18.1860 - ///
18.1861 - /// This class provides beside the core undirected graph features
18.1862 - /// core undircted graph extend interface for the graph structure.
18.1863 - /// The main difference between the base and this interface is
18.1864 - /// that the graph alterations should handled already on this
18.1865 - /// level.
18.1866 - template <typename _Base = BaseUGraphComponent>
18.1867 - class ExtendableUGraphComponent : public _Base {
18.1868 - public:
18.1869 -
18.1870 - typedef _Base Base;
18.1871 - typedef typename _Base::Node Node;
18.1872 - typedef typename _Base::UEdge UEdge;
18.1873 -
18.1874 - /// \brief Adds a new node to the graph.
18.1875 - ///
18.1876 - /// Adds a new node to the graph.
18.1877 - ///
18.1878 - Node addNode() {
18.1879 - return INVALID;
18.1880 - }
18.1881 -
18.1882 - /// \brief Adds a new edge connects the given two nodes.
18.1883 - ///
18.1884 - /// Adds a new edge connects the the given two nodes.
18.1885 - UEdge addEdge(const Node&, const Node&) {
18.1886 - return INVALID;
18.1887 - }
18.1888 -
18.1889 - template <typename _Graph>
18.1890 - struct Constraints {
18.1891 - void constraints() {
18.1892 - checkConcept<Base, _Graph>();
18.1893 - typename _Graph::Node node_a, node_b;
18.1894 - node_a = graph.addNode();
18.1895 - node_b = graph.addNode();
18.1896 - typename _Graph::UEdge uedge;
18.1897 - uedge = graph.addUEdge(node_a, node_b);
18.1898 - }
18.1899 -
18.1900 - _Graph& graph;
18.1901 - };
18.1902 - };
18.1903 -
18.1904 - /// \brief An empty extendable base undirected graph class.
18.1905 - ///
18.1906 - /// This class provides beside the core bipartite undirected graph
18.1907 - /// features core undircted graph extend interface for the graph
18.1908 - /// structure. The main difference between the base and this
18.1909 - /// interface is that the graph alterations should handled already
18.1910 - /// on this level.
18.1911 - template <typename _Base = BaseBpUGraphComponent>
18.1912 - class ExtendableBpUGraphComponent
18.1913 - : public ExtendableUGraphComponent<_Base> {
18.1914 -
18.1915 - typedef _Base Base;
18.1916 -
18.1917 - template <typename _Graph>
18.1918 - struct Constraints {
18.1919 - void constraints() {
18.1920 - checkConcept<ExtendableUGraphComponent<Base>, _Graph>();
18.1921 - }
18.1922 - };
18.1923 - };
18.1924 -
18.1925 - /// \brief An empty erasable graph class.
18.1926 - ///
18.1927 - /// This class provides beside the core graph features core erase
18.1928 - /// functions for the graph structure. The main difference between
18.1929 - /// the base and this interface is that the graph alterations
18.1930 - /// should handled already on this level.
18.1931 - template <typename _Base = BaseGraphComponent>
18.1932 - class ErasableGraphComponent : public _Base {
18.1933 - public:
18.1934 -
18.1935 - typedef _Base Base;
18.1936 - typedef typename Base::Node Node;
18.1937 - typedef typename Base::Edge Edge;
18.1938 -
18.1939 - /// \brief Erase a node from the graph.
18.1940 - ///
18.1941 - /// Erase a node from the graph. This function should
18.1942 - /// erase all edges connecting to the node.
18.1943 - void erase(const Node&) {}
18.1944 -
18.1945 - /// \brief Erase an edge from the graph.
18.1946 - ///
18.1947 - /// Erase an edge from the graph.
18.1948 - ///
18.1949 - void erase(const Edge&) {}
18.1950 -
18.1951 - template <typename _Graph>
18.1952 - struct Constraints {
18.1953 - void constraints() {
18.1954 - checkConcept<Base, _Graph>();
18.1955 - typename _Graph::Node node;
18.1956 - graph.erase(node);
18.1957 - typename _Graph::Edge edge;
18.1958 - graph.erase(edge);
18.1959 - }
18.1960 -
18.1961 - _Graph& graph;
18.1962 - };
18.1963 - };
18.1964 -
18.1965 - /// \brief An empty erasable base undirected graph class.
18.1966 - ///
18.1967 - /// This class provides beside the core undirected graph features
18.1968 - /// core erase functions for the undirceted graph structure. The
18.1969 - /// main difference between the base and this interface is that
18.1970 - /// the graph alterations should handled already on this level.
18.1971 - template <typename _Base = BaseUGraphComponent>
18.1972 - class ErasableUGraphComponent : public _Base {
18.1973 - public:
18.1974 -
18.1975 - typedef _Base Base;
18.1976 - typedef typename Base::Node Node;
18.1977 - typedef typename Base::UEdge UEdge;
18.1978 -
18.1979 - /// \brief Erase a node from the graph.
18.1980 - ///
18.1981 - /// Erase a node from the graph. This function should erase
18.1982 - /// edges connecting to the node.
18.1983 - void erase(const Node&) {}
18.1984 -
18.1985 - /// \brief Erase an edge from the graph.
18.1986 - ///
18.1987 - /// Erase an edge from the graph.
18.1988 - ///
18.1989 - void erase(const UEdge&) {}
18.1990 -
18.1991 - template <typename _Graph>
18.1992 - struct Constraints {
18.1993 - void constraints() {
18.1994 - checkConcept<Base, _Graph>();
18.1995 - typename _Graph::Node node;
18.1996 - graph.erase(node);
18.1997 - typename _Graph::Edge edge;
18.1998 - graph.erase(edge);
18.1999 - }
18.2000 -
18.2001 - _Graph& graph;
18.2002 - };
18.2003 - };
18.2004 -
18.2005 - /// \brief An empty erasable base bipartite undirected graph class.
18.2006 - ///
18.2007 - /// This class provides beside the core bipartite undirected graph
18.2008 - /// features core erase functions for the undirceted graph
18.2009 - /// structure. The main difference between the base and this
18.2010 - /// interface is that the graph alterations should handled already
18.2011 - /// on this level.
18.2012 - template <typename _Base = BaseBpUGraphComponent>
18.2013 - class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> {
18.2014 - public:
18.2015 -
18.2016 - typedef _Base Base;
18.2017 -
18.2018 - template <typename _Graph>
18.2019 - struct Constraints {
18.2020 - void constraints() {
18.2021 - checkConcept<ErasableUGraphComponent<Base>, _Graph>();
18.2022 - }
18.2023 - };
18.2024 - };
18.2025 -
18.2026 - /// \brief An empty clearable base graph class.
18.2027 - ///
18.2028 - /// This class provides beside the core graph features core clear
18.2029 - /// functions for the graph structure. The main difference between
18.2030 - /// the base and this interface is that the graph alterations
18.2031 - /// should handled already on this level.
18.2032 - template <typename _Base = BaseGraphComponent>
18.2033 - class ClearableGraphComponent : public _Base {
18.2034 - public:
18.2035 -
18.2036 - typedef _Base Base;
18.2037 -
18.2038 - /// \brief Erase all nodes and edges from the graph.
18.2039 - ///
18.2040 - /// Erase all nodes and edges from the graph.
18.2041 - ///
18.2042 - void clear() {}
18.2043 -
18.2044 - template <typename _Graph>
18.2045 - struct Constraints {
18.2046 - void constraints() {
18.2047 - checkConcept<Base, _Graph>();
18.2048 - graph.clear();
18.2049 - }
18.2050 -
18.2051 - _Graph graph;
18.2052 - };
18.2053 - };
18.2054 -
18.2055 - /// \brief An empty clearable base undirected graph class.
18.2056 - ///
18.2057 - /// This class provides beside the core undirected graph features
18.2058 - /// core clear functions for the undirected graph structure. The
18.2059 - /// main difference between the base and this interface is that
18.2060 - /// the graph alterations should handled already on this level.
18.2061 - template <typename _Base = BaseUGraphComponent>
18.2062 - class ClearableUGraphComponent : public ClearableUGraphComponent<_Base> {
18.2063 - public:
18.2064 -
18.2065 - typedef _Base Base;
18.2066 -
18.2067 - template <typename _Graph>
18.2068 - struct Constraints {
18.2069 - void constraints() {
18.2070 - checkConcept<ClearableUGraphComponent<Base>, _Graph>();
18.2071 - }
18.2072 -
18.2073 - _Graph graph;
18.2074 - };
18.2075 - };
18.2076 -
18.2077 - /// \brief An empty clearable base bipartite undirected graph
18.2078 - /// class.
18.2079 - ///
18.2080 - /// This class provides beside the core bipartite undirected graph
18.2081 - /// features core clear functions for the undirected graph
18.2082 - /// structure. The main difference between the base and this
18.2083 - /// interface is that the graph alterations should handled already
18.2084 - /// on this level.
18.2085 - template <typename _Base = BaseUGraphComponent>
18.2086 - class ClearableBpUGraphComponent
18.2087 - : public ClearableBpUGraphComponent<_Base> {
18.2088 - public:
18.2089 -
18.2090 - typedef _Base Base;
18.2091 -
18.2092 - template <typename _Graph>
18.2093 - struct Constraints {
18.2094 - void constraints() {
18.2095 - checkConcept<ClearableBpUGraphComponent<Base>, _Graph>();
18.2096 - }
18.2097 -
18.2098 - };
18.2099 -
18.2100 - };
18.2101 -
18.2102 - }
18.2103 -
18.2104 -}
18.2105 -
18.2106 -#endif
19.1 --- a/lemon/concept/heap.h Tue Oct 24 16:49:41 2006 +0000
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,223 +0,0 @@
19.4 -/* -*- C++ -*-
19.5 - *
19.6 - * This file is a part of LEMON, a generic C++ optimization library
19.7 - *
19.8 - * Copyright (C) 2003-2006
19.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
19.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
19.11 - *
19.12 - * Permission to use, modify and distribute this software is granted
19.13 - * provided that this copyright notice appears in all copies. For
19.14 - * precise terms see the accompanying LICENSE file.
19.15 - *
19.16 - * This software is provided "AS IS" with no warranty of any kind,
19.17 - * express or implied, and with no claim as to its suitability for any
19.18 - * purpose.
19.19 - *
19.20 - */
19.21 -
19.22 -///\ingroup concept
19.23 -///\file
19.24 -///\brief Classes for representing heaps.
19.25 -///
19.26 -
19.27 -#ifndef LEMON_CONCEPT_HEAP_H
19.28 -#define LEMON_CONCEPT_HEAP_H
19.29 -
19.30 -#include <lemon/bits/invalid.h>
19.31 -
19.32 -namespace lemon {
19.33 - namespace concept {
19.34 - /// \addtogroup concept
19.35 - /// @{
19.36 -
19.37 -
19.38 - /// \brief A concept structure describes the main interface of heaps.
19.39 - ///
19.40 - /// A concept structure describes the main interface of heaps.
19.41 - ///
19.42 - template <typename Item, typename Prio, typename ItemIntMap>
19.43 - class Heap {
19.44 - public:
19.45 -
19.46 -
19.47 - /// \brief Type to represent the items states.
19.48 - ///
19.49 - /// Each Item element have a state associated to it. It may be "in heap",
19.50 - /// "pre heap" or "post heap". The later two are indifferent from the
19.51 - /// heap's point of view, but may be useful to the user.
19.52 - ///
19.53 - /// The ItemIntMap _should_ be initialized in such way, that it maps
19.54 - /// PRE_HEAP (-1) to any element to be put in the heap...
19.55 - enum state_enum {
19.56 - IN_HEAP = 0,
19.57 - PRE_HEAP = -1,
19.58 - POST_HEAP = -2
19.59 - };
19.60 -
19.61 - /// \brief The constructor.
19.62 - ///
19.63 - /// The constructor.
19.64 - /// \param _iim should be given to the constructor, since it is used
19.65 - /// internally to handle the cross references. The value of the map
19.66 - /// should be PRE_HEAP (-1) for each element.
19.67 - explicit Heap(ItemIntMap &_iim) {}
19.68 -
19.69 - /// \brief The number of items stored in the heap.
19.70 - ///
19.71 - /// Returns the number of items stored in the heap.
19.72 - int size() const { return 0; }
19.73 -
19.74 - /// \brief Checks if the heap stores no items.
19.75 - ///
19.76 - /// Returns \c true if and only if the heap stores no items.
19.77 - bool empty() const { return false; }
19.78 -
19.79 - /// \brief Makes empty this heap.
19.80 - ///
19.81 - /// Makes this heap empty.
19.82 - void clear();
19.83 -
19.84 - /// \brief Insert an item into the heap with the given heap.
19.85 - ///
19.86 - /// Adds \c i to the heap with priority \c p.
19.87 - /// \param i The item to insert.
19.88 - /// \param p The priority of the item.
19.89 - void push(const Item &i, const Prio &p) {}
19.90 -
19.91 - /// \brief Returns the item with minimum priority.
19.92 - ///
19.93 - /// This method returns the item with minimum priority.
19.94 - /// \pre The heap must be nonempty.
19.95 - Item top() const {}
19.96 -
19.97 - /// \brief Returns the minimum priority.
19.98 - ///
19.99 - /// It returns the minimum priority.
19.100 - /// \pre The heap must be nonempty.
19.101 - Prio prio() const {}
19.102 -
19.103 - /// \brief Deletes the item with minimum priority.
19.104 - ///
19.105 - /// This method deletes the item with minimum priority.
19.106 - /// \pre The heap must be non-empty.
19.107 - void pop() {}
19.108 -
19.109 - /// \brief Deletes \c i from the heap.
19.110 - ///
19.111 - /// This method deletes item \c i from the heap, if \c i was
19.112 - /// already stored in the heap.
19.113 - /// \param i The item to erase.
19.114 - void erase(const Item &i) {}
19.115 -
19.116 - /// \brief Returns the priority of \c i.
19.117 - ///
19.118 - /// This function returns the priority of item \c i.
19.119 - /// \pre \c i must be in the heap.
19.120 - /// \param i The item.
19.121 - Prio operator[](const Item &i) const {}
19.122 -
19.123 - /// \brief \c i gets to the heap with priority \c p independently
19.124 - /// if \c i was already there.
19.125 - ///
19.126 - /// This method calls \ref push(\c i, \c p) if \c i is not stored
19.127 - /// in the heap and sets the priority of \c i to \c p otherwise.
19.128 - /// It may throw an \e UnderFlowPriorityException.
19.129 - /// \param i The item.
19.130 - /// \param p The priority.
19.131 - void set(const Item &i, const Prio &p) {}
19.132 -
19.133 - /// \brief Decreases the priority of \c i to \c p.
19.134 - ///
19.135 - /// This method decreases the priority of item \c i to \c p.
19.136 - /// \pre \c i must be stored in the heap with priority at least \c p.
19.137 - /// \param i The item.
19.138 - /// \param p The priority.
19.139 - void decrease(const Item &i, const Prio &p) {}
19.140 -
19.141 - /// \brief Increases the priority of \c i to \c p.
19.142 - ///
19.143 - /// This method sets the priority of item \c i to \c p.
19.144 - /// \pre \c i must be stored in the heap with priority at most \c
19.145 - /// p relative to \c Compare.
19.146 - /// \param i The item.
19.147 - /// \param p The priority.
19.148 - void increase(const Item &i, const Prio &p) {}
19.149 -
19.150 - /// \brief Returns if \c item is in, has already been in, or has
19.151 - /// never been in the heap.
19.152 - ///
19.153 - /// This method returns PRE_HEAP if \c item has never been in the
19.154 - /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
19.155 - /// otherwise. In the latter case it is possible that \c item will
19.156 - /// get back to the heap again.
19.157 - /// \param i The item.
19.158 - state_enum state(const Item &i) const {}
19.159 -
19.160 - /// \brief Sets the state of the \c item in the heap.
19.161 - ///
19.162 - /// Sets the state of the \c item in the heap. It can be used to
19.163 - /// manually clear the heap when it is important to achive the
19.164 - /// better time complexity.
19.165 - /// \param i The item.
19.166 - /// \param st The state. It should not be \c IN_HEAP.
19.167 - void state(const Item& i, state_enum st) {}
19.168 -
19.169 -
19.170 - template <typename _Heap>
19.171 - struct Constraints {
19.172 - public:
19.173 -
19.174 - void constraints() {
19.175 - Item item;
19.176 - Prio prio;
19.177 -
19.178 - item=Item();
19.179 - prio=Prio();
19.180 -
19.181 - ignore_unused_variable_warning(item);
19.182 - ignore_unused_variable_warning(prio);
19.183 -
19.184 - typedef typename _Heap::state_enum state_enum;
19.185 - state_enum state;
19.186 -
19.187 - ignore_unused_variable_warning(state);
19.188 -
19.189 - _Heap heap1 = _Heap(map);
19.190 -
19.191 - ignore_unused_variable_warning(heap1);
19.192 -
19.193 - heap.push(item, prio);
19.194 -
19.195 - prio = heap.prio();
19.196 - item = heap.top();
19.197 -
19.198 - heap.pop();
19.199 -
19.200 - heap.set(item, prio);
19.201 - heap.decrease(item, prio);
19.202 - heap.increase(item, prio);
19.203 - prio = heap[item];
19.204 -
19.205 - heap.erase(item);
19.206 -
19.207 - state = heap.state(item);
19.208 -
19.209 - state = _Heap::PRE_HEAP;
19.210 - state = _Heap::IN_HEAP;
19.211 - state = _Heap::POST_HEAP;
19.212 -
19.213 - heap.clear();
19.214 - }
19.215 -
19.216 - _Heap& heap;
19.217 - ItemIntMap& map;
19.218 -
19.219 - Constraints() : heap(0), map(0) {}
19.220 - };
19.221 - };
19.222 -
19.223 - /// @}
19.224 - } // namespace lemon
19.225 -}
19.226 -#endif // LEMON_CONCEPT_PATH_H
20.1 --- a/lemon/concept/maps.h Tue Oct 24 16:49:41 2006 +0000
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,192 +0,0 @@
20.4 -/* -*- C++ -*-
20.5 - *
20.6 - * This file is a part of LEMON, a generic C++ optimization library
20.7 - *
20.8 - * Copyright (C) 2003-2006
20.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
20.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
20.11 - *
20.12 - * Permission to use, modify and distribute this software is granted
20.13 - * provided that this copyright notice appears in all copies. For
20.14 - * precise terms see the accompanying LICENSE file.
20.15 - *
20.16 - * This software is provided "AS IS" with no warranty of any kind,
20.17 - * express or implied, and with no claim as to its suitability for any
20.18 - * purpose.
20.19 - *
20.20 - */
20.21 -
20.22 -#ifndef LEMON_CONCEPT_MAPS_H
20.23 -#define LEMON_CONCEPT_MAPS_H
20.24 -
20.25 -#include <lemon/bits/utility.h>
20.26 -#include <lemon/concept_check.h>
20.27 -
20.28 -///\ingroup concept
20.29 -///\file
20.30 -///\brief Map concepts checking classes for testing and documenting.
20.31 -
20.32 -namespace lemon {
20.33 -
20.34 - namespace concept {
20.35 -
20.36 - /// \addtogroup concept
20.37 - /// @{
20.38 -
20.39 - /// Readable map concept
20.40 - template<typename K, typename T>
20.41 - class ReadMap
20.42 - {
20.43 - public:
20.44 - /// Map's key type.
20.45 - typedef K Key;
20.46 - /// Map's value type. (The type of objects associated with the keys).
20.47 - typedef T Value;
20.48 -
20.49 - // \bug Value don't need to be default constructible.
20.50 - /// Returns the value associated with a key.
20.51 - Value operator[](const Key &) const {return Value();}
20.52 -
20.53 - template<typename _ReadMap>
20.54 - struct Constraints {
20.55 -
20.56 - void constraints() {
20.57 - Value val = m[key];
20.58 - val = m[key];
20.59 - typename _ReadMap::Value own_val = m[own_key];
20.60 - own_val = m[own_key];
20.61 -
20.62 - ignore_unused_variable_warning(val);
20.63 - ignore_unused_variable_warning(own_val);
20.64 - ignore_unused_variable_warning(key);
20.65 - }
20.66 - Key& key;
20.67 - typename _ReadMap::Key& own_key;
20.68 - _ReadMap& m;
20.69 - };
20.70 -
20.71 - };
20.72 -
20.73 -
20.74 - /// Writable map concept
20.75 - template<typename K, typename T>
20.76 - class WriteMap
20.77 - {
20.78 - public:
20.79 - /// Map's key type.
20.80 - typedef K Key;
20.81 - /// Map's value type. (The type of objects associated with the keys).
20.82 - typedef T Value;
20.83 -
20.84 - /// Sets the value associated with a key.
20.85 - void set(const Key &,const Value &) {}
20.86 -
20.87 - ///Default constructor
20.88 - WriteMap() {}
20.89 -
20.90 - template <typename _WriteMap>
20.91 - struct Constraints {
20.92 - void constraints() {
20.93 - // No constraints for constructor.
20.94 - m.set(key, val);
20.95 - m.set(own_key, own_val);
20.96 - ignore_unused_variable_warning(key);
20.97 - ignore_unused_variable_warning(val);
20.98 - ignore_unused_variable_warning(own_key);
20.99 - ignore_unused_variable_warning(own_val);
20.100 - }
20.101 -
20.102 - Value& val;
20.103 - typename _WriteMap::Value own_val;
20.104 - Key& key;
20.105 - typename _WriteMap::Key& own_key;
20.106 - _WriteMap& m;
20.107 -
20.108 - };
20.109 - };
20.110 -
20.111 - ///Read/Writable map concept
20.112 - template<typename K, typename T>
20.113 - class ReadWriteMap : public ReadMap<K,T>,
20.114 - public WriteMap<K,T>
20.115 - {
20.116 - public:
20.117 - /// Map's key type.
20.118 - typedef K Key;
20.119 - /// Map's value type. (The type of objects associated with the keys).
20.120 - typedef T Value;
20.121 -
20.122 - /// Returns the value associated with a key.
20.123 - Value operator[](const Key &) const {return Value();}
20.124 - /// Sets the value associated with a key.
20.125 - void set(const Key & ,const Value &) {}
20.126 -
20.127 - template<typename _ReadWriteMap>
20.128 - struct Constraints {
20.129 - void constraints() {
20.130 - checkConcept<ReadMap<K, T>, _ReadWriteMap >();
20.131 - checkConcept<WriteMap<K, T>, _ReadWriteMap >();
20.132 - }
20.133 - };
20.134 - };
20.135 -
20.136 -
20.137 - ///Dereferable map concept
20.138 - template<typename K, typename T, typename R, typename CR>
20.139 - class ReferenceMap : public ReadWriteMap<K,T>
20.140 - {
20.141 - public:
20.142 - /// Tag for reference maps.
20.143 - typedef True ReferenceMapTag;
20.144 - /// Map's key type.
20.145 - typedef K Key;
20.146 - /// Map's value type. (The type of objects associated with the keys).
20.147 - typedef T Value;
20.148 - /// Map's reference type.
20.149 - typedef R Reference;
20.150 - /// Map's const reference type.
20.151 - typedef CR ConstReference;
20.152 -
20.153 - protected:
20.154 - Value tmp;
20.155 - public:
20.156 -
20.157 - ///Returns a reference to the value associated to a key.
20.158 - Reference operator[](const Key &) { return tmp; }
20.159 - ///Returns a const reference to the value associated to a key.
20.160 - ConstReference operator[](const Key &) const
20.161 - { return tmp; }
20.162 - /// Sets the value associated with a key.
20.163 - void set(const Key &k,const Value &t) { operator[](k)=t; }
20.164 -
20.165 - // \todo rethink this concept
20.166 - template<typename _ReferenceMap>
20.167 - struct ReferenceMapConcept {
20.168 -
20.169 - void constraints() {
20.170 - checkConcept<ReadWriteMap, _ReferenceMap >();
20.171 - m[key] = val;
20.172 - val = m[key];
20.173 - m[key] = ref;
20.174 - ref = m[key];
20.175 - m[own_key] = own_val;
20.176 - own_val = m[own_key];
20.177 - m[own_key] = own_ref;
20.178 - own_ref = m[own_key];
20.179 - }
20.180 -
20.181 - typename _ReferenceMap::Key& own_key;
20.182 - typename _ReferenceMap::Value& own_val;
20.183 - typename _ReferenceMap::Reference& own_ref;
20.184 - Key& key;
20.185 - Value& val;
20.186 - Reference& ref;
20.187 - _ReferenceMap& m;
20.188 - };
20.189 - };
20.190 -
20.191 - // @}
20.192 -
20.193 - } //namespace concept
20.194 -} //namespace lemon
20.195 -#endif // LEMON_CONCEPT_MAPS_H
21.1 --- a/lemon/concept/matrix_maps.h Tue Oct 24 16:49:41 2006 +0000
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,207 +0,0 @@
21.4 -/* -*- C++ -*-
21.5 - *
21.6 - * This file is a part of LEMON, a generic C++ optimization library
21.7 - *
21.8 - * Copyright (C) 2003-2006
21.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
21.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
21.11 - *
21.12 - * Permission to use, modify and distribute this software is granted
21.13 - * provided that this copyright notice appears in all copies. For
21.14 - * precise terms see the accompanying LICENSE file.
21.15 - *
21.16 - * This software is provided "AS IS" with no warranty of any kind,
21.17 - * express or implied, and with no claim as to its suitability for any
21.18 - * purpose.
21.19 - *
21.20 - */
21.21 -
21.22 -#ifndef LEMON_CONCEPT_MATRIX_MAPS_H
21.23 -#define LEMON_CONCEPT_MATRIX_MAPS_H
21.24 -
21.25 -#include <lemon/bits/utility.h>
21.26 -#include <lemon/concept_check.h>
21.27 -
21.28 -///\ingroup concept
21.29 -///\file
21.30 -///\brief MatrixMap concepts checking classes for testing and documenting.
21.31 -
21.32 -namespace lemon {
21.33 -
21.34 - namespace concept {
21.35 -
21.36 - /// \addtogroup concept
21.37 - /// @{
21.38 -
21.39 - /// Readable matrix map concept
21.40 - template <typename K1, typename K2, typename V>
21.41 - class ReadMatrixMap
21.42 - {
21.43 - public:
21.44 - /// Map's first key type.
21.45 - typedef K1 FirstKey;
21.46 - /// Map's second key type.
21.47 - typedef K2 SecondKey;
21.48 - /// \brief Map's value type.
21.49 - /// (The type of objects associated with the pairs of keys).
21.50 - typedef V Value;
21.51 -
21.52 - // \bug Value don't need to be default constructible.
21.53 - /// Returns the value associated with a key.
21.54 - Value operator()(const FirstKey&, const SecondKey&) const {
21.55 - return Value();
21.56 - }
21.57 -
21.58 - template <typename _ReadMatrixMap>
21.59 - struct Constraints {
21.60 -
21.61 - void constraints() {
21.62 - Value val = m(first_key, second_key);
21.63 - val = m(first_key, second_key);
21.64 - typename _ReadMatrixMap::Value own_val =
21.65 - m(own_first_key, own_second_key);
21.66 - own_val = m(own_first_key, own_second_key);
21.67 - ignore_unused_variable_warning(val);
21.68 - ignore_unused_variable_warning(own_val);
21.69 - }
21.70 -
21.71 - FirstKey& first_key;
21.72 - SecondKey& second_key;
21.73 - typename _ReadMatrixMap::FirstKey& own_first_key;
21.74 - typename _ReadMatrixMap::SecondKey& own_second_key;
21.75 - _ReadMatrixMap& m;
21.76 - };
21.77 -
21.78 - };
21.79 -
21.80 -
21.81 - /// Writable map concept
21.82 - template <typename K1, typename K2, typename V>
21.83 - class WriteMatrixMap {
21.84 - public:
21.85 - /// Map's first key type.
21.86 - typedef K1 FirstKey;
21.87 - /// Map's second key type.
21.88 - typedef K2 SecondKey;
21.89 - /// \brief Map's value type.
21.90 - /// (The type of objects associated with the pairs of keys).
21.91 - typedef V Value;
21.92 -
21.93 - /// Sets the value associated with the pair of keys.
21.94 - void set(const FirstKey&, const SecondKey& ,const Value&) {}
21.95 -
21.96 - template <typename _WriteMatrixMap>
21.97 - struct Constraints {
21.98 - void constraints() {
21.99 - // No constraints for constructor.
21.100 - m.set(first_key, second_key, val);
21.101 - m.set(own_first_key, own_second_key, own_val);
21.102 - }
21.103 -
21.104 - Value& val;
21.105 - typename _WriteMatrixMap::Value own_val;
21.106 - FirstKey& first_key;
21.107 - SecondKey& second_key;
21.108 - typename _WriteMatrixMap::FirstKey& own_first_key;
21.109 - typename _WriteMatrixMap::SecondKey& own_second_key;
21.110 - _WriteMatrixMap& m;
21.111 -
21.112 - };
21.113 - };
21.114 -
21.115 - ///Read/Writable map concept
21.116 - template<typename K1, typename K2, typename V>
21.117 - class ReadWriteMatrixMap
21.118 - : public ReadMatrixMap<K1, K2, V>, public WriteMatrixMap<K1, K2, V> {
21.119 - public:
21.120 - /// Map's first key type.
21.121 - typedef K1 FirstKey;
21.122 - /// Map's second key type.
21.123 - typedef K2 SecondKey;
21.124 - /// \brief Map's value type.
21.125 - /// (The type of objects associated with the pairs of keys).
21.126 - typedef V Value;
21.127 -
21.128 - /// Returns the value associated with a pair of keys.
21.129 - Value operator()(const FirstKey&, const SecondKey&) const {
21.130 - return Value();
21.131 - }
21.132 - /// Sets the value associated with the pair of keys.
21.133 - void set(const FirstKey&, const SecondKey& ,const Value&) {}
21.134 -
21.135 - template<typename _ReadWriteMatrixMap>
21.136 - struct Constraints {
21.137 - void constraints() {
21.138 - checkConcept<ReadMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
21.139 - checkConcept<WriteMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
21.140 - }
21.141 - };
21.142 - };
21.143 -
21.144 -
21.145 - ///Dereferable matrix map concept
21.146 - template<typename K1, typename K2, typename V, typename R, typename CR>
21.147 - class ReferenceMatrixMap : public ReadWriteMatrixMap<K1, K2, V>
21.148 - {
21.149 - public:
21.150 - /// Tag for reference maps.
21.151 - typedef True ReferenceMapTag;
21.152 - /// Map's first key type.
21.153 - typedef K1 FirstKey;
21.154 - /// Map's second key type.
21.155 - typedef K1 SecondKey;
21.156 - /// Map's value type. (The type of objects associated with the keys).
21.157 - typedef V Value;
21.158 - /// Map's reference type.
21.159 - typedef R Reference;
21.160 - /// Map's const reference type.
21.161 - typedef CR ConstReference;
21.162 -
21.163 - protected:
21.164 - Value tmp;
21.165 - public:
21.166 -
21.167 - ///Returns a reference to the value associated to a pair of keys.
21.168 - Reference operator()(const FirstKey&, const SecondKey&) {
21.169 - return tmp;
21.170 - }
21.171 - ///Returns a const reference to the value associated to a pair of keys.
21.172 - ConstReference operator()(const FirstKey&, const SecondKey&) const {
21.173 - return tmp;
21.174 - }
21.175 - /// Sets the value associated with the pair of keys.
21.176 - void set(const FirstKey&, const SecondKey& ,const Value&) {}
21.177 -
21.178 - // \todo rethink this concept
21.179 - template<typename _ReferenceMatrixMap>
21.180 - struct ReferenceMapConcept {
21.181 -
21.182 - void constraints() {
21.183 - checkConcept<ReadWriteMatrixMap, _ReferenceMatrixMap >();
21.184 - m(first_key, second_key) = val;
21.185 - val = m(first_key, second_key);
21.186 - m(first_key, second_key) = ref;
21.187 - ref = m(first_key, second_key);
21.188 - m(own_first_key, own_second_key) = own_val;
21.189 - own_val = m(own_first_key, own_second_key);
21.190 - m(own_first_key, own_second_key) = own_ref;
21.191 - own_ref = m(own_first_key, own_second_key);
21.192 - }
21.193 -
21.194 - typename _ReferenceMatrixMap::Key& own_first_key;
21.195 - typename _ReferenceMatrixMap::Key& own_second_key;
21.196 - typename _ReferenceMatrixMap::Value& own_val;
21.197 - typename _ReferenceMatrixMap::Reference& own_ref;
21.198 - FirstKey& first_key;
21.199 - SecondKey& second_key;
21.200 - Value& val;
21.201 - Reference& ref;
21.202 - _ReferenceMatrixMap& m;
21.203 - };
21.204 - };
21.205 -
21.206 - // @}
21.207 -
21.208 - } //namespace concept
21.209 -} //namespace lemon
21.210 -#endif // LEMON_CONCEPT_MATRIX_MAPS_H
22.1 --- a/lemon/concept/path.h Tue Oct 24 16:49:41 2006 +0000
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,294 +0,0 @@
22.4 -/* -*- C++ -*-
22.5 - *
22.6 - * This file is a part of LEMON, a generic C++ optimization library
22.7 - *
22.8 - * Copyright (C) 2003-2006
22.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
22.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
22.11 - *
22.12 - * Permission to use, modify and distribute this software is granted
22.13 - * provided that this copyright notice appears in all copies. For
22.14 - * precise terms see the accompanying LICENSE file.
22.15 - *
22.16 - * This software is provided "AS IS" with no warranty of any kind,
22.17 - * express or implied, and with no claim as to its suitability for any
22.18 - * purpose.
22.19 - *
22.20 - */
22.21 -
22.22 -///\ingroup concept
22.23 -///\file
22.24 -///\brief Classes for representing paths in graphs.
22.25 -///
22.26 -///\todo Iterators have obsolete style
22.27 -
22.28 -#ifndef LEMON_CONCEPT_PATH_H
22.29 -#define LEMON_CONCEPT_PATH_H
22.30 -
22.31 -#include <lemon/bits/invalid.h>
22.32 -#include <lemon/concept_check.h>
22.33 -
22.34 -namespace lemon {
22.35 - namespace concept {
22.36 - /// \addtogroup concept
22.37 - /// @{
22.38 -
22.39 -
22.40 - //! \brief A skeleton structure for representing directed paths in a graph.
22.41 - //!
22.42 - //! A skeleton structure for representing directed paths in a graph.
22.43 - //! \param _Graph The graph type in which the path is.
22.44 - //!
22.45 - //! In a sense, the path can be treated as a graph, for it has \c NodeIt
22.46 - //! and \c EdgeIt with the same usage. These types converts to the \c Node
22.47 - //! and \c Edge of the original graph.
22.48 - template<typename _Graph>
22.49 - class Path {
22.50 - public:
22.51 -
22.52 - /// Type of the underlying graph.
22.53 - typedef _Graph Graph;
22.54 - /// Edge type of the underlying graph.
22.55 - typedef typename Graph::Edge Edge;
22.56 - /// Node type of the underlying graph.
22.57 - typedef typename Graph::Node Node;
22.58 -
22.59 - class NodeIt;
22.60 - class EdgeIt;
22.61 -
22.62 - /// \param _g The graph in which the path is.
22.63 - ///
22.64 - Path(const Graph &_g) {
22.65 - ignore_unused_variable_warning(_g);
22.66 - }
22.67 -
22.68 - /// Length of the path ie. the number of edges in the path.
22.69 - int length() const {return 0;}
22.70 -
22.71 - /// Returns whether the path is empty.
22.72 - bool empty() const { return true;}
22.73 -
22.74 - /// Resets the path to an empty path.
22.75 - void clear() {}
22.76 -
22.77 - /// \brief Starting point of the path.
22.78 - ///
22.79 - /// Starting point of the path.
22.80 - /// Returns INVALID if the path is empty.
22.81 - Node target() const {return INVALID;}
22.82 - /// \brief End point of the path.
22.83 - ///
22.84 - /// End point of the path.
22.85 - /// Returns INVALID if the path is empty.
22.86 - Node source() const {return INVALID;}
22.87 -
22.88 - /// \brief The target of an edge.
22.89 - ///
22.90 - /// Returns node iterator pointing to the target node of the
22.91 - /// given edge iterator.
22.92 - NodeIt target(const EdgeIt&) const {return INVALID;}
22.93 -
22.94 - /// \brief The source of an edge.
22.95 - ///
22.96 - /// Returns node iterator pointing to the source node of the
22.97 - /// given edge iterator.
22.98 - NodeIt source(const EdgeIt&) const {return INVALID;}
22.99 -
22.100 - /// \brief Iterator class to iterate on the nodes of the paths
22.101 - ///
22.102 - /// This class is used to iterate on the nodes of the paths
22.103 - ///
22.104 - /// Of course it converts to Graph::Node.
22.105 - class NodeIt {
22.106 - public:
22.107 - /// Default constructor
22.108 - NodeIt() {}
22.109 - /// Invalid constructor
22.110 - NodeIt(Invalid) {}
22.111 - /// Constructor with starting point
22.112 - NodeIt(const Path &) {}
22.113 -
22.114 - ///Conversion to Graph::Node
22.115 - operator Node() const { return INVALID; }
22.116 - /// Next node
22.117 - NodeIt& operator++() {return *this;}
22.118 -
22.119 - /// Comparison operator
22.120 - bool operator==(const NodeIt&) const {return true;}
22.121 - /// Comparison operator
22.122 - bool operator!=(const NodeIt&) const {return true;}
22.123 - /// Comparison operator
22.124 - bool operator<(const NodeIt&) const {return false;}
22.125 -
22.126 - };
22.127 -
22.128 - /// \brief Iterator class to iterate on the edges of the paths
22.129 - ///
22.130 - /// This class is used to iterate on the edges of the paths
22.131 - ///
22.132 - /// Of course it converts to Graph::Edge
22.133 - class EdgeIt {
22.134 - public:
22.135 - /// Default constructor
22.136 - EdgeIt() {}
22.137 - /// Invalid constructor
22.138 - EdgeIt(Invalid) {}
22.139 - /// Constructor with starting point
22.140 - EdgeIt(const Path &) {}
22.141 -
22.142 - operator Edge() const { return INVALID; }
22.143 -
22.144 - /// Next edge
22.145 - EdgeIt& operator++() {return *this;}
22.146 -
22.147 - /// Comparison operator
22.148 - bool operator==(const EdgeIt&) const {return true;}
22.149 - /// Comparison operator
22.150 - bool operator!=(const EdgeIt&) const {return true;}
22.151 - /// Comparison operator
22.152 - bool operator<(const EdgeIt&) const {return false;}
22.153 -
22.154 - };
22.155 -
22.156 -
22.157 - friend class Builder;
22.158 -
22.159 - /// \brief Class to build paths
22.160 - ///
22.161 - /// This class is used to fill a path with edges.
22.162 - ///
22.163 - /// You can push new edges to the front and to the back of the path in
22.164 - /// arbitrary order then you should commit these changes to the graph.
22.165 - ///
22.166 - /// While the builder is active (after the first modifying
22.167 - /// operation and until the call of \ref commit()) the
22.168 - /// underlining Path is in a "transitional" state (operations on
22.169 - /// it have undefined result).
22.170 - class Builder {
22.171 - public:
22.172 -
22.173 - /// Constructor
22.174 -
22.175 - /// Constructor
22.176 - /// \param _path the path you want to fill in.
22.177 - ///
22.178 -
22.179 - Builder(Path &_path) { ignore_unused_variable_warning(_path); }
22.180 -
22.181 - /// Sets the starting node of the path.
22.182 -
22.183 - /// Sets the starting node of the path. Edge added to the path
22.184 - /// afterwards have to be incident to this node.
22.185 - /// You \em must start building an empty path with these functions.
22.186 - /// (And you \em must \em not use it later).
22.187 - /// \sa pushFront()
22.188 - /// \sa pushBack()
22.189 - void setStartNode(const Node &) {}
22.190 -
22.191 - ///Push a new edge to the front of the path
22.192 -
22.193 - ///Push a new edge to the front of the path.
22.194 - ///If the path is empty, you \em must call \ref setStartNode() before
22.195 - ///the first use of \ref pushFront().
22.196 - void pushFront(const Edge&) {}
22.197 -
22.198 - ///Push a new edge to the back of the path
22.199 -
22.200 - ///Push a new edge to the back of the path.
22.201 - ///If the path is empty, you \em must call \ref setStartNode() before
22.202 - ///the first use of \ref pushBack().
22.203 - void pushBack(const Edge&) {}
22.204 -
22.205 - ///Commit the changes to the path.
22.206 -
22.207 - ///Commit the changes to the path.
22.208 - ///
22.209 - void commit() {}
22.210 -
22.211 - ///Reserve (front) storage for the builder in advance.
22.212 -
22.213 - ///If you know a reasonable upper bound on the number of the edges
22.214 - ///to add to the front of the path,
22.215 - ///using this function you may speed up the building.
22.216 - void reserveFront(size_t) {}
22.217 - ///Reserve (back) storage for the builder in advance.
22.218 -
22.219 - ///If you know a reasonable upper bound on the number of the edges
22.220 - ///to add to the back of the path,
22.221 - ///using this function you may speed up the building.
22.222 - void reserveBack(size_t) {}
22.223 - };
22.224 -
22.225 - template <typename _Path>
22.226 - struct Constraints {
22.227 - void constraints() {
22.228 - typedef typename _Path::Node Node;
22.229 - typedef typename _Path::NodeIt NodeIt;
22.230 - typedef typename Graph::Node GraphNode;
22.231 -
22.232 - typedef typename _Path::Edge Edge;
22.233 - typedef typename _Path::EdgeIt EdgeIt;
22.234 - typedef typename Graph::Edge GraphEdge;
22.235 -
22.236 - typedef typename _Path::Builder Builder;
22.237 -
22.238 - path = _Path(graph);
22.239 -
22.240 - bool b = cpath.empty();
22.241 - int l = cpath.length();
22.242 -
22.243 - Node gn;
22.244 - Edge ge;
22.245 - gn = cpath.source();
22.246 - gn = cpath.target();
22.247 -
22.248 - NodeIt nit;
22.249 - EdgeIt eit(INVALID);
22.250 - nit = path.source(eit);
22.251 - nit = path.target(eit);
22.252 -
22.253 - nit = NodeIt();
22.254 - nit = NodeIt(cpath);
22.255 - nit = INVALID;
22.256 - gn = nit;
22.257 - ++nit;
22.258 - b = nit == nit;
22.259 - b = nit != nit;
22.260 - b = nit < nit;
22.261 -
22.262 - eit = EdgeIt();
22.263 - eit = EdgeIt(cpath);
22.264 - eit = INVALID;
22.265 - ge = eit;
22.266 - ++eit;
22.267 - b = eit == eit;
22.268 - b = eit != eit;
22.269 - b = eit < eit;
22.270 -
22.271 - size_t st = 0;
22.272 -
22.273 - Builder builder(path);
22.274 - builder.setStartNode(gn);
22.275 - builder.pushFront(ge);
22.276 - builder.pushBack(ge);
22.277 - builder.commit();
22.278 - builder.reserveFront(st);
22.279 - builder.reserveBack(st);
22.280 -
22.281 - ignore_unused_variable_warning(l);
22.282 - ignore_unused_variable_warning(b);
22.283 - }
22.284 -
22.285 - const Graph& graph;
22.286 - const _Path& cpath;
22.287 - _Path& path;
22.288 - };
22.289 -
22.290 - };
22.291 -
22.292 - ///@}
22.293 - }
22.294 -
22.295 -} // namespace lemon
22.296 -
22.297 -#endif // LEMON_CONCEPT_PATH_H
23.1 --- a/lemon/concept/ugraph.h Tue Oct 24 16:49:41 2006 +0000
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,713 +0,0 @@
23.4 -/* -*- C++ -*-
23.5 - *
23.6 - * This file is a part of LEMON, a generic C++ optimization library
23.7 - *
23.8 - * Copyright (C) 2003-2006
23.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
23.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
23.11 - *
23.12 - * Permission to use, modify and distribute this software is granted
23.13 - * provided that this copyright notice appears in all copies. For
23.14 - * precise terms see the accompanying LICENSE file.
23.15 - *
23.16 - * This software is provided "AS IS" with no warranty of any kind,
23.17 - * express or implied, and with no claim as to its suitability for any
23.18 - * purpose.
23.19 - *
23.20 - */
23.21 -
23.22 -///\ingroup graph_concepts
23.23 -///\file
23.24 -///\brief The concept of the undirected graphs.
23.25 -
23.26 -
23.27 -#ifndef LEMON_CONCEPT_UGRAPH_H
23.28 -#define LEMON_CONCEPT_UGRAPH_H
23.29 -
23.30 -#include <lemon/concept/graph_components.h>
23.31 -#include <lemon/concept/graph.h>
23.32 -#include <lemon/bits/utility.h>
23.33 -
23.34 -namespace lemon {
23.35 - namespace concept {
23.36 -
23.37 - /// \addtogroup graph_concepts
23.38 - /// @{
23.39 -
23.40 -
23.41 - /// \brief Class describing the concept of Undirected Graphs.
23.42 - ///
23.43 - /// This class describes the common interface of all Undirected
23.44 - /// Graphs.
23.45 - ///
23.46 - /// As all concept describing classes it provides only interface
23.47 - /// without any sensible implementation. So any algorithm for
23.48 - /// undirected graph should compile with this class, but it will not
23.49 - /// run properly, of course.
23.50 - ///
23.51 - /// The LEMON undirected graphs also fulfill the concept of
23.52 - /// directed graphs (\ref lemon::concept::Graph "Graph
23.53 - /// Concept"). Each undirected edges can be seen as two opposite
23.54 - /// directed edge and consequently the undirected graph can be
23.55 - /// seen as the direceted graph of these directed edges. The
23.56 - /// UGraph has the UEdge inner class for the undirected edges and
23.57 - /// the Edge type for the directed edges. The Edge type is
23.58 - /// convertible to UEdge or inherited from it so from a directed
23.59 - /// edge we can get the represented undirected edge.
23.60 - ///
23.61 - /// In the sense of the LEMON each undirected edge has a default
23.62 - /// direction (it should be in every computer implementation,
23.63 - /// because the order of undirected edge's nodes defines an
23.64 - /// orientation). With the default orientation we can define that
23.65 - /// the directed edge is forward or backward directed. With the \c
23.66 - /// direction() and \c direct() function we can get the direction
23.67 - /// of the directed edge and we can direct an undirected edge.
23.68 - ///
23.69 - /// The UEdgeIt is an iterator for the undirected edges. We can use
23.70 - /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and
23.71 - /// OutEdgeIt iterates on the same undirected edges but with opposite
23.72 - /// direction. The IncEdgeIt iterates also on the same undirected edges
23.73 - /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just
23.74 - /// to UEdge.
23.75 - class UGraph {
23.76 - public:
23.77 - /// \brief The undirected graph should be tagged by the
23.78 - /// UndirectedTag.
23.79 - ///
23.80 - /// The undirected graph should be tagged by the UndirectedTag. This
23.81 - /// tag helps the enable_if technics to make compile time
23.82 - /// specializations for undirected graphs.
23.83 - typedef True UndirectedTag;
23.84 -
23.85 - /// \brief The base type of node iterators,
23.86 - /// or in other words, the trivial node iterator.
23.87 - ///
23.88 - /// This is the base type of each node iterator,
23.89 - /// thus each kind of node iterator converts to this.
23.90 - /// More precisely each kind of node iterator should be inherited
23.91 - /// from the trivial node iterator.
23.92 - class Node {
23.93 - public:
23.94 - /// Default constructor
23.95 -
23.96 - /// @warning The default constructor sets the iterator
23.97 - /// to an undefined value.
23.98 - Node() { }
23.99 - /// Copy constructor.
23.100 -
23.101 - /// Copy constructor.
23.102 - ///
23.103 - Node(const Node&) { }
23.104 -
23.105 - /// Invalid constructor \& conversion.
23.106 -
23.107 - /// This constructor initializes the iterator to be invalid.
23.108 - /// \sa Invalid for more details.
23.109 - Node(Invalid) { }
23.110 - /// Equality operator
23.111 -
23.112 - /// Two iterators are equal if and only if they point to the
23.113 - /// same object or both are invalid.
23.114 - bool operator==(Node) const { return true; }
23.115 -
23.116 - /// Inequality operator
23.117 -
23.118 - /// \sa operator==(Node n)
23.119 - ///
23.120 - bool operator!=(Node) const { return true; }
23.121 -
23.122 - /// Artificial ordering operator.
23.123 -
23.124 - /// To allow the use of graph descriptors as key type in std::map or
23.125 - /// similar associative container we require this.
23.126 - ///
23.127 - /// \note This operator only have to define some strict ordering of
23.128 - /// the items; this order has nothing to do with the iteration
23.129 - /// ordering of the items.
23.130 - bool operator<(Node) const { return false; }
23.131 -
23.132 - };
23.133 -
23.134 - /// This iterator goes through each node.
23.135 -
23.136 - /// This iterator goes through each node.
23.137 - /// Its usage is quite simple, for example you can count the number
23.138 - /// of nodes in graph \c g of type \c Graph like this:
23.139 - ///\code
23.140 - /// int count=0;
23.141 - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
23.142 - ///\endcode
23.143 - class NodeIt : public Node {
23.144 - public:
23.145 - /// Default constructor
23.146 -
23.147 - /// @warning The default constructor sets the iterator
23.148 - /// to an undefined value.
23.149 - NodeIt() { }
23.150 - /// Copy constructor.
23.151 -
23.152 - /// Copy constructor.
23.153 - ///
23.154 - NodeIt(const NodeIt& n) : Node(n) { }
23.155 - /// Invalid constructor \& conversion.
23.156 -
23.157 - /// Initialize the iterator to be invalid.
23.158 - /// \sa Invalid for more details.
23.159 - NodeIt(Invalid) { }
23.160 - /// Sets the iterator to the first node.
23.161 -
23.162 - /// Sets the iterator to the first node of \c g.
23.163 - ///
23.164 - NodeIt(const UGraph&) { }
23.165 - /// Node -> NodeIt conversion.
23.166 -
23.167 - /// Sets the iterator to the node of \c the graph pointed by
23.168 - /// the trivial iterator.
23.169 - /// This feature necessitates that each time we
23.170 - /// iterate the edge-set, the iteration order is the same.
23.171 - NodeIt(const UGraph&, const Node&) { }
23.172 - /// Next node.
23.173 -
23.174 - /// Assign the iterator to the next node.
23.175 - ///
23.176 - NodeIt& operator++() { return *this; }
23.177 - };
23.178 -
23.179 -
23.180 - /// The base type of the undirected edge iterators.
23.181 -
23.182 - /// The base type of the undirected edge iterators.
23.183 - ///
23.184 - class UEdge {
23.185 - public:
23.186 - /// Default constructor
23.187 -
23.188 - /// @warning The default constructor sets the iterator
23.189 - /// to an undefined value.
23.190 - UEdge() { }
23.191 - /// Copy constructor.
23.192 -
23.193 - /// Copy constructor.
23.194 - ///
23.195 - UEdge(const UEdge&) { }
23.196 - /// Initialize the iterator to be invalid.
23.197 -
23.198 - /// Initialize the iterator to be invalid.
23.199 - ///
23.200 - UEdge(Invalid) { }
23.201 - /// Equality operator
23.202 -
23.203 - /// Two iterators are equal if and only if they point to the
23.204 - /// same object or both are invalid.
23.205 - bool operator==(UEdge) const { return true; }
23.206 - /// Inequality operator
23.207 -
23.208 - /// \sa operator==(UEdge n)
23.209 - ///
23.210 - bool operator!=(UEdge) const { return true; }
23.211 -
23.212 - /// Artificial ordering operator.
23.213 -
23.214 - /// To allow the use of graph descriptors as key type in std::map or
23.215 - /// similar associative container we require this.
23.216 - ///
23.217 - /// \note This operator only have to define some strict ordering of
23.218 - /// the items; this order has nothing to do with the iteration
23.219 - /// ordering of the items.
23.220 - bool operator<(UEdge) const { return false; }
23.221 - };
23.222 -
23.223 - /// This iterator goes through each undirected edge.
23.224 -
23.225 - /// This iterator goes through each undirected edge of a graph.
23.226 - /// Its usage is quite simple, for example you can count the number
23.227 - /// of undirected edges in a graph \c g of type \c Graph as follows:
23.228 - ///\code
23.229 - /// int count=0;
23.230 - /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
23.231 - ///\endcode
23.232 - class UEdgeIt : public UEdge {
23.233 - public:
23.234 - /// Default constructor
23.235 -
23.236 - /// @warning The default constructor sets the iterator
23.237 - /// to an undefined value.
23.238 - UEdgeIt() { }
23.239 - /// Copy constructor.
23.240 -
23.241 - /// Copy constructor.
23.242 - ///
23.243 - UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
23.244 - /// Initialize the iterator to be invalid.
23.245 -
23.246 - /// Initialize the iterator to be invalid.
23.247 - ///
23.248 - UEdgeIt(Invalid) { }
23.249 - /// This constructor sets the iterator to the first undirected edge.
23.250 -
23.251 - /// This constructor sets the iterator to the first undirected edge.
23.252 - UEdgeIt(const UGraph&) { }
23.253 - /// UEdge -> UEdgeIt conversion
23.254 -
23.255 - /// Sets the iterator to the value of the trivial iterator.
23.256 - /// This feature necessitates that each time we
23.257 - /// iterate the undirected edge-set, the iteration order is the
23.258 - /// same.
23.259 - UEdgeIt(const UGraph&, const UEdge&) { }
23.260 - /// Next undirected edge
23.261 -
23.262 - /// Assign the iterator to the next undirected edge.
23.263 - UEdgeIt& operator++() { return *this; }
23.264 - };
23.265 -
23.266 - /// \brief This iterator goes trough the incident undirected
23.267 - /// edges of a node.
23.268 - ///
23.269 - /// This iterator goes trough the incident undirected edges
23.270 - /// of a certain node of a graph. You should assume that the
23.271 - /// loop edges will be iterated twice.
23.272 - ///
23.273 - /// Its usage is quite simple, for example you can compute the
23.274 - /// degree (i.e. count the number of incident edges of a node \c n
23.275 - /// in graph \c g of type \c Graph as follows.
23.276 - ///
23.277 - ///\code
23.278 - /// int count=0;
23.279 - /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
23.280 - ///\endcode
23.281 - class IncEdgeIt : public UEdge {
23.282 - public:
23.283 - /// Default constructor
23.284 -
23.285 - /// @warning The default constructor sets the iterator
23.286 - /// to an undefined value.
23.287 - IncEdgeIt() { }
23.288 - /// Copy constructor.
23.289 -
23.290 - /// Copy constructor.
23.291 - ///
23.292 - IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
23.293 - /// Initialize the iterator to be invalid.
23.294 -
23.295 - /// Initialize the iterator to be invalid.
23.296 - ///
23.297 - IncEdgeIt(Invalid) { }
23.298 - /// This constructor sets the iterator to first incident edge.
23.299 -
23.300 - /// This constructor set the iterator to the first incident edge of
23.301 - /// the node.
23.302 - IncEdgeIt(const UGraph&, const Node&) { }
23.303 - /// UEdge -> IncEdgeIt conversion
23.304 -
23.305 - /// Sets the iterator to the value of the trivial iterator \c e.
23.306 - /// This feature necessitates that each time we
23.307 - /// iterate the edge-set, the iteration order is the same.
23.308 - IncEdgeIt(const UGraph&, const UEdge&) { }
23.309 - /// Next incident edge
23.310 -
23.311 - /// Assign the iterator to the next incident edge
23.312 - /// of the corresponding node.
23.313 - IncEdgeIt& operator++() { return *this; }
23.314 - };
23.315 -
23.316 - /// The directed edge type.
23.317 -
23.318 - /// The directed edge type. It can be converted to the
23.319 - /// undirected edge or it should be inherited from the undirected
23.320 - /// edge.
23.321 - class Edge : public UEdge {
23.322 - public:
23.323 - /// Default constructor
23.324 -
23.325 - /// @warning The default constructor sets the iterator
23.326 - /// to an undefined value.
23.327 - Edge() { }
23.328 - /// Copy constructor.
23.329 -
23.330 - /// Copy constructor.
23.331 - ///
23.332 - Edge(const Edge& e) : UEdge(e) { }
23.333 - /// Initialize the iterator to be invalid.
23.334 -
23.335 - /// Initialize the iterator to be invalid.
23.336 - ///
23.337 - Edge(Invalid) { }
23.338 - /// Equality operator
23.339 -
23.340 - /// Two iterators are equal if and only if they point to the
23.341 - /// same object or both are invalid.
23.342 - bool operator==(Edge) const { return true; }
23.343 - /// Inequality operator
23.344 -
23.345 - /// \sa operator==(Edge n)
23.346 - ///
23.347 - bool operator!=(Edge) const { return true; }
23.348 -
23.349 - /// Artificial ordering operator.
23.350 -
23.351 - /// To allow the use of graph descriptors as key type in std::map or
23.352 - /// similar associative container we require this.
23.353 - ///
23.354 - /// \note This operator only have to define some strict ordering of
23.355 - /// the items; this order has nothing to do with the iteration
23.356 - /// ordering of the items.
23.357 - bool operator<(Edge) const { return false; }
23.358 -
23.359 - };
23.360 - /// This iterator goes through each directed edge.
23.361 -
23.362 - /// This iterator goes through each edge of a graph.
23.363 - /// Its usage is quite simple, for example you can count the number
23.364 - /// of edges in a graph \c g of type \c Graph as follows:
23.365 - ///\code
23.366 - /// int count=0;
23.367 - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
23.368 - ///\endcode
23.369 - class EdgeIt : public Edge {
23.370 - public:
23.371 - /// Default constructor
23.372 -
23.373 - /// @warning The default constructor sets the iterator
23.374 - /// to an undefined value.
23.375 - EdgeIt() { }
23.376 - /// Copy constructor.
23.377 -
23.378 - /// Copy constructor.
23.379 - ///
23.380 - EdgeIt(const EdgeIt& e) : Edge(e) { }
23.381 - /// Initialize the iterator to be invalid.
23.382 -
23.383 - /// Initialize the iterator to be invalid.
23.384 - ///
23.385 - EdgeIt(Invalid) { }
23.386 - /// This constructor sets the iterator to the first edge.
23.387 -
23.388 - /// This constructor sets the iterator to the first edge of \c g.
23.389 - ///@param g the graph
23.390 - EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); }
23.391 - /// Edge -> EdgeIt conversion
23.392 -
23.393 - /// Sets the iterator to the value of the trivial iterator \c e.
23.394 - /// This feature necessitates that each time we
23.395 - /// iterate the edge-set, the iteration order is the same.
23.396 - EdgeIt(const UGraph&, const Edge&) { }
23.397 - ///Next edge
23.398 -
23.399 - /// Assign the iterator to the next edge.
23.400 - EdgeIt& operator++() { return *this; }
23.401 - };
23.402 -
23.403 - /// This iterator goes trough the outgoing directed edges of a node.
23.404 -
23.405 - /// This iterator goes trough the \e outgoing edges of a certain node
23.406 - /// of a graph.
23.407 - /// Its usage is quite simple, for example you can count the number
23.408 - /// of outgoing edges of a node \c n
23.409 - /// in graph \c g of type \c Graph as follows.
23.410 - ///\code
23.411 - /// int count=0;
23.412 - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
23.413 - ///\endcode
23.414 -
23.415 - class OutEdgeIt : public Edge {
23.416 - public:
23.417 - /// Default constructor
23.418 -
23.419 - /// @warning The default constructor sets the iterator
23.420 - /// to an undefined value.
23.421 - OutEdgeIt() { }
23.422 - /// Copy constructor.
23.423 -
23.424 - /// Copy constructor.
23.425 - ///
23.426 - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
23.427 - /// Initialize the iterator to be invalid.
23.428 -
23.429 - /// Initialize the iterator to be invalid.
23.430 - ///
23.431 - OutEdgeIt(Invalid) { }
23.432 - /// This constructor sets the iterator to the first outgoing edge.
23.433 -
23.434 - /// This constructor sets the iterator to the first outgoing edge of
23.435 - /// the node.
23.436 - ///@param n the node
23.437 - ///@param g the graph
23.438 - OutEdgeIt(const UGraph& n, const Node& g) {
23.439 - ignore_unused_variable_warning(n);
23.440 - ignore_unused_variable_warning(g);
23.441 - }
23.442 - /// Edge -> OutEdgeIt conversion
23.443 -
23.444 - /// Sets the iterator to the value of the trivial iterator.
23.445 - /// This feature necessitates that each time we
23.446 - /// iterate the edge-set, the iteration order is the same.
23.447 - OutEdgeIt(const UGraph&, const Edge&) { }
23.448 - ///Next outgoing edge
23.449 -
23.450 - /// Assign the iterator to the next
23.451 - /// outgoing edge of the corresponding node.
23.452 - OutEdgeIt& operator++() { return *this; }
23.453 - };
23.454 -
23.455 - /// This iterator goes trough the incoming directed edges of a node.
23.456 -
23.457 - /// This iterator goes trough the \e incoming edges of a certain node
23.458 - /// of a graph.
23.459 - /// Its usage is quite simple, for example you can count the number
23.460 - /// of outgoing edges of a node \c n
23.461 - /// in graph \c g of type \c Graph as follows.
23.462 - ///\code
23.463 - /// int count=0;
23.464 - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
23.465 - ///\endcode
23.466 -
23.467 - class InEdgeIt : public Edge {
23.468 - public:
23.469 - /// Default constructor
23.470 -
23.471 - /// @warning The default constructor sets the iterator
23.472 - /// to an undefined value.
23.473 - InEdgeIt() { }
23.474 - /// Copy constructor.
23.475 -
23.476 - /// Copy constructor.
23.477 - ///
23.478 - InEdgeIt(const InEdgeIt& e) : Edge(e) { }
23.479 - /// Initialize the iterator to be invalid.
23.480 -
23.481 - /// Initialize the iterator to be invalid.
23.482 - ///
23.483 - InEdgeIt(Invalid) { }
23.484 - /// This constructor sets the iterator to first incoming edge.
23.485 -
23.486 - /// This constructor set the iterator to the first incoming edge of
23.487 - /// the node.
23.488 - ///@param n the node
23.489 - ///@param g the graph
23.490 - InEdgeIt(const UGraph& g, const Node& n) {
23.491 - ignore_unused_variable_warning(n);
23.492 - ignore_unused_variable_warning(g);
23.493 - }
23.494 - /// Edge -> InEdgeIt conversion
23.495 -
23.496 - /// Sets the iterator to the value of the trivial iterator \c e.
23.497 - /// This feature necessitates that each time we
23.498 - /// iterate the edge-set, the iteration order is the same.
23.499 - InEdgeIt(const UGraph&, const Edge&) { }
23.500 - /// Next incoming edge
23.501 -
23.502 - /// Assign the iterator to the next inedge of the corresponding node.
23.503 - ///
23.504 - InEdgeIt& operator++() { return *this; }
23.505 - };
23.506 -
23.507 - /// \brief Read write map of the nodes to type \c T.
23.508 - ///
23.509 - /// ReadWrite map of the nodes to type \c T.
23.510 - /// \sa Reference
23.511 - /// \warning Making maps that can handle bool type (NodeMap<bool>)
23.512 - /// needs some extra attention!
23.513 - template<class T>
23.514 - class NodeMap : public ReadWriteMap< Node, T >
23.515 - {
23.516 - public:
23.517 -
23.518 - ///\e
23.519 - NodeMap(const UGraph&) { }
23.520 - ///\e
23.521 - NodeMap(const UGraph&, T) { }
23.522 -
23.523 - ///Copy constructor
23.524 - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
23.525 - ///Assignment operator
23.526 - template <typename CMap>
23.527 - NodeMap& operator=(const CMap&) {
23.528 - checkConcept<ReadMap<Node, T>, CMap>();
23.529 - return *this;
23.530 - }
23.531 - };
23.532 -
23.533 - /// \brief Read write map of the directed edges to type \c T.
23.534 - ///
23.535 - /// Reference map of the directed edges to type \c T.
23.536 - /// \sa Reference
23.537 - /// \warning Making maps that can handle bool type (EdgeMap<bool>)
23.538 - /// needs some extra attention!
23.539 - template<class T>
23.540 - class EdgeMap : public ReadWriteMap<Edge,T>
23.541 - {
23.542 - public:
23.543 -
23.544 - ///\e
23.545 - EdgeMap(const UGraph&) { }
23.546 - ///\e
23.547 - EdgeMap(const UGraph&, T) { }
23.548 - ///Copy constructor
23.549 - EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
23.550 - ///Assignment operator
23.551 - template <typename CMap>
23.552 - EdgeMap& operator=(const CMap&) {
23.553 - checkConcept<ReadMap<Edge, T>, CMap>();
23.554 - return *this;
23.555 - }
23.556 - };
23.557 -
23.558 - /// Read write map of the undirected edges to type \c T.
23.559 -
23.560 - /// Reference map of the edges to type \c T.
23.561 - /// \sa Reference
23.562 - /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
23.563 - /// needs some extra attention!
23.564 - template<class T>
23.565 - class UEdgeMap : public ReadWriteMap<UEdge,T>
23.566 - {
23.567 - public:
23.568 -
23.569 - ///\e
23.570 - UEdgeMap(const UGraph&) { }
23.571 - ///\e
23.572 - UEdgeMap(const UGraph&, T) { }
23.573 - ///Copy constructor
23.574 - UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
23.575 - ///Assignment operator
23.576 - template <typename CMap>
23.577 - UEdgeMap& operator=(const CMap&) {
23.578 - checkConcept<ReadMap<UEdge, T>, CMap>();
23.579 - return *this;
23.580 - }
23.581 - };
23.582 -
23.583 - /// \brief Direct the given undirected edge.
23.584 - ///
23.585 - /// Direct the given undirected edge. The returned edge source
23.586 - /// will be the given node.
23.587 - Edge direct(const UEdge&, const Node&) const {
23.588 - return INVALID;
23.589 - }
23.590 -
23.591 - /// \brief Direct the given undirected edge.
23.592 - ///
23.593 - /// Direct the given undirected edge. The returned edge
23.594 - /// represents the given undireted edge and the direction comes
23.595 - /// from the given bool. The source of the undirected edge and
23.596 - /// the directed edge is the same when the given bool is true.
23.597 - Edge direct(const UEdge&, bool) const {
23.598 - return INVALID;
23.599 - }
23.600 -
23.601 - /// \brief Returns true if the edge has default orientation.
23.602 - ///
23.603 - /// Returns whether the given directed edge is same orientation as
23.604 - /// the corresponding undirected edge's default orientation.
23.605 - bool direction(Edge) const { return true; }
23.606 -
23.607 - /// \brief Returns the opposite directed edge.
23.608 - ///
23.609 - /// Returns the opposite directed edge.
23.610 - Edge oppositeEdge(Edge) const { return INVALID; }
23.611 -
23.612 - /// \brief Opposite node on an edge
23.613 - ///
23.614 - /// \return the opposite of the given Node on the given UEdge
23.615 - Node oppositeNode(Node, UEdge) const { return INVALID; }
23.616 -
23.617 - /// \brief First node of the undirected edge.
23.618 - ///
23.619 - /// \return the first node of the given UEdge.
23.620 - ///
23.621 - /// Naturally undirected edges don't have direction and thus
23.622 - /// don't have source and target node. But we use these two methods
23.623 - /// to query the two nodes of the edge. The direction of the edge
23.624 - /// which arises this way is called the inherent direction of the
23.625 - /// undirected edge, and is used to define the "default" direction
23.626 - /// of the directed versions of the edges.
23.627 - /// \sa direction
23.628 - Node source(UEdge) const { return INVALID; }
23.629 -
23.630 - /// \brief Second node of the undirected edge.
23.631 - Node target(UEdge) const { return INVALID; }
23.632 -
23.633 - /// \brief Source node of the directed edge.
23.634 - Node source(Edge) const { return INVALID; }
23.635 -
23.636 - /// \brief Target node of the directed edge.
23.637 - Node target(Edge) const { return INVALID; }
23.638 -
23.639 - void first(Node&) const {}
23.640 - void next(Node&) const {}
23.641 -
23.642 - void first(UEdge&) const {}
23.643 - void next(UEdge&) const {}
23.644 -
23.645 - void first(Edge&) const {}
23.646 - void next(Edge&) const {}
23.647 -
23.648 - void firstOut(Edge&, Node) const {}
23.649 - void nextOut(Edge&) const {}
23.650 -
23.651 - void firstIn(Edge&, Node) const {}
23.652 - void nextIn(Edge&) const {}
23.653 -
23.654 -
23.655 - void firstInc(UEdge &, bool &, const Node &) const {}
23.656 - void nextInc(UEdge &, bool &) const {}
23.657 -
23.658 - /// \brief Base node of the iterator
23.659 - ///
23.660 - /// Returns the base node (the source in this case) of the iterator
23.661 - Node baseNode(OutEdgeIt e) const {
23.662 - return source(e);
23.663 - }
23.664 - /// \brief Running node of the iterator
23.665 - ///
23.666 - /// Returns the running node (the target in this case) of the
23.667 - /// iterator
23.668 - Node runningNode(OutEdgeIt e) const {
23.669 - return target(e);
23.670 - }
23.671 -
23.672 - /// \brief Base node of the iterator
23.673 - ///
23.674 - /// Returns the base node (the target in this case) of the iterator
23.675 - Node baseNode(InEdgeIt e) const {
23.676 - return target(e);
23.677 - }
23.678 - /// \brief Running node of the iterator
23.679 - ///
23.680 - /// Returns the running node (the source in this case) of the
23.681 - /// iterator
23.682 - Node runningNode(InEdgeIt e) const {
23.683 - return source(e);
23.684 - }
23.685 -
23.686 - /// \brief Base node of the iterator
23.687 - ///
23.688 - /// Returns the base node of the iterator
23.689 - Node baseNode(IncEdgeIt) const {
23.690 - return INVALID;
23.691 - }
23.692 -
23.693 - /// \brief Running node of the iterator
23.694 - ///
23.695 - /// Returns the running node of the iterator
23.696 - Node runningNode(IncEdgeIt) const {
23.697 - return INVALID;
23.698 - }
23.699 -
23.700 - template <typename Graph>
23.701 - struct Constraints {
23.702 - void constraints() {
23.703 - checkConcept<IterableUGraphComponent<>, Graph>();
23.704 - checkConcept<MappableUGraphComponent<>, Graph>();
23.705 - }
23.706 - };
23.707 -
23.708 - };
23.709 -
23.710 - /// @}
23.711 -
23.712 - }
23.713 -
23.714 -}
23.715 -
23.716 -#endif
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/lemon/concepts/bpugraph.h Tue Oct 24 17:19:16 2006 +0000
24.3 @@ -0,0 +1,1020 @@
24.4 +/* -*- C++ -*-
24.5 + *
24.6 + * This file is a part of LEMON, a generic C++ optimization library
24.7 + *
24.8 + * Copyright (C) 2003-2006
24.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
24.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
24.11 + *
24.12 + * Permission to use, modify and distribute this software is granted
24.13 + * provided that this copyright notice appears in all copies. For
24.14 + * precise terms see the accompanying LICENSE file.
24.15 + *
24.16 + * This software is provided "AS IS" with no warranty of any kind,
24.17 + * express or implied, and with no claim as to its suitability for any
24.18 + * purpose.
24.19 + *
24.20 + */
24.21 +
24.22 +/// \ingroup graph_concepts
24.23 +/// \file
24.24 +/// \brief Undirected bipartite graphs and components of.
24.25 +
24.26 +
24.27 +#ifndef LEMON_CONCEPT_BPUGRAPH_H
24.28 +#define LEMON_CONCEPT_BPUGRAPH_H
24.29 +
24.30 +#include <lemon/concepts/graph_components.h>
24.31 +
24.32 +#include <lemon/concepts/graph.h>
24.33 +#include <lemon/concepts/ugraph.h>
24.34 +
24.35 +#include <lemon/bits/utility.h>
24.36 +
24.37 +namespace lemon {
24.38 + namespace concepts {
24.39 +
24.40 + /// \addtogroup graph_concepts
24.41 + /// @{
24.42 +
24.43 +
24.44 + /// \brief Class describing the concept of Bipartite Undirected Graphs.
24.45 + ///
24.46 + /// This class describes the common interface of all
24.47 + /// Undirected Bipartite Graphs.
24.48 + ///
24.49 + /// As all concept describing classes it provides only interface
24.50 + /// without any sensible implementation. So any algorithm for
24.51 + /// bipartite undirected graph should compile with this class, but it
24.52 + /// will not run properly, of course.
24.53 + ///
24.54 + /// In LEMON bipartite undirected graphs also fulfill the concept of
24.55 + /// the undirected graphs (\ref lemon::concepts::UGraph "UGraph Concept").
24.56 + ///
24.57 + /// You can assume that all undirected bipartite graph can be handled
24.58 + /// as an undirected graph and consequently as a static graph.
24.59 + ///
24.60 + /// The bipartite graph stores two types of nodes which are named
24.61 + /// ANode and BNode. The graph type contains two types ANode and
24.62 + /// BNode which are inherited from Node type. Moreover they have
24.63 + /// constructor which converts Node to either ANode or BNode when
24.64 + /// it is possible. Therefor everywhere the Node type can be used
24.65 + /// instead of ANode and BNode. So the usage of the ANode and
24.66 + /// BNode is not suggested.
24.67 + ///
24.68 + /// The iteration on the partition can be done with the ANodeIt and
24.69 + /// BNodeIt classes. The node map can be used to map values to the nodes
24.70 + /// and similarly we can use to map values for just the ANodes and
24.71 + /// BNodes the ANodeMap and BNodeMap template classes.
24.72 +
24.73 + class BpUGraph {
24.74 + public:
24.75 + /// \brief The undirected graph should be tagged by the
24.76 + /// UndirectedTag.
24.77 + ///
24.78 + /// The undirected graph should be tagged by the UndirectedTag. This
24.79 + /// tag helps the enable_if technics to make compile time
24.80 + /// specializations for undirected graphs.
24.81 + typedef True UndirectedTag;
24.82 +
24.83 + /// \brief The base type of node iterators,
24.84 + /// or in other words, the trivial node iterator.
24.85 + ///
24.86 + /// This is the base type of each node iterator,
24.87 + /// thus each kind of node iterator converts to this.
24.88 + /// More precisely each kind of node iterator should be inherited
24.89 + /// from the trivial node iterator. The Node class represents
24.90 + /// both of two types of nodes.
24.91 + class Node {
24.92 + public:
24.93 + /// Default constructor
24.94 +
24.95 + /// @warning The default constructor sets the iterator
24.96 + /// to an undefined value.
24.97 + Node() { }
24.98 + /// Copy constructor.
24.99 +
24.100 + /// Copy constructor.
24.101 + ///
24.102 + Node(const Node&) { }
24.103 +
24.104 + /// Invalid constructor \& conversion.
24.105 +
24.106 + /// This constructor initializes the iterator to be invalid.
24.107 + /// \sa Invalid for more details.
24.108 + Node(Invalid) { }
24.109 + /// Equality operator
24.110 +
24.111 + /// Two iterators are equal if and only if they point to the
24.112 + /// same object or both are invalid.
24.113 + bool operator==(Node) const { return true; }
24.114 +
24.115 + /// Inequality operator
24.116 +
24.117 + /// \sa operator==(Node n)
24.118 + ///
24.119 + bool operator!=(Node) const { return true; }
24.120 +
24.121 + /// Artificial ordering operator.
24.122 +
24.123 + /// To allow the use of graph descriptors as key type in std::map or
24.124 + /// similar associative container we require this.
24.125 + ///
24.126 + /// \note This operator only have to define some strict ordering of
24.127 + /// the items; this order has nothing to do with the iteration
24.128 + /// ordering of the items.
24.129 + bool operator<(Node) const { return false; }
24.130 +
24.131 + };
24.132 +
24.133 + /// \brief Helper class for ANodes.
24.134 + ///
24.135 + /// This class is just a helper class for ANodes, it is not
24.136 + /// suggested to use it directly. It can be converted easily to
24.137 + /// node and vice versa. The usage of this class is limited
24.138 + /// to use just as template parameters for special map types.
24.139 + class ANode : public Node {
24.140 + public:
24.141 + /// Default constructor
24.142 +
24.143 + /// @warning The default constructor sets the iterator
24.144 + /// to an undefined value.
24.145 + ANode() : Node() { }
24.146 + /// Copy constructor.
24.147 +
24.148 + /// Copy constructor.
24.149 + ///
24.150 + ANode(const ANode&) : Node() { }
24.151 +
24.152 + /// Construct the same node as ANode.
24.153 +
24.154 + /// Construct the same node as ANode. It may throws assertion
24.155 + /// when the given node is from the BNode set.
24.156 + ANode(const Node&) : Node() { }
24.157 +
24.158 + /// Assign node to A-node.
24.159 +
24.160 + /// Besides the core graph item functionality each node should
24.161 + /// be convertible to the represented A-node if it is it possible.
24.162 + ANode& operator=(const Node&) { return *this; }
24.163 +
24.164 + /// Invalid constructor \& conversion.
24.165 +
24.166 + /// This constructor initializes the iterator to be invalid.
24.167 + /// \sa Invalid for more details.
24.168 + ANode(Invalid) { }
24.169 + /// Equality operator
24.170 +
24.171 + /// Two iterators are equal if and only if they point to the
24.172 + /// same object or both are invalid.
24.173 + bool operator==(ANode) const { return true; }
24.174 +
24.175 + /// Inequality operator
24.176 +
24.177 + /// \sa operator==(ANode n)
24.178 + ///
24.179 + bool operator!=(ANode) const { return true; }
24.180 +
24.181 + /// Artificial ordering operator.
24.182 +
24.183 + /// To allow the use of graph descriptors as key type in std::map or
24.184 + /// similar associative container we require this.
24.185 + ///
24.186 + /// \note This operator only have to define some strict ordering of
24.187 + /// the items; this order has nothing to do with the iteration
24.188 + /// ordering of the items.
24.189 + bool operator<(ANode) const { return false; }
24.190 +
24.191 + };
24.192 +
24.193 + /// \brief Helper class for BNodes.
24.194 + ///
24.195 + /// This class is just a helper class for BNodes, it is not
24.196 + /// suggested to use it directly. It can be converted easily to
24.197 + /// node and vice versa. The usage of this class is limited
24.198 + /// to use just as template parameters for special map types.
24.199 + class BNode : public Node {
24.200 + public:
24.201 + /// Default constructor
24.202 +
24.203 + /// @warning The default constructor sets the iterator
24.204 + /// to an undefined value.
24.205 + BNode() : Node() { }
24.206 + /// Copy constructor.
24.207 +
24.208 + /// Copy constructor.
24.209 + ///
24.210 + BNode(const BNode&) : Node() { }
24.211 +
24.212 + /// Construct the same node as BNode.
24.213 +
24.214 + /// Construct the same node as BNode. It may throws assertion
24.215 + /// when the given node is from the ANode set.
24.216 + BNode(const Node&) : Node() { }
24.217 +
24.218 + /// Assign node to B-node.
24.219 +
24.220 + /// Besides the core graph item functionality each node should
24.221 + /// be convertible to the represented B-node if it is it possible.
24.222 + BNode& operator=(const Node&) { return *this; }
24.223 +
24.224 + /// Invalid constructor \& conversion.
24.225 +
24.226 + /// This constructor initializes the iterator to be invalid.
24.227 + /// \sa Invalid for more details.
24.228 + BNode(Invalid) { }
24.229 + /// Equality operator
24.230 +
24.231 + /// Two iterators are equal if and only if they point to the
24.232 + /// same object or both are invalid.
24.233 + bool operator==(BNode) const { return true; }
24.234 +
24.235 + /// Inequality operator
24.236 +
24.237 + /// \sa operator==(BNode n)
24.238 + ///
24.239 + bool operator!=(BNode) const { return true; }
24.240 +
24.241 + /// Artificial ordering operator.
24.242 +
24.243 + /// To allow the use of graph descriptors as key type in std::map or
24.244 + /// similar associative container we require this.
24.245 + ///
24.246 + /// \note This operator only have to define some strict ordering of
24.247 + /// the items; this order has nothing to do with the iteration
24.248 + /// ordering of the items.
24.249 + bool operator<(BNode) const { return false; }
24.250 +
24.251 + };
24.252 +
24.253 + /// This iterator goes through each node.
24.254 +
24.255 + /// This iterator goes through each node.
24.256 + /// Its usage is quite simple, for example you can count the number
24.257 + /// of nodes in graph \c g of type \c Graph like this:
24.258 + ///\code
24.259 + /// int count=0;
24.260 + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
24.261 + ///\endcode
24.262 + class NodeIt : public Node {
24.263 + public:
24.264 + /// Default constructor
24.265 +
24.266 + /// @warning The default constructor sets the iterator
24.267 + /// to an undefined value.
24.268 + NodeIt() { }
24.269 + /// Copy constructor.
24.270 +
24.271 + /// Copy constructor.
24.272 + ///
24.273 + NodeIt(const NodeIt& n) : Node(n) { }
24.274 + /// Invalid constructor \& conversion.
24.275 +
24.276 + /// Initialize the iterator to be invalid.
24.277 + /// \sa Invalid for more details.
24.278 + NodeIt(Invalid) { }
24.279 + /// Sets the iterator to the first node.
24.280 +
24.281 + /// Sets the iterator to the first node of \c g.
24.282 + ///
24.283 + NodeIt(const BpUGraph&) { }
24.284 + /// Node -> NodeIt conversion.
24.285 +
24.286 + /// Sets the iterator to the node of \c the graph pointed by
24.287 + /// the trivial iterator.
24.288 + /// This feature necessitates that each time we
24.289 + /// iterate the edge-set, the iteration order is the same.
24.290 + NodeIt(const BpUGraph&, const Node&) { }
24.291 + /// Next node.
24.292 +
24.293 + /// Assign the iterator to the next node.
24.294 + ///
24.295 + NodeIt& operator++() { return *this; }
24.296 + };
24.297 +
24.298 + /// This iterator goes through each ANode.
24.299 +
24.300 + /// This iterator goes through each ANode.
24.301 + /// Its usage is quite simple, for example you can count the number
24.302 + /// of nodes in graph \c g of type \c Graph like this:
24.303 + ///\code
24.304 + /// int count=0;
24.305 + /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
24.306 + ///\endcode
24.307 + class ANodeIt : public Node {
24.308 + public:
24.309 + /// Default constructor
24.310 +
24.311 + /// @warning The default constructor sets the iterator
24.312 + /// to an undefined value.
24.313 + ANodeIt() { }
24.314 + /// Copy constructor.
24.315 +
24.316 + /// Copy constructor.
24.317 + ///
24.318 + ANodeIt(const ANodeIt& n) : Node(n) { }
24.319 + /// Invalid constructor \& conversion.
24.320 +
24.321 + /// Initialize the iterator to be invalid.
24.322 + /// \sa Invalid for more details.
24.323 + ANodeIt(Invalid) { }
24.324 + /// Sets the iterator to the first node.
24.325 +
24.326 + /// Sets the iterator to the first node of \c g.
24.327 + ///
24.328 + ANodeIt(const BpUGraph&) { }
24.329 + /// Node -> ANodeIt conversion.
24.330 +
24.331 + /// Sets the iterator to the node of \c the graph pointed by
24.332 + /// the trivial iterator.
24.333 + /// This feature necessitates that each time we
24.334 + /// iterate the edge-set, the iteration order is the same.
24.335 + ANodeIt(const BpUGraph&, const Node&) { }
24.336 + /// Next node.
24.337 +
24.338 + /// Assign the iterator to the next node.
24.339 + ///
24.340 + ANodeIt& operator++() { return *this; }
24.341 + };
24.342 +
24.343 + /// This iterator goes through each BNode.
24.344 +
24.345 + /// This iterator goes through each BNode.
24.346 + /// Its usage is quite simple, for example you can count the number
24.347 + /// of nodes in graph \c g of type \c Graph like this:
24.348 + ///\code
24.349 + /// int count=0;
24.350 + /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
24.351 + ///\endcode
24.352 + class BNodeIt : public Node {
24.353 + public:
24.354 + /// Default constructor
24.355 +
24.356 + /// @warning The default constructor sets the iterator
24.357 + /// to an undefined value.
24.358 + BNodeIt() { }
24.359 + /// Copy constructor.
24.360 +
24.361 + /// Copy constructor.
24.362 + ///
24.363 + BNodeIt(const BNodeIt& n) : Node(n) { }
24.364 + /// Invalid constructor \& conversion.
24.365 +
24.366 + /// Initialize the iterator to be invalid.
24.367 + /// \sa Invalid for more details.
24.368 + BNodeIt(Invalid) { }
24.369 + /// Sets the iterator to the first node.
24.370 +
24.371 + /// Sets the iterator to the first node of \c g.
24.372 + ///
24.373 + BNodeIt(const BpUGraph&) { }
24.374 + /// Node -> BNodeIt conversion.
24.375 +
24.376 + /// Sets the iterator to the node of \c the graph pointed by
24.377 + /// the trivial iterator.
24.378 + /// This feature necessitates that each time we
24.379 + /// iterate the edge-set, the iteration order is the same.
24.380 + BNodeIt(const BpUGraph&, const Node&) { }
24.381 + /// Next node.
24.382 +
24.383 + /// Assign the iterator to the next node.
24.384 + ///
24.385 + BNodeIt& operator++() { return *this; }
24.386 + };
24.387 +
24.388 +
24.389 + /// The base type of the undirected edge iterators.
24.390 +
24.391 + /// The base type of the undirected edge iterators.
24.392 + ///
24.393 + class UEdge {
24.394 + public:
24.395 + /// Default constructor
24.396 +
24.397 + /// @warning The default constructor sets the iterator
24.398 + /// to an undefined value.
24.399 + UEdge() { }
24.400 + /// Copy constructor.
24.401 +
24.402 + /// Copy constructor.
24.403 + ///
24.404 + UEdge(const UEdge&) { }
24.405 + /// Initialize the iterator to be invalid.
24.406 +
24.407 + /// Initialize the iterator to be invalid.
24.408 + ///
24.409 + UEdge(Invalid) { }
24.410 + /// Equality operator
24.411 +
24.412 + /// Two iterators are equal if and only if they point to the
24.413 + /// same object or both are invalid.
24.414 + bool operator==(UEdge) const { return true; }
24.415 + /// Inequality operator
24.416 +
24.417 + /// \sa operator==(UEdge n)
24.418 + ///
24.419 + bool operator!=(UEdge) const { return true; }
24.420 +
24.421 + /// Artificial ordering operator.
24.422 +
24.423 + /// To allow the use of graph descriptors as key type in std::map or
24.424 + /// similar associative container we require this.
24.425 + ///
24.426 + /// \note This operator only have to define some strict ordering of
24.427 + /// the items; this order has nothing to do with the iteration
24.428 + /// ordering of the items.
24.429 + bool operator<(UEdge) const { return false; }
24.430 + };
24.431 +
24.432 + /// This iterator goes through each undirected edge.
24.433 +
24.434 + /// This iterator goes through each undirected edge of a graph.
24.435 + /// Its usage is quite simple, for example you can count the number
24.436 + /// of undirected edges in a graph \c g of type \c Graph as follows:
24.437 + ///\code
24.438 + /// int count=0;
24.439 + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
24.440 + ///\endcode
24.441 + class UEdgeIt : public UEdge {
24.442 + public:
24.443 + /// Default constructor
24.444 +
24.445 + /// @warning The default constructor sets the iterator
24.446 + /// to an undefined value.
24.447 + UEdgeIt() { }
24.448 + /// Copy constructor.
24.449 +
24.450 + /// Copy constructor.
24.451 + ///
24.452 + UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
24.453 + /// Initialize the iterator to be invalid.
24.454 +
24.455 + /// Initialize the iterator to be invalid.
24.456 + ///
24.457 + UEdgeIt(Invalid) { }
24.458 + /// This constructor sets the iterator to the first undirected edge.
24.459 +
24.460 + /// This constructor sets the iterator to the first undirected edge.
24.461 + UEdgeIt(const BpUGraph&) { }
24.462 + /// UEdge -> UEdgeIt conversion
24.463 +
24.464 + /// Sets the iterator to the value of the trivial iterator.
24.465 + /// This feature necessitates that each time we
24.466 + /// iterate the undirected edge-set, the iteration order is the
24.467 + /// same.
24.468 + UEdgeIt(const BpUGraph&, const UEdge&) { }
24.469 + /// Next undirected edge
24.470 +
24.471 + /// Assign the iterator to the next undirected edge.
24.472 + UEdgeIt& operator++() { return *this; }
24.473 + };
24.474 +
24.475 + /// \brief This iterator goes trough the incident undirected
24.476 + /// edges of a node.
24.477 + ///
24.478 + /// This iterator goes trough the incident undirected edges
24.479 + /// of a certain node
24.480 + /// of a graph.
24.481 + /// Its usage is quite simple, for example you can compute the
24.482 + /// degree (i.e. count the number
24.483 + /// of incident edges of a node \c n
24.484 + /// in graph \c g of type \c Graph as follows.
24.485 + ///\code
24.486 + /// int count=0;
24.487 + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
24.488 + ///\endcode
24.489 + class IncEdgeIt : public UEdge {
24.490 + public:
24.491 + /// Default constructor
24.492 +
24.493 + /// @warning The default constructor sets the iterator
24.494 + /// to an undefined value.
24.495 + IncEdgeIt() { }
24.496 + /// Copy constructor.
24.497 +
24.498 + /// Copy constructor.
24.499 + ///
24.500 + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
24.501 + /// Initialize the iterator to be invalid.
24.502 +
24.503 + /// Initialize the iterator to be invalid.
24.504 + ///
24.505 + IncEdgeIt(Invalid) { }
24.506 + /// This constructor sets the iterator to first incident edge.
24.507 +
24.508 + /// This constructor set the iterator to the first incident edge of
24.509 + /// the node.
24.510 + IncEdgeIt(const BpUGraph&, const Node&) { }
24.511 + /// UEdge -> IncEdgeIt conversion
24.512 +
24.513 + /// Sets the iterator to the value of the trivial iterator \c e.
24.514 + /// This feature necessitates that each time we
24.515 + /// iterate the edge-set, the iteration order is the same.
24.516 + IncEdgeIt(const BpUGraph&, const UEdge&) { }
24.517 + /// Next incident edge
24.518 +
24.519 + /// Assign the iterator to the next incident edge
24.520 + /// of the corresponding node.
24.521 + IncEdgeIt& operator++() { return *this; }
24.522 + };
24.523 +
24.524 + /// The directed edge type.
24.525 +
24.526 + /// The directed edge type. It can be converted to the
24.527 + /// undirected edge.
24.528 + class Edge : public UEdge {
24.529 + public:
24.530 + /// Default constructor
24.531 +
24.532 + /// @warning The default constructor sets the iterator
24.533 + /// to an undefined value.
24.534 + Edge() { }
24.535 + /// Copy constructor.
24.536 +
24.537 + /// Copy constructor.
24.538 + ///
24.539 + Edge(const Edge& e) : UEdge(e) { }
24.540 + /// Initialize the iterator to be invalid.
24.541 +
24.542 + /// Initialize the iterator to be invalid.
24.543 + ///
24.544 + Edge(Invalid) { }
24.545 + /// Equality operator
24.546 +
24.547 + /// Two iterators are equal if and only if they point to the
24.548 + /// same object or both are invalid.
24.549 + bool operator==(Edge) const { return true; }
24.550 + /// Inequality operator
24.551 +
24.552 + /// \sa operator==(Edge n)
24.553 + ///
24.554 + bool operator!=(Edge) const { return true; }
24.555 +
24.556 + /// Artificial ordering operator.
24.557 +
24.558 + /// To allow the use of graph descriptors as key type in std::map or
24.559 + /// similar associative container we require this.
24.560 + ///
24.561 + /// \note This operator only have to define some strict ordering of
24.562 + /// the items; this order has nothing to do with the iteration
24.563 + /// ordering of the items.
24.564 + bool operator<(Edge) const { return false; }
24.565 +
24.566 + };
24.567 + /// This iterator goes through each directed edge.
24.568 +
24.569 + /// This iterator goes through each edge of a graph.
24.570 + /// Its usage is quite simple, for example you can count the number
24.571 + /// of edges in a graph \c g of type \c Graph as follows:
24.572 + ///\code
24.573 + /// int count=0;
24.574 + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
24.575 + ///\endcode
24.576 + class EdgeIt : public Edge {
24.577 + public:
24.578 + /// Default constructor
24.579 +
24.580 + /// @warning The default constructor sets the iterator
24.581 + /// to an undefined value.
24.582 + EdgeIt() { }
24.583 + /// Copy constructor.
24.584 +
24.585 + /// Copy constructor.
24.586 + ///
24.587 + EdgeIt(const EdgeIt& e) : Edge(e) { }
24.588 + /// Initialize the iterator to be invalid.
24.589 +
24.590 + /// Initialize the iterator to be invalid.
24.591 + ///
24.592 + EdgeIt(Invalid) { }
24.593 + /// This constructor sets the iterator to the first edge.
24.594 +
24.595 + /// This constructor sets the iterator to the first edge of \c g.
24.596 + ///@param g the graph
24.597 + EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
24.598 + /// Edge -> EdgeIt conversion
24.599 +
24.600 + /// Sets the iterator to the value of the trivial iterator \c e.
24.601 + /// This feature necessitates that each time we
24.602 + /// iterate the edge-set, the iteration order is the same.
24.603 + EdgeIt(const BpUGraph&, const Edge&) { }
24.604 + ///Next edge
24.605 +
24.606 + /// Assign the iterator to the next edge.
24.607 + EdgeIt& operator++() { return *this; }
24.608 + };
24.609 +
24.610 + /// This iterator goes trough the outgoing directed edges of a node.
24.611 +
24.612 + /// This iterator goes trough the \e outgoing edges of a certain node
24.613 + /// of a graph.
24.614 + /// Its usage is quite simple, for example you can count the number
24.615 + /// of outgoing edges of a node \c n
24.616 + /// in graph \c g of type \c Graph as follows.
24.617 + ///\code
24.618 + /// int count=0;
24.619 + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
24.620 + ///\endcode
24.621 +
24.622 + class OutEdgeIt : public Edge {
24.623 + public:
24.624 + /// Default constructor
24.625 +
24.626 + /// @warning The default constructor sets the iterator
24.627 + /// to an undefined value.
24.628 + OutEdgeIt() { }
24.629 + /// Copy constructor.
24.630 +
24.631 + /// Copy constructor.
24.632 + ///
24.633 + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
24.634 + /// Initialize the iterator to be invalid.
24.635 +
24.636 + /// Initialize the iterator to be invalid.
24.637 + ///
24.638 + OutEdgeIt(Invalid) { }
24.639 + /// This constructor sets the iterator to the first outgoing edge.
24.640 +
24.641 + /// This constructor sets the iterator to the first outgoing edge of
24.642 + /// the node.
24.643 + ///@param n the node
24.644 + ///@param g the graph
24.645 + OutEdgeIt(const BpUGraph& n, const Node& g) {
24.646 + ignore_unused_variable_warning(n);
24.647 + ignore_unused_variable_warning(g);
24.648 + }
24.649 + /// Edge -> OutEdgeIt conversion
24.650 +
24.651 + /// Sets the iterator to the value of the trivial iterator.
24.652 + /// This feature necessitates that each time we
24.653 + /// iterate the edge-set, the iteration order is the same.
24.654 + OutEdgeIt(const BpUGraph&, const Edge&) { }
24.655 + ///Next outgoing edge
24.656 +
24.657 + /// Assign the iterator to the next
24.658 + /// outgoing edge of the corresponding node.
24.659 + OutEdgeIt& operator++() { return *this; }
24.660 + };
24.661 +
24.662 + /// This iterator goes trough the incoming directed edges of a node.
24.663 +
24.664 + /// This iterator goes trough the \e incoming edges of a certain node
24.665 + /// of a graph.
24.666 + /// Its usage is quite simple, for example you can count the number
24.667 + /// of outgoing edges of a node \c n
24.668 + /// in graph \c g of type \c Graph as follows.
24.669 + ///\code
24.670 + /// int count=0;
24.671 + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
24.672 + ///\endcode
24.673 +
24.674 + class InEdgeIt : public Edge {
24.675 + public:
24.676 + /// Default constructor
24.677 +
24.678 + /// @warning The default constructor sets the iterator
24.679 + /// to an undefined value.
24.680 + InEdgeIt() { }
24.681 + /// Copy constructor.
24.682 +
24.683 + /// Copy constructor.
24.684 + ///
24.685 + InEdgeIt(const InEdgeIt& e) : Edge(e) { }
24.686 + /// Initialize the iterator to be invalid.
24.687 +
24.688 + /// Initialize the iterator to be invalid.
24.689 + ///
24.690 + InEdgeIt(Invalid) { }
24.691 + /// This constructor sets the iterator to first incoming edge.
24.692 +
24.693 + /// This constructor set the iterator to the first incoming edge of
24.694 + /// the node.
24.695 + ///@param n the node
24.696 + ///@param g the graph
24.697 + InEdgeIt(const BpUGraph& g, const Node& n) {
24.698 + ignore_unused_variable_warning(n);
24.699 + ignore_unused_variable_warning(g);
24.700 + }
24.701 + /// Edge -> InEdgeIt conversion
24.702 +
24.703 + /// Sets the iterator to the value of the trivial iterator \c e.
24.704 + /// This feature necessitates that each time we
24.705 + /// iterate the edge-set, the iteration order is the same.
24.706 + InEdgeIt(const BpUGraph&, const Edge&) { }
24.707 + /// Next incoming edge
24.708 +
24.709 + /// Assign the iterator to the next inedge of the corresponding node.
24.710 + ///
24.711 + InEdgeIt& operator++() { return *this; }
24.712 + };
24.713 +
24.714 + /// \brief Read write map of the nodes to type \c T.
24.715 + ///
24.716 + /// ReadWrite map of the nodes to type \c T.
24.717 + /// \sa Reference
24.718 + /// \warning Making maps that can handle bool type (NodeMap<bool>)
24.719 + /// needs some extra attention!
24.720 + /// \todo Wrong documentation
24.721 + template<class T>
24.722 + class NodeMap : public ReadWriteMap< Node, T >
24.723 + {
24.724 + public:
24.725 +
24.726 + ///\e
24.727 + NodeMap(const BpUGraph&) { }
24.728 + ///\e
24.729 + NodeMap(const BpUGraph&, T) { }
24.730 +
24.731 + ///Copy constructor
24.732 + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
24.733 + ///Assignment operator
24.734 + NodeMap& operator=(const NodeMap&) { return *this; }
24.735 + ///Assignment operator
24.736 + template <typename CMap>
24.737 + NodeMap& operator=(const CMap&) {
24.738 + checkConcept<ReadMap<Node, T>, CMap>();
24.739 + return *this;
24.740 + }
24.741 + };
24.742 +
24.743 + /// \brief Read write map of the ANodes to type \c T.
24.744 + ///
24.745 + /// ReadWrite map of the ANodes to type \c T.
24.746 + /// \sa Reference
24.747 + /// \warning Making maps that can handle bool type (NodeMap<bool>)
24.748 + /// needs some extra attention!
24.749 + /// \todo Wrong documentation
24.750 + template<class T>
24.751 + class ANodeMap : public ReadWriteMap< Node, T >
24.752 + {
24.753 + public:
24.754 +
24.755 + ///\e
24.756 + ANodeMap(const BpUGraph&) { }
24.757 + ///\e
24.758 + ANodeMap(const BpUGraph&, T) { }
24.759 +
24.760 + ///Copy constructor
24.761 + ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
24.762 + ///Assignment operator
24.763 + ANodeMap& operator=(const ANodeMap&) { return *this; }
24.764 + ///Assignment operator
24.765 + template <typename CMap>
24.766 + ANodeMap& operator=(const CMap&) {
24.767 + checkConcept<ReadMap<Node, T>, CMap>();
24.768 + return *this;
24.769 + }
24.770 + };
24.771 +
24.772 + /// \brief Read write map of the BNodes to type \c T.
24.773 + ///
24.774 + /// ReadWrite map of the BNodes to type \c T.
24.775 + /// \sa Reference
24.776 + /// \warning Making maps that can handle bool type (NodeMap<bool>)
24.777 + /// needs some extra attention!
24.778 + /// \todo Wrong documentation
24.779 + template<class T>
24.780 + class BNodeMap : public ReadWriteMap< Node, T >
24.781 + {
24.782 + public:
24.783 +
24.784 + ///\e
24.785 + BNodeMap(const BpUGraph&) { }
24.786 + ///\e
24.787 + BNodeMap(const BpUGraph&, T) { }
24.788 +
24.789 + ///Copy constructor
24.790 + BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
24.791 + ///Assignment operator
24.792 + BNodeMap& operator=(const BNodeMap&) { return *this; }
24.793 + ///Assignment operator
24.794 + template <typename CMap>
24.795 + BNodeMap& operator=(const CMap&) {
24.796 + checkConcept<ReadMap<Node, T>, CMap>();
24.797 + return *this;
24.798 + }
24.799 + };
24.800 +
24.801 + /// \brief Read write map of the directed edges to type \c T.
24.802 + ///
24.803 + /// Reference map of the directed edges to type \c T.
24.804 + /// \sa Reference
24.805 + /// \warning Making maps that can handle bool type (EdgeMap<bool>)
24.806 + /// needs some extra attention!
24.807 + /// \todo Wrong documentation
24.808 + template<class T>
24.809 + class EdgeMap : public ReadWriteMap<Edge,T>
24.810 + {
24.811 + public:
24.812 +
24.813 + ///\e
24.814 + EdgeMap(const BpUGraph&) { }
24.815 + ///\e
24.816 + EdgeMap(const BpUGraph&, T) { }
24.817 + ///Copy constructor
24.818 + EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
24.819 + ///Assignment operator
24.820 + EdgeMap& operator=(const EdgeMap&) { return *this; }
24.821 + ///Assignment operator
24.822 + template <typename CMap>
24.823 + EdgeMap& operator=(const CMap&) {
24.824 + checkConcept<ReadMap<Edge, T>, CMap>();
24.825 + return *this;
24.826 + }
24.827 + };
24.828 +
24.829 + /// Read write map of the undirected edges to type \c T.
24.830 +
24.831 + /// Reference map of the edges to type \c T.
24.832 + /// \sa Reference
24.833 + /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
24.834 + /// needs some extra attention!
24.835 + /// \todo Wrong documentation
24.836 + template<class T>
24.837 + class UEdgeMap : public ReadWriteMap<UEdge,T>
24.838 + {
24.839 + public:
24.840 +
24.841 + ///\e
24.842 + UEdgeMap(const BpUGraph&) { }
24.843 + ///\e
24.844 + UEdgeMap(const BpUGraph&, T) { }
24.845 + ///Copy constructor
24.846 + UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
24.847 + ///Assignment operator
24.848 + UEdgeMap &operator=(const UEdgeMap&) { return *this; }
24.849 + ///Assignment operator
24.850 + template <typename CMap>
24.851 + UEdgeMap& operator=(const CMap&) {
24.852 + checkConcept<ReadMap<UEdge, T>, CMap>();
24.853 + return *this;
24.854 + }
24.855 + };
24.856 +
24.857 + /// \brief Direct the given undirected edge.
24.858 + ///
24.859 + /// Direct the given undirected edge. The returned edge source
24.860 + /// will be the given node.
24.861 + Edge direct(const UEdge&, const Node&) const {
24.862 + return INVALID;
24.863 + }
24.864 +
24.865 + /// \brief Direct the given undirected edge.
24.866 + ///
24.867 + /// Direct the given undirected edge. The returned edge
24.868 + /// represents the given undireted edge and the direction comes
24.869 + /// from the given bool. The source of the undirected edge and
24.870 + /// the directed edge is the same when the given bool is true.
24.871 + Edge direct(const UEdge&, bool) const {
24.872 + return INVALID;
24.873 + }
24.874 +
24.875 + /// \brief Returns true when the given node is an ANode.
24.876 + ///
24.877 + /// Returns true when the given node is an ANode.
24.878 + bool aNode(Node) const { return true;}
24.879 +
24.880 + /// \brief Returns true when the given node is an BNode.
24.881 + ///
24.882 + /// Returns true when the given node is an BNode.
24.883 + bool bNode(Node) const { return true;}
24.884 +
24.885 + /// \brief Returns the edge's end node which is in the ANode set.
24.886 + ///
24.887 + /// Returns the edge's end node which is in the ANode set.
24.888 + Node aNode(UEdge) const { return INVALID;}
24.889 +
24.890 + /// \brief Returns the edge's end node which is in the BNode set.
24.891 + ///
24.892 + /// Returns the edge's end node which is in the BNode set.
24.893 + Node bNode(UEdge) const { return INVALID;}
24.894 +
24.895 + /// \brief Returns true if the edge has default orientation.
24.896 + ///
24.897 + /// Returns whether the given directed edge is same orientation as
24.898 + /// the corresponding undirected edge's default orientation.
24.899 + bool direction(Edge) const { return true; }
24.900 +
24.901 + /// \brief Returns the opposite directed edge.
24.902 + ///
24.903 + /// Returns the opposite directed edge.
24.904 + Edge oppositeEdge(Edge) const { return INVALID; }
24.905 +
24.906 + /// \brief Opposite node on an edge
24.907 + ///
24.908 + /// \return the opposite of the given Node on the given UEdge
24.909 + Node oppositeNode(Node, UEdge) const { return INVALID; }
24.910 +
24.911 + /// \brief First node of the undirected edge.
24.912 + ///
24.913 + /// \return the first node of the given UEdge.
24.914 + ///
24.915 + /// Naturally undirected edges don't have direction and thus
24.916 + /// don't have source and target node. But we use these two methods
24.917 + /// to query the two endnodes of the edge. The direction of the edge
24.918 + /// which arises this way is called the inherent direction of the
24.919 + /// undirected edge, and is used to define the "default" direction
24.920 + /// of the directed versions of the edges.
24.921 + /// \sa direction
24.922 + Node source(UEdge) const { return INVALID; }
24.923 +
24.924 + /// \brief Second node of the undirected edge.
24.925 + Node target(UEdge) const { return INVALID; }
24.926 +
24.927 + /// \brief Source node of the directed edge.
24.928 + Node source(Edge) const { return INVALID; }
24.929 +
24.930 + /// \brief Target node of the directed edge.
24.931 + Node target(Edge) const { return INVALID; }
24.932 +
24.933 + /// \brief Base node of the iterator
24.934 + ///
24.935 + /// Returns the base node (the source in this case) of the iterator
24.936 + Node baseNode(OutEdgeIt e) const {
24.937 + return source(e);
24.938 + }
24.939 +
24.940 + /// \brief Running node of the iterator
24.941 + ///
24.942 + /// Returns the running node (the target in this case) of the
24.943 + /// iterator
24.944 + Node runningNode(OutEdgeIt e) const {
24.945 + return target(e);
24.946 + }
24.947 +
24.948 + /// \brief Base node of the iterator
24.949 + ///
24.950 + /// Returns the base node (the target in this case) of the iterator
24.951 + Node baseNode(InEdgeIt e) const {
24.952 + return target(e);
24.953 + }
24.954 + /// \brief Running node of the iterator
24.955 + ///
24.956 + /// Returns the running node (the source in this case) of the
24.957 + /// iterator
24.958 + Node runningNode(InEdgeIt e) const {
24.959 + return source(e);
24.960 + }
24.961 +
24.962 + /// \brief Base node of the iterator
24.963 + ///
24.964 + /// Returns the base node of the iterator
24.965 + Node baseNode(IncEdgeIt) const {
24.966 + return INVALID;
24.967 + }
24.968 +
24.969 + /// \brief Running node of the iterator
24.970 + ///
24.971 + /// Returns the running node of the iterator
24.972 + Node runningNode(IncEdgeIt) const {
24.973 + return INVALID;
24.974 + }
24.975 +
24.976 + void first(Node&) const {}
24.977 + void next(Node&) const {}
24.978 +
24.979 + void first(Edge&) const {}
24.980 + void next(Edge&) const {}
24.981 +
24.982 + void first(UEdge&) const {}
24.983 + void next(UEdge&) const {}
24.984 +
24.985 + void firstANode(Node&) const {}
24.986 + void nextANode(Node&) const {}
24.987 +
24.988 + void firstBNode(Node&) const {}
24.989 + void nextBNode(Node&) const {}
24.990 +
24.991 + void firstIn(Edge&, const Node&) const {}
24.992 + void nextIn(Edge&) const {}
24.993 +
24.994 + void firstOut(Edge&, const Node&) const {}
24.995 + void nextOut(Edge&) const {}
24.996 +
24.997 + void firstInc(UEdge &, bool &, const Node &) const {}
24.998 + void nextInc(UEdge &, bool &) const {}
24.999 +
24.1000 + void firstFromANode(UEdge&, const Node&) const {}
24.1001 + void nextFromANode(UEdge&) const {}
24.1002 +
24.1003 + void firstFromBNode(UEdge&, const Node&) const {}
24.1004 + void nextFromBNode(UEdge&) const {}
24.1005 +
24.1006 + template <typename Graph>
24.1007 + struct Constraints {
24.1008 + void constraints() {
24.1009 + checkConcept<IterableBpUGraphComponent<>, Graph>();
24.1010 + checkConcept<MappableBpUGraphComponent<>, Graph>();
24.1011 + }
24.1012 + };
24.1013 +
24.1014 + };
24.1015 +
24.1016 +
24.1017 + /// @}
24.1018 +
24.1019 + }
24.1020 +
24.1021 +}
24.1022 +
24.1023 +#endif
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/lemon/concepts/graph.h Tue Oct 24 17:19:16 2006 +0000
25.3 @@ -0,0 +1,455 @@
25.4 +/* -*- C++ -*-
25.5 + *
25.6 + * This file is a part of LEMON, a generic C++ optimization library
25.7 + *
25.8 + * Copyright (C) 2003-2006
25.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
25.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
25.11 + *
25.12 + * Permission to use, modify and distribute this software is granted
25.13 + * provided that this copyright notice appears in all copies. For
25.14 + * precise terms see the accompanying LICENSE file.
25.15 + *
25.16 + * This software is provided "AS IS" with no warranty of any kind,
25.17 + * express or implied, and with no claim as to its suitability for any
25.18 + * purpose.
25.19 + *
25.20 + */
25.21 +
25.22 +#ifndef LEMON_CONCEPT_GRAPH_H
25.23 +#define LEMON_CONCEPT_GRAPH_H
25.24 +
25.25 +///\ingroup graph_concepts
25.26 +///\file
25.27 +///\brief Declaration of Graph.
25.28 +
25.29 +#include <lemon/bits/invalid.h>
25.30 +#include <lemon/bits/utility.h>
25.31 +#include <lemon/concepts/maps.h>
25.32 +#include <lemon/concept_check.h>
25.33 +#include <lemon/concepts/graph_components.h>
25.34 +
25.35 +namespace lemon {
25.36 + namespace concepts {
25.37 +
25.38 + /// \addtogroup graph_concepts
25.39 + /// @{
25.40 +
25.41 + /// The directed graph concept
25.42 +
25.43 + /// This class describes the \ref concept "concept" of the
25.44 + /// immutable directed graphs.
25.45 + ///
25.46 + /// Note that actual graph implementation like @ref ListGraph or
25.47 + /// @ref SmartGraph may have several additional functionality.
25.48 + ///
25.49 + /// \sa concept
25.50 + class Graph {
25.51 + private:
25.52 + ///Graphs are \e not copy constructible. Use GraphCopy() instead.
25.53 +
25.54 + ///Graphs are \e not copy constructible. Use GraphCopy() instead.
25.55 + ///
25.56 + Graph(const Graph &) {};
25.57 + ///\brief Assignment of \ref Graph "Graph"s to another ones are
25.58 + ///\e not allowed. Use GraphCopy() instead.
25.59 +
25.60 + ///Assignment of \ref Graph "Graph"s to another ones are
25.61 + ///\e not allowed. Use GraphCopy() instead.
25.62 +
25.63 + void operator=(const Graph &) {}
25.64 + public:
25.65 + ///\e
25.66 +
25.67 + /// Defalult constructor.
25.68 +
25.69 + /// Defalult constructor.
25.70 + ///
25.71 + Graph() { }
25.72 + /// Class for identifying a node of the graph
25.73 +
25.74 + /// This class identifies a node of the graph. It also serves
25.75 + /// as a base class of the node iterators,
25.76 + /// thus they will convert to this type.
25.77 + class Node {
25.78 + public:
25.79 + /// Default constructor
25.80 +
25.81 + /// @warning The default constructor sets the iterator
25.82 + /// to an undefined value.
25.83 + Node() { }
25.84 + /// Copy constructor.
25.85 +
25.86 + /// Copy constructor.
25.87 + ///
25.88 + Node(const Node&) { }
25.89 +
25.90 + /// Invalid constructor \& conversion.
25.91 +
25.92 + /// This constructor initializes the iterator to be invalid.
25.93 + /// \sa Invalid for more details.
25.94 + Node(Invalid) { }
25.95 + /// Equality operator
25.96 +
25.97 + /// Two iterators are equal if and only if they point to the
25.98 + /// same object or both are invalid.
25.99 + bool operator==(Node) const { return true; }
25.100 +
25.101 + /// Inequality operator
25.102 +
25.103 + /// \sa operator==(Node n)
25.104 + ///
25.105 + bool operator!=(Node) const { return true; }
25.106 +
25.107 + /// Artificial ordering operator.
25.108 +
25.109 + /// To allow the use of graph descriptors as key type in std::map or
25.110 + /// similar associative container we require this.
25.111 + ///
25.112 + /// \note This operator only have to define some strict ordering of
25.113 + /// the items; this order has nothing to do with the iteration
25.114 + /// ordering of the items.
25.115 + bool operator<(Node) const { return false; }
25.116 +
25.117 + };
25.118 +
25.119 + /// This iterator goes through each node.
25.120 +
25.121 + /// This iterator goes through each node.
25.122 + /// Its usage is quite simple, for example you can count the number
25.123 + /// of nodes in graph \c g of type \c Graph like this:
25.124 + ///\code
25.125 + /// int count=0;
25.126 + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
25.127 + ///\endcode
25.128 + class NodeIt : public Node {
25.129 + public:
25.130 + /// Default constructor
25.131 +
25.132 + /// @warning The default constructor sets the iterator
25.133 + /// to an undefined value.
25.134 + NodeIt() { }
25.135 + /// Copy constructor.
25.136 +
25.137 + /// Copy constructor.
25.138 + ///
25.139 + NodeIt(const NodeIt& n) : Node(n) { }
25.140 + /// Invalid constructor \& conversion.
25.141 +
25.142 + /// Initialize the iterator to be invalid.
25.143 + /// \sa Invalid for more details.
25.144 + NodeIt(Invalid) { }
25.145 + /// Sets the iterator to the first node.
25.146 +
25.147 + /// Sets the iterator to the first node of \c g.
25.148 + ///
25.149 + NodeIt(const Graph&) { }
25.150 + /// Node -> NodeIt conversion.
25.151 +
25.152 + /// Sets the iterator to the node of \c the graph pointed by
25.153 + /// the trivial iterator.
25.154 + /// This feature necessitates that each time we
25.155 + /// iterate the edge-set, the iteration order is the same.
25.156 + NodeIt(const Graph&, const Node&) { }
25.157 + /// Next node.
25.158 +
25.159 + /// Assign the iterator to the next node.
25.160 + ///
25.161 + NodeIt& operator++() { return *this; }
25.162 + };
25.163 +
25.164 +
25.165 + /// Class for identifying an edge of the graph
25.166 +
25.167 + /// This class identifies an edge of the graph. It also serves
25.168 + /// as a base class of the edge iterators,
25.169 + /// thus they will convert to this type.
25.170 + class Edge {
25.171 + public:
25.172 + /// Default constructor
25.173 +
25.174 + /// @warning The default constructor sets the iterator
25.175 + /// to an undefined value.
25.176 + Edge() { }
25.177 + /// Copy constructor.
25.178 +
25.179 + /// Copy constructor.
25.180 + ///
25.181 + Edge(const Edge&) { }
25.182 + /// Initialize the iterator to be invalid.
25.183 +
25.184 + /// Initialize the iterator to be invalid.
25.185 + ///
25.186 + Edge(Invalid) { }
25.187 + /// Equality operator
25.188 +
25.189 + /// Two iterators are equal if and only if they point to the
25.190 + /// same object or both are invalid.
25.191 + bool operator==(Edge) const { return true; }
25.192 + /// Inequality operator
25.193 +
25.194 + /// \sa operator==(Edge n)
25.195 + ///
25.196 + bool operator!=(Edge) const { return true; }
25.197 +
25.198 + /// Artificial ordering operator.
25.199 +
25.200 + /// To allow the use of graph descriptors as key type in std::map or
25.201 + /// similar associative container we require this.
25.202 + ///
25.203 + /// \note This operator only have to define some strict ordering of
25.204 + /// the items; this order has nothing to do with the iteration
25.205 + /// ordering of the items.
25.206 + bool operator<(Edge) const { return false; }
25.207 + };
25.208 +
25.209 + /// This iterator goes trough the outgoing edges of a node.
25.210 +
25.211 + /// This iterator goes trough the \e outgoing edges of a certain node
25.212 + /// of a graph.
25.213 + /// Its usage is quite simple, for example you can count the number
25.214 + /// of outgoing edges of a node \c n
25.215 + /// in graph \c g of type \c Graph as follows.
25.216 + ///\code
25.217 + /// int count=0;
25.218 + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
25.219 + ///\endcode
25.220 +
25.221 + class OutEdgeIt : public Edge {
25.222 + public:
25.223 + /// Default constructor
25.224 +
25.225 + /// @warning The default constructor sets the iterator
25.226 + /// to an undefined value.
25.227 + OutEdgeIt() { }
25.228 + /// Copy constructor.
25.229 +
25.230 + /// Copy constructor.
25.231 + ///
25.232 + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
25.233 + /// Initialize the iterator to be invalid.
25.234 +
25.235 + /// Initialize the iterator to be invalid.
25.236 + ///
25.237 + OutEdgeIt(Invalid) { }
25.238 + /// This constructor sets the iterator to the first outgoing edge.
25.239 +
25.240 + /// This constructor sets the iterator to the first outgoing edge of
25.241 + /// the node.
25.242 + OutEdgeIt(const Graph&, const Node&) { }
25.243 + /// Edge -> OutEdgeIt conversion
25.244 +
25.245 + /// Sets the iterator to the value of the trivial iterator.
25.246 + /// This feature necessitates that each time we
25.247 + /// iterate the edge-set, the iteration order is the same.
25.248 + OutEdgeIt(const Graph&, const Edge&) { }
25.249 + ///Next outgoing edge
25.250 +
25.251 + /// Assign the iterator to the next
25.252 + /// outgoing edge of the corresponding node.
25.253 + OutEdgeIt& operator++() { return *this; }
25.254 + };
25.255 +
25.256 + /// This iterator goes trough the incoming edges of a node.
25.257 +
25.258 + /// This iterator goes trough the \e incoming edges of a certain node
25.259 + /// of a graph.
25.260 + /// Its usage is quite simple, for example you can count the number
25.261 + /// of outgoing edges of a node \c n
25.262 + /// in graph \c g of type \c Graph as follows.
25.263 + ///\code
25.264 + /// int count=0;
25.265 + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
25.266 + ///\endcode
25.267 +
25.268 + class InEdgeIt : public Edge {
25.269 + public:
25.270 + /// Default constructor
25.271 +
25.272 + /// @warning The default constructor sets the iterator
25.273 + /// to an undefined value.
25.274 + InEdgeIt() { }
25.275 + /// Copy constructor.
25.276 +
25.277 + /// Copy constructor.
25.278 + ///
25.279 + InEdgeIt(const InEdgeIt& e) : Edge(e) { }
25.280 + /// Initialize the iterator to be invalid.
25.281 +
25.282 + /// Initialize the iterator to be invalid.
25.283 + ///
25.284 + InEdgeIt(Invalid) { }
25.285 + /// This constructor sets the iterator to first incoming edge.
25.286 +
25.287 + /// This constructor set the iterator to the first incoming edge of
25.288 + /// the node.
25.289 + InEdgeIt(const Graph&, const Node&) { }
25.290 + /// Edge -> InEdgeIt conversion
25.291 +
25.292 + /// Sets the iterator to the value of the trivial iterator \c e.
25.293 + /// This feature necessitates that each time we
25.294 + /// iterate the edge-set, the iteration order is the same.
25.295 + InEdgeIt(const Graph&, const Edge&) { }
25.296 + /// Next incoming edge
25.297 +
25.298 + /// Assign the iterator to the next inedge of the corresponding node.
25.299 + ///
25.300 + InEdgeIt& operator++() { return *this; }
25.301 + };
25.302 + /// This iterator goes through each edge.
25.303 +
25.304 + /// This iterator goes through each edge of a graph.
25.305 + /// Its usage is quite simple, for example you can count the number
25.306 + /// of edges in a graph \c g of type \c Graph as follows:
25.307 + ///\code
25.308 + /// int count=0;
25.309 + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
25.310 + ///\endcode
25.311 + class EdgeIt : public Edge {
25.312 + public:
25.313 + /// Default constructor
25.314 +
25.315 + /// @warning The default constructor sets the iterator
25.316 + /// to an undefined value.
25.317 + EdgeIt() { }
25.318 + /// Copy constructor.
25.319 +
25.320 + /// Copy constructor.
25.321 + ///
25.322 + EdgeIt(const EdgeIt& e) : Edge(e) { }
25.323 + /// Initialize the iterator to be invalid.
25.324 +
25.325 + /// Initialize the iterator to be invalid.
25.326 + ///
25.327 + EdgeIt(Invalid) { }
25.328 + /// This constructor sets the iterator to the first edge.
25.329 +
25.330 + /// This constructor sets the iterator to the first edge of \c g.
25.331 + ///@param g the graph
25.332 + EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); }
25.333 + /// Edge -> EdgeIt conversion
25.334 +
25.335 + /// Sets the iterator to the value of the trivial iterator \c e.
25.336 + /// This feature necessitates that each time we
25.337 + /// iterate the edge-set, the iteration order is the same.
25.338 + EdgeIt(const Graph&, const Edge&) { }
25.339 + ///Next edge
25.340 +
25.341 + /// Assign the iterator to the next edge.
25.342 + EdgeIt& operator++() { return *this; }
25.343 + };
25.344 + ///Gives back the target node of an edge.
25.345 +
25.346 + ///Gives back the target node of an edge.
25.347 + ///
25.348 + Node target(Edge) const { return INVALID; }
25.349 + ///Gives back the source node of an edge.
25.350 +
25.351 + ///Gives back the source node of an edge.
25.352 + ///
25.353 + Node source(Edge) const { return INVALID; }
25.354 +
25.355 + void first(Node&) const {}
25.356 + void next(Node&) const {}
25.357 +
25.358 + void first(Edge&) const {}
25.359 + void next(Edge&) const {}
25.360 +
25.361 +
25.362 + void firstIn(Edge&, const Node&) const {}
25.363 + void nextIn(Edge&) const {}
25.364 +
25.365 + void firstOut(Edge&, const Node&) const {}
25.366 + void nextOut(Edge&) const {}
25.367 +
25.368 + /// \brief The base node of the iterator.
25.369 + ///
25.370 + /// Gives back the base node of the iterator.
25.371 + /// It is always the target of the pointed edge.
25.372 + Node baseNode(const InEdgeIt&) const { return INVALID; }
25.373 +
25.374 + /// \brief The running node of the iterator.
25.375 + ///
25.376 + /// Gives back the running node of the iterator.
25.377 + /// It is always the source of the pointed edge.
25.378 + Node runningNode(const InEdgeIt&) const { return INVALID; }
25.379 +
25.380 + /// \brief The base node of the iterator.
25.381 + ///
25.382 + /// Gives back the base node of the iterator.
25.383 + /// It is always the source of the pointed edge.
25.384 + Node baseNode(const OutEdgeIt&) const { return INVALID; }
25.385 +
25.386 + /// \brief The running node of the iterator.
25.387 + ///
25.388 + /// Gives back the running node of the iterator.
25.389 + /// It is always the target of the pointed edge.
25.390 + Node runningNode(const OutEdgeIt&) const { return INVALID; }
25.391 +
25.392 + /// \brief The opposite node on the given edge.
25.393 + ///
25.394 + /// Gives back the opposite node on the given edge.
25.395 + Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
25.396 +
25.397 + /// \brief Read write map of the nodes to type \c T.
25.398 + ///
25.399 + /// ReadWrite map of the nodes to type \c T.
25.400 + /// \sa Reference
25.401 + template<class T>
25.402 + class NodeMap : public ReadWriteMap< Node, T > {
25.403 + public:
25.404 +
25.405 + ///\e
25.406 + NodeMap(const Graph&) { }
25.407 + ///\e
25.408 + NodeMap(const Graph&, T) { }
25.409 +
25.410 + ///Copy constructor
25.411 + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
25.412 + ///Assignment operator
25.413 + template <typename CMap>
25.414 + NodeMap& operator=(const CMap&) {
25.415 + checkConcept<ReadMap<Node, T>, CMap>();
25.416 + return *this;
25.417 + }
25.418 + };
25.419 +
25.420 + /// \brief Read write map of the edges to type \c T.
25.421 + ///
25.422 + /// Reference map of the edges to type \c T.
25.423 + /// \sa Reference
25.424 + template<class T>
25.425 + class EdgeMap : public ReadWriteMap<Edge,T> {
25.426 + public:
25.427 +
25.428 + ///\e
25.429 + EdgeMap(const Graph&) { }
25.430 + ///\e
25.431 + EdgeMap(const Graph&, T) { }
25.432 + ///Copy constructor
25.433 + EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
25.434 + ///Assignment operator
25.435 + template <typename CMap>
25.436 + EdgeMap& operator=(const CMap&) {
25.437 + checkConcept<ReadMap<Edge, T>, CMap>();
25.438 + return *this;
25.439 + }
25.440 + };
25.441 +
25.442 + template <typename RGraph>
25.443 + struct Constraints {
25.444 + void constraints() {
25.445 + checkConcept<IterableGraphComponent<>, Graph>();
25.446 + checkConcept<MappableGraphComponent<>, Graph>();
25.447 + }
25.448 + };
25.449 +
25.450 + };
25.451 +
25.452 + // @}
25.453 + } //namespace concepts
25.454 +} //namespace lemon
25.455 +
25.456 +
25.457 +
25.458 +#endif // LEMON_CONCEPT_GRAPH_H
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/lemon/concepts/graph_components.h Tue Oct 24 17:19:16 2006 +0000
26.3 @@ -0,0 +1,2103 @@
26.4 +/* -*- C++ -*-
26.5 + *
26.6 + * This file is a part of LEMON, a generic C++ optimization library
26.7 + *
26.8 + * Copyright (C) 2003-2006
26.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
26.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
26.11 + *
26.12 + * Permission to use, modify and distribute this software is granted
26.13 + * provided that this copyright notice appears in all copies. For
26.14 + * precise terms see the accompanying LICENSE file.
26.15 + *
26.16 + * This software is provided "AS IS" with no warranty of any kind,
26.17 + * express or implied, and with no claim as to its suitability for any
26.18 + * purpose.
26.19 + *
26.20 + */
26.21 +
26.22 +///\ingroup graph_concepts
26.23 +///\file
26.24 +///\brief The concept of the graph components.
26.25 +
26.26 +
26.27 +#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
26.28 +#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
26.29 +
26.30 +#include <lemon/bits/invalid.h>
26.31 +#include <lemon/concepts/maps.h>
26.32 +
26.33 +#include <lemon/bits/alteration_notifier.h>
26.34 +
26.35 +namespace lemon {
26.36 + namespace concepts {
26.37 +
26.38 + /// \brief Skeleton class for graph Node and Edge types
26.39 + ///
26.40 + /// This class describes the interface of Node and Edge (and UEdge
26.41 + /// in undirected graphs) subtypes of graph types.
26.42 + ///
26.43 + /// \note This class is a template class so that we can use it to
26.44 + /// create graph skeleton classes. The reason for this is than Node
26.45 + /// and Edge types should \em not derive from the same base class.
26.46 + /// For Node you should instantiate it with character 'n' and for Edge
26.47 + /// with 'e'.
26.48 +
26.49 +#ifndef DOXYGEN
26.50 + template <char _selector = '0'>
26.51 +#endif
26.52 + class GraphItem {
26.53 + public:
26.54 + /// \brief Default constructor.
26.55 + ///
26.56 + /// \warning The default constructor is not required to set
26.57 + /// the item to some well-defined value. So you should consider it
26.58 + /// as uninitialized.
26.59 + GraphItem() {}
26.60 + /// \brief Copy constructor.
26.61 + ///
26.62 + /// Copy constructor.
26.63 + ///
26.64 + GraphItem(const GraphItem &) {}
26.65 + /// \brief Invalid constructor \& conversion.
26.66 + ///
26.67 + /// This constructor initializes the item to be invalid.
26.68 + /// \sa Invalid for more details.
26.69 + GraphItem(Invalid) {}
26.70 + /// \brief Assign operator for nodes.
26.71 + ///
26.72 + /// The nodes are assignable.
26.73 + ///
26.74 + GraphItem& operator=(GraphItem const&) { return *this; }
26.75 + /// \brief Equality operator.
26.76 + ///
26.77 + /// Two iterators are equal if and only if they represents the
26.78 + /// same node in the graph or both are invalid.
26.79 + bool operator==(GraphItem) const { return false; }
26.80 + /// \brief Inequality operator.
26.81 + ///
26.82 + /// \sa operator==(const Node& n)
26.83 + ///
26.84 + bool operator!=(GraphItem) const { return false; }
26.85 +
26.86 + /// \brief Artificial ordering operator.
26.87 + ///
26.88 + /// To allow the use of graph descriptors as key type in std::map or
26.89 + /// similar associative container we require this.
26.90 + ///
26.91 + /// \note This operator only have to define some strict ordering of
26.92 + /// the items; this order has nothing to do with the iteration
26.93 + /// ordering of the items.
26.94 + bool operator<(GraphItem) const { return false; }
26.95 +
26.96 + template<typename _GraphItem>
26.97 + struct Constraints {
26.98 + void constraints() {
26.99 + _GraphItem i1;
26.100 + _GraphItem i2 = i1;
26.101 + _GraphItem i3 = INVALID;
26.102 +
26.103 + i1 = i2 = i3;
26.104 +
26.105 + bool b;
26.106 + // b = (ia == ib) && (ia != ib) && (ia < ib);
26.107 + b = (ia == ib) && (ia != ib);
26.108 + b = (ia == INVALID) && (ib != INVALID);
26.109 + b = (ia < ib);
26.110 + }
26.111 +
26.112 + const _GraphItem &ia;
26.113 + const _GraphItem &ib;
26.114 + };
26.115 + };
26.116 +
26.117 + /// \brief An empty base graph class.
26.118 + ///
26.119 + /// This class provides the minimal set of features needed for a graph
26.120 + /// structure. All graph concepts have to be conform to this base
26.121 + /// graph. It just provides types for nodes and edges and functions to
26.122 + /// get the source and the target of the edges.
26.123 + class BaseGraphComponent {
26.124 + public:
26.125 +
26.126 + typedef BaseGraphComponent Graph;
26.127 +
26.128 + /// \brief Node class of the graph.
26.129 + ///
26.130 + /// This class represents the Nodes of the graph.
26.131 + ///
26.132 + typedef GraphItem<'n'> Node;
26.133 +
26.134 + /// \brief Edge class of the graph.
26.135 + ///
26.136 + /// This class represents the Edges of the graph.
26.137 + ///
26.138 + typedef GraphItem<'e'> Edge;
26.139 +
26.140 + /// \brief Gives back the target node of an edge.
26.141 + ///
26.142 + /// Gives back the target node of an edge.
26.143 + ///
26.144 + Node target(const Edge&) const { return INVALID;}
26.145 +
26.146 + /// \brief Gives back the source node of an edge.
26.147 + ///
26.148 + /// Gives back the source node of an edge.
26.149 + ///
26.150 + Node source(const Edge&) const { return INVALID;}
26.151 +
26.152 + /// \brief Gives back the opposite node on the given edge.
26.153 + ///
26.154 + /// Gives back the opposite node on the given edge.
26.155 + Node oppositeNode(const Node&, const Edge&) const {
26.156 + return INVALID;
26.157 + }
26.158 +
26.159 + template <typename _Graph>
26.160 + struct Constraints {
26.161 + typedef typename _Graph::Node Node;
26.162 + typedef typename _Graph::Edge Edge;
26.163 +
26.164 + void constraints() {
26.165 + checkConcept<GraphItem<'n'>, Node>();
26.166 + checkConcept<GraphItem<'e'>, Edge>();
26.167 + {
26.168 + Node n;
26.169 + Edge e(INVALID);
26.170 + n = graph.source(e);
26.171 + n = graph.target(e);
26.172 + n = graph.oppositeNode(n, e);
26.173 + }
26.174 + }
26.175 +
26.176 + const _Graph& graph;
26.177 + };
26.178 + };
26.179 +
26.180 + /// \brief An empty base undirected graph class.
26.181 + ///
26.182 + /// This class provides the minimal set of features needed for an
26.183 + /// undirected graph structure. All undirected graph concepts have
26.184 + /// to be conform to this base graph. It just provides types for
26.185 + /// nodes, edges and undirected edges and functions to get the
26.186 + /// source and the target of the edges and undirected edges,
26.187 + /// conversion from edges to undirected edges and function to get
26.188 + /// both direction of the undirected edges.
26.189 + class BaseUGraphComponent : public BaseGraphComponent {
26.190 + public:
26.191 + typedef BaseGraphComponent::Node Node;
26.192 + typedef BaseGraphComponent::Edge Edge;
26.193 + /// \brief Undirected edge class of the graph.
26.194 + ///
26.195 + /// This class represents the undirected edges of the graph.
26.196 + /// The undirected graphs can be used as a directed graph which
26.197 + /// for each edge contains the opposite edge too so the graph is
26.198 + /// bidirected. The undirected edge represents two opposite
26.199 + /// directed edges.
26.200 + class UEdge : public GraphItem<'u'> {
26.201 + public:
26.202 + typedef GraphItem<'u'> Parent;
26.203 + /// \brief Default constructor.
26.204 + ///
26.205 + /// \warning The default constructor is not required to set
26.206 + /// the item to some well-defined value. So you should consider it
26.207 + /// as uninitialized.
26.208 + UEdge() {}
26.209 + /// \brief Copy constructor.
26.210 + ///
26.211 + /// Copy constructor.
26.212 + ///
26.213 + UEdge(const UEdge &) : Parent() {}
26.214 + /// \brief Invalid constructor \& conversion.
26.215 + ///
26.216 + /// This constructor initializes the item to be invalid.
26.217 + /// \sa Invalid for more details.
26.218 + UEdge(Invalid) {}
26.219 + /// \brief Converter from edge to undirected edge.
26.220 + ///
26.221 + /// Besides the core graph item functionality each edge should
26.222 + /// be convertible to the represented undirected edge.
26.223 + UEdge(const Edge&) {}
26.224 + /// \brief Assign edge to undirected edge.
26.225 + ///
26.226 + /// Besides the core graph item functionality each edge should
26.227 + /// be convertible to the represented undirected edge.
26.228 + UEdge& operator=(const Edge&) { return *this; }
26.229 + };
26.230 +
26.231 + /// \brief Returns the direction of the edge.
26.232 + ///
26.233 + /// Returns the direction of the edge. Each edge represents an
26.234 + /// undirected edge with a direction. It gives back the
26.235 + /// direction.
26.236 + bool direction(const Edge&) const { return true; }
26.237 +
26.238 + /// \brief Returns the directed edge.
26.239 + ///
26.240 + /// Returns the directed edge from its direction and the
26.241 + /// represented undirected edge.
26.242 + Edge direct(const UEdge&, bool) const { return INVALID;}
26.243 +
26.244 + /// \brief Returns the directed edge.
26.245 + ///
26.246 + /// Returns the directed edge from its source and the
26.247 + /// represented undirected edge.
26.248 + Edge direct(const UEdge&, const Node&) const { return INVALID;}
26.249 +
26.250 + /// \brief Returns the opposite edge.
26.251 + ///
26.252 + /// Returns the opposite edge. It is the edge representing the
26.253 + /// same undirected edge and has opposite direction.
26.254 + Edge oppositeEdge(const Edge&) const { return INVALID;}
26.255 +
26.256 + /// \brief Gives back the target node of an undirected edge.
26.257 + ///
26.258 + /// Gives back the target node of an undirected edge. The name
26.259 + /// target is a little confusing because the undirected edge
26.260 + /// does not have target but it just means that one of the end
26.261 + /// node.
26.262 + Node target(const UEdge&) const { return INVALID;}
26.263 +
26.264 + /// \brief Gives back the source node of an undirected edge.
26.265 + ///
26.266 + /// Gives back the source node of an undirected edge. The name
26.267 + /// source is a little confusing because the undirected edge
26.268 + /// does not have source but it just means that one of the end
26.269 + /// node.
26.270 + Node source(const UEdge&) const { return INVALID;}
26.271 +
26.272 + template <typename _Graph>
26.273 + struct Constraints {
26.274 + typedef typename _Graph::Node Node;
26.275 + typedef typename _Graph::Edge Edge;
26.276 + typedef typename _Graph::UEdge UEdge;
26.277 +
26.278 + void constraints() {
26.279 + checkConcept<BaseGraphComponent, _Graph>();
26.280 + checkConcept<GraphItem<'u'>, UEdge>();
26.281 + {
26.282 + Node n;
26.283 + UEdge ue(INVALID);
26.284 + Edge e;
26.285 + n = graph.source(ue);
26.286 + n = graph.target(ue);
26.287 + e = graph.direct(ue, true);
26.288 + e = graph.direct(ue, n);
26.289 + e = graph.oppositeEdge(e);
26.290 + ue = e;
26.291 + bool d = graph.direction(e);
26.292 + ignore_unused_variable_warning(d);
26.293 + }
26.294 + }
26.295 +
26.296 + const _Graph& graph;
26.297 + };
26.298 +
26.299 + };
26.300 +
26.301 + /// \brief An empty base bipartite undirected graph class.
26.302 + ///
26.303 + /// This class provides the minimal set of features needed for an
26.304 + /// bipartite undirected graph structure. All bipartite undirected
26.305 + /// graph concepts have to be conform to this base graph. It just
26.306 + /// provides types for nodes, A-nodes, B-nodes, edges and
26.307 + /// undirected edges and functions to get the source and the
26.308 + /// target of the edges and undirected edges, conversion from
26.309 + /// edges to undirected edges and function to get both direction
26.310 + /// of the undirected edges.
26.311 + class BaseBpUGraphComponent : public BaseUGraphComponent {
26.312 + public:
26.313 + typedef BaseUGraphComponent::Node Node;
26.314 + typedef BaseUGraphComponent::Edge Edge;
26.315 + typedef BaseUGraphComponent::UEdge UEdge;
26.316 +
26.317 + /// \brief Helper class for A-nodes.
26.318 + ///
26.319 + /// This class is just a helper class for A-nodes, it is not
26.320 + /// suggested to use it directly. It can be converted easily to
26.321 + /// node and vice versa. The usage of this class is limited
26.322 + /// to use just as template parameters for special map types.
26.323 + class ANode : public Node {
26.324 + public:
26.325 + typedef Node Parent;
26.326 +
26.327 + /// \brief Default constructor.
26.328 + ///
26.329 + /// \warning The default constructor is not required to set
26.330 + /// the item to some well-defined value. So you should consider it
26.331 + /// as uninitialized.
26.332 + ANode() {}
26.333 + /// \brief Copy constructor.
26.334 + ///
26.335 + /// Copy constructor.
26.336 + ///
26.337 + ANode(const ANode &) : Parent() {}
26.338 + /// \brief Invalid constructor \& conversion.
26.339 + ///
26.340 + /// This constructor initializes the item to be invalid.
26.341 + /// \sa Invalid for more details.
26.342 + ANode(Invalid) {}
26.343 + /// \brief Converter from node to A-node.
26.344 + ///
26.345 + /// Besides the core graph item functionality each node should
26.346 + /// be convertible to the represented A-node if it is it possible.
26.347 + ANode(const Node&) {}
26.348 + /// \brief Assign node to A-node.
26.349 + ///
26.350 + /// Besides the core graph item functionality each node should
26.351 + /// be convertible to the represented A-node if it is it possible.
26.352 + ANode& operator=(const Node&) { return *this; }
26.353 + };
26.354 +
26.355 + /// \brief Helper class for B-nodes.
26.356 + ///
26.357 + /// This class is just a helper class for B-nodes, it is not
26.358 + /// suggested to use it directly. It can be converted easily to
26.359 + /// node and vice versa. The usage of this class is limited
26.360 + /// to use just as template parameters for special map types.
26.361 + class BNode : public Node {
26.362 + public:
26.363 + typedef Node Parent;
26.364 +
26.365 + /// \brief Default constructor.
26.366 + ///
26.367 + /// \warning The default constructor is not required to set
26.368 + /// the item to some well-defined value. So you should consider it
26.369 + /// as uninitialized.
26.370 + BNode() {}
26.371 + /// \brief Copy constructor.
26.372 + ///
26.373 + /// Copy constructor.
26.374 + ///
26.375 + BNode(const BNode &) : Parent() {}
26.376 + /// \brief Invalid constructor \& conversion.
26.377 + ///
26.378 + /// This constructor initializes the item to be invalid.
26.379 + /// \sa Invalid for more details.
26.380 + BNode(Invalid) {}
26.381 + /// \brief Converter from node to B-node.
26.382 + ///
26.383 + /// Besides the core graph item functionality each node should
26.384 + /// be convertible to the represented B-node if it is it possible.
26.385 + BNode(const Node&) {}
26.386 + /// \brief Assign node to B-node.
26.387 + ///
26.388 + /// Besides the core graph item functionality each node should
26.389 + /// be convertible to the represented B-node if it is it possible.
26.390 + BNode& operator=(const Node&) { return *this; }
26.391 + };
26.392 +
26.393 + /// \brief Gives back %true when the node is A-node.
26.394 + ///
26.395 + /// Gives back %true when the node is A-node.
26.396 + bool aNode(const Node&) const { return false; }
26.397 +
26.398 + /// \brief Gives back %true when the node is B-node.
26.399 + ///
26.400 + /// Gives back %true when the node is B-node.
26.401 + bool bNode(const Node&) const { return false; }
26.402 +
26.403 + /// \brief Gives back the A-node of the undirected edge.
26.404 + ///
26.405 + /// Gives back the A-node of the undirected edge.
26.406 + Node aNode(const UEdge&) const { return INVALID; }
26.407 +
26.408 + /// \brief Gives back the B-node of the undirected edge.
26.409 + ///
26.410 + /// Gives back the B-node of the undirected edge.
26.411 + Node bNode(const UEdge&) const { return INVALID; }
26.412 +
26.413 + template <typename _Graph>
26.414 + struct Constraints {
26.415 + typedef typename _Graph::Node Node;
26.416 + typedef typename _Graph::ANode ANode;
26.417 + typedef typename _Graph::BNode BNode;
26.418 + typedef typename _Graph::Edge Edge;
26.419 + typedef typename _Graph::UEdge UEdge;
26.420 +
26.421 + void constraints() {
26.422 + checkConcept<BaseUGraphComponent, _Graph>();
26.423 + checkConcept<GraphItem<'a'>, ANode>();
26.424 + checkConcept<GraphItem<'b'>, BNode>();
26.425 + {
26.426 + Node n;
26.427 + UEdge ue(INVALID);
26.428 + bool b;
26.429 + n = graph.aNode(ue);
26.430 + n = graph.bNode(ue);
26.431 + b = graph.aNode(n);
26.432 + b = graph.bNode(n);
26.433 + ANode an;
26.434 + an = n; n = an;
26.435 + BNode bn;
26.436 + bn = n; n = bn;
26.437 + ignore_unused_variable_warning(b);
26.438 + }
26.439 + }
26.440 +
26.441 + const _Graph& graph;
26.442 + };
26.443 +
26.444 + };
26.445 +
26.446 + /// \brief An empty idable base graph class.
26.447 + ///
26.448 + /// This class provides beside the core graph features
26.449 + /// core id functions for the graph structure.
26.450 + /// The most of the base graphs should be conform to this concept.
26.451 + /// The id's are unique and immutable.
26.452 + template <typename _Base = BaseGraphComponent>
26.453 + class IDableGraphComponent : public _Base {
26.454 + public:
26.455 +
26.456 + typedef _Base Base;
26.457 + typedef typename Base::Node Node;
26.458 + typedef typename Base::Edge Edge;
26.459 +
26.460 + /// \brief Gives back an unique integer id for the Node.
26.461 + ///
26.462 + /// Gives back an unique integer id for the Node.
26.463 + ///
26.464 + int id(const Node&) const { return -1;}
26.465 +
26.466 + /// \brief Gives back the node by the unique id.
26.467 + ///
26.468 + /// Gives back the node by the unique id.
26.469 + /// If the graph does not contain node with the given id
26.470 + /// then the result of the function is undetermined.
26.471 + Node nodeFromId(int) const { return INVALID;}
26.472 +
26.473 + /// \brief Gives back an unique integer id for the Edge.
26.474 + ///
26.475 + /// Gives back an unique integer id for the Edge.
26.476 + ///
26.477 + int id(const Edge&) const { return -1;}
26.478 +
26.479 + /// \brief Gives back the edge by the unique id.
26.480 + ///
26.481 + /// Gives back the edge by the unique id.
26.482 + /// If the graph does not contain edge with the given id
26.483 + /// then the result of the function is undetermined.
26.484 + Edge edgeFromId(int) const { return INVALID;}
26.485 +
26.486 + /// \brief Gives back an integer greater or equal to the maximum
26.487 + /// Node id.
26.488 + ///
26.489 + /// Gives back an integer greater or equal to the maximum Node
26.490 + /// id.
26.491 + int maxNodeId() const { return -1;}
26.492 +
26.493 + /// \brief Gives back an integer greater or equal to the maximum
26.494 + /// Edge id.
26.495 + ///
26.496 + /// Gives back an integer greater or equal to the maximum Edge
26.497 + /// id.
26.498 + int maxEdgeId() const { return -1;}
26.499 +
26.500 + template <typename _Graph>
26.501 + struct Constraints {
26.502 +
26.503 + void constraints() {
26.504 + checkConcept<Base, _Graph >();
26.505 + typename _Graph::Node node;
26.506 + int nid = graph.id(node);
26.507 + nid = graph.id(node);
26.508 + node = graph.nodeFromId(nid);
26.509 + typename _Graph::Edge edge;
26.510 + int eid = graph.id(edge);
26.511 + eid = graph.id(edge);
26.512 + edge = graph.edgeFromId(eid);
26.513 +
26.514 + nid = graph.maxNodeId();
26.515 + ignore_unused_variable_warning(nid);
26.516 + eid = graph.maxEdgeId();
26.517 + ignore_unused_variable_warning(eid);
26.518 + }
26.519 +
26.520 + const _Graph& graph;
26.521 + };
26.522 + };
26.523 +
26.524 + /// \brief An empty idable base undirected graph class.
26.525 + ///
26.526 + /// This class provides beside the core undirected graph features
26.527 + /// core id functions for the undirected graph structure. The
26.528 + /// most of the base undirected graphs should be conform to this
26.529 + /// concept. The id's are unique and immutable.
26.530 + template <typename _Base = BaseUGraphComponent>
26.531 + class IDableUGraphComponent : public IDableGraphComponent<_Base> {
26.532 + public:
26.533 +
26.534 + typedef _Base Base;
26.535 + typedef typename Base::UEdge UEdge;
26.536 +
26.537 + using IDableGraphComponent<_Base>::id;
26.538 +
26.539 + /// \brief Gives back an unique integer id for the UEdge.
26.540 + ///
26.541 + /// Gives back an unique integer id for the UEdge.
26.542 + ///
26.543 + int id(const UEdge&) const { return -1;}
26.544 +
26.545 + /// \brief Gives back the undirected edge by the unique id.
26.546 + ///
26.547 + /// Gives back the undirected edge by the unique id. If the
26.548 + /// graph does not contain edge with the given id then the
26.549 + /// result of the function is undetermined.
26.550 + UEdge uEdgeFromId(int) const { return INVALID;}
26.551 +
26.552 + /// \brief Gives back an integer greater or equal to the maximum
26.553 + /// UEdge id.
26.554 + ///
26.555 + /// Gives back an integer greater or equal to the maximum UEdge
26.556 + /// id.
26.557 + int maxUEdgeId() const { return -1;}
26.558 +
26.559 + template <typename _Graph>
26.560 + struct Constraints {
26.561 +
26.562 + void constraints() {
26.563 + checkConcept<Base, _Graph >();
26.564 + checkConcept<IDableGraphComponent<Base>, _Graph >();
26.565 + typename _Graph::UEdge uedge;
26.566 + int ueid = graph.id(uedge);
26.567 + ueid = graph.id(uedge);
26.568 + uedge = graph.uEdgeFromId(ueid);
26.569 + ueid = graph.maxUEdgeId();
26.570 + ignore_unused_variable_warning(ueid);
26.571 + }
26.572 +
26.573 + const _Graph& graph;
26.574 + };
26.575 + };
26.576 +
26.577 + /// \brief An empty idable base bipartite undirected graph class.
26.578 + ///
26.579 + /// This class provides beside the core bipartite undirected graph
26.580 + /// features core id functions for the bipartite undirected graph
26.581 + /// structure. The most of the base undirected graphs should be
26.582 + /// conform to this concept.
26.583 + template <typename _Base = BaseBpUGraphComponent>
26.584 + class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> {
26.585 + public:
26.586 +
26.587 + typedef _Base Base;
26.588 + typedef typename Base::Node Node;
26.589 +
26.590 + using IDableUGraphComponent<_Base>::id;
26.591 +
26.592 + /// \brief Gives back an unique integer id for the ANode.
26.593 + ///
26.594 + /// Gives back an unique integer id for the ANode.
26.595 + ///
26.596 + int aNodeId(const Node&) const { return -1;}
26.597 +
26.598 + /// \brief Gives back the undirected edge by the unique id.
26.599 + ///
26.600 + /// Gives back the undirected edge by the unique id. If the
26.601 + /// graph does not contain edge with the given id then the
26.602 + /// result of the function is undetermined.
26.603 + Node nodeFromANodeId(int) const { return INVALID;}
26.604 +
26.605 + /// \brief Gives back an integer greater or equal to the maximum
26.606 + /// ANode id.
26.607 + ///
26.608 + /// Gives back an integer greater or equal to the maximum ANode
26.609 + /// id.
26.610 + int maxANodeId() const { return -1;}
26.611 +
26.612 + /// \brief Gives back an unique integer id for the BNode.
26.613 + ///
26.614 + /// Gives back an unique integer id for the BNode.
26.615 + ///
26.616 + int bNodeId(const Node&) const { return -1;}
26.617 +
26.618 + /// \brief Gives back the undirected edge by the unique id.
26.619 + ///
26.620 + /// Gives back the undirected edge by the unique id. If the
26.621 + /// graph does not contain edge with the given id then the
26.622 + /// result of the function is undetermined.
26.623 + Node nodeFromBNodeId(int) const { return INVALID;}
26.624 +
26.625 + /// \brief Gives back an integer greater or equal to the maximum
26.626 + /// BNode id.
26.627 + ///
26.628 + /// Gives back an integer greater or equal to the maximum BNode
26.629 + /// id.
26.630 + int maxBNodeId() const { return -1;}
26.631 +
26.632 + template <typename _Graph>
26.633 + struct Constraints {
26.634 +
26.635 + void constraints() {
26.636 + checkConcept<Base, _Graph >();
26.637 + checkConcept<IDableGraphComponent<Base>, _Graph >();
26.638 + typename _Graph::Node node(INVALID);
26.639 + int id;
26.640 + id = graph.aNodeId(node);
26.641 + id = graph.bNodeId(node);
26.642 + node = graph.nodeFromANodeId(id);
26.643 + node = graph.nodeFromBNodeId(id);
26.644 + id = graph.maxANodeId();
26.645 + id = graph.maxBNodeId();
26.646 + }
26.647 +
26.648 + const _Graph& graph;
26.649 + };
26.650 + };
26.651 +
26.652 + /// \brief Skeleton class for graph NodeIt and EdgeIt
26.653 + ///
26.654 + /// Skeleton class for graph NodeIt and EdgeIt.
26.655 + ///
26.656 + template <typename _Graph, typename _Item>
26.657 + class GraphItemIt : public _Item {
26.658 + public:
26.659 + /// \brief Default constructor.
26.660 + ///
26.661 + /// @warning The default constructor sets the iterator
26.662 + /// to an undefined value.
26.663 + GraphItemIt() {}
26.664 + /// \brief Copy constructor.
26.665 + ///
26.666 + /// Copy constructor.
26.667 + ///
26.668 + GraphItemIt(const GraphItemIt& ) {}
26.669 + /// \brief Sets the iterator to the first item.
26.670 + ///
26.671 + /// Sets the iterator to the first item of \c the graph.
26.672 + ///
26.673 + explicit GraphItemIt(const _Graph&) {}
26.674 + /// \brief Invalid constructor \& conversion.
26.675 + ///
26.676 + /// This constructor initializes the item to be invalid.
26.677 + /// \sa Invalid for more details.
26.678 + GraphItemIt(Invalid) {}
26.679 + /// \brief Assign operator for items.
26.680 + ///
26.681 + /// The items are assignable.
26.682 + ///
26.683 + GraphItemIt& operator=(const GraphItemIt&) { return *this; }
26.684 + /// \brief Next item.
26.685 + ///
26.686 + /// Assign the iterator to the next item.
26.687 + ///
26.688 + GraphItemIt& operator++() { return *this; }
26.689 + /// \brief Equality operator
26.690 + ///
26.691 + /// Two iterators are equal if and only if they point to the
26.692 + /// same object or both are invalid.
26.693 + bool operator==(const GraphItemIt&) const { return true;}
26.694 + /// \brief Inequality operator
26.695 + ///
26.696 + /// \sa operator==(Node n)
26.697 + ///
26.698 + bool operator!=(const GraphItemIt&) const { return true;}
26.699 +
26.700 + template<typename _GraphItemIt>
26.701 + struct Constraints {
26.702 + void constraints() {
26.703 + _GraphItemIt it1(g);
26.704 + _GraphItemIt it2;
26.705 +
26.706 + it2 = ++it1;
26.707 + ++it2 = it1;
26.708 + ++(++it1);
26.709 +
26.710 + _Item bi = it1;
26.711 + bi = it2;
26.712 + }
26.713 + _Graph& g;
26.714 + };
26.715 + };
26.716 +
26.717 + /// \brief Skeleton class for graph InEdgeIt and OutEdgeIt
26.718 + ///
26.719 + /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same
26.720 + /// base class, the _selector is a additional template parameter. For
26.721 + /// InEdgeIt you should instantiate it with character 'i' and for
26.722 + /// OutEdgeIt with 'o'.
26.723 + template <typename _Graph,
26.724 + typename _Item = typename _Graph::Edge,
26.725 + typename _Base = typename _Graph::Node,
26.726 + char _selector = '0'>
26.727 + class GraphIncIt : public _Item {
26.728 + public:
26.729 + /// \brief Default constructor.
26.730 + ///
26.731 + /// @warning The default constructor sets the iterator
26.732 + /// to an undefined value.
26.733 + GraphIncIt() {}
26.734 + /// \brief Copy constructor.
26.735 + ///
26.736 + /// Copy constructor.
26.737 + ///
26.738 + GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
26.739 + /// \brief Sets the iterator to the first edge incoming into or outgoing
26.740 + /// from the node.
26.741 + ///
26.742 + /// Sets the iterator to the first edge incoming into or outgoing
26.743 + /// from the node.
26.744 + ///
26.745 + explicit GraphIncIt(const _Graph&, const _Base&) {}
26.746 + /// \brief Invalid constructor \& conversion.
26.747 + ///
26.748 + /// This constructor initializes the item to be invalid.
26.749 + /// \sa Invalid for more details.
26.750 + GraphIncIt(Invalid) {}
26.751 + /// \brief Assign operator for iterators.
26.752 + ///
26.753 + /// The iterators are assignable.
26.754 + ///
26.755 + GraphIncIt& operator=(GraphIncIt const&) { return *this; }
26.756 + /// \brief Next item.
26.757 + ///
26.758 + /// Assign the iterator to the next item.
26.759 + ///
26.760 + GraphIncIt& operator++() { return *this; }
26.761 +
26.762 + /// \brief Equality operator
26.763 + ///
26.764 + /// Two iterators are equal if and only if they point to the
26.765 + /// same object or both are invalid.
26.766 + bool operator==(const GraphIncIt&) const { return true;}
26.767 +
26.768 + /// \brief Inequality operator
26.769 + ///
26.770 + /// \sa operator==(Node n)
26.771 + ///
26.772 + bool operator!=(const GraphIncIt&) const { return true;}
26.773 +
26.774 + template <typename _GraphIncIt>
26.775 + struct Constraints {
26.776 + void constraints() {
26.777 + checkConcept<GraphItem<_selector>, _GraphIncIt>();
26.778 + _GraphIncIt it1(graph, node);
26.779 + _GraphIncIt it2;
26.780 +
26.781 + it2 = ++it1;
26.782 + ++it2 = it1;
26.783 + ++(++it1);
26.784 + _Item e = it1;
26.785 + e = it2;
26.786 +
26.787 + }
26.788 +
26.789 + _Item edge;
26.790 + _Base node;
26.791 + _Graph graph;
26.792 + _GraphIncIt it;
26.793 + };
26.794 + };
26.795 +
26.796 +
26.797 + /// \brief An empty iterable graph class.
26.798 + ///
26.799 + /// This class provides beside the core graph features
26.800 + /// iterator based iterable interface for the graph structure.
26.801 + /// This concept is part of the Graph concept.
26.802 + template <typename _Base = BaseGraphComponent>
26.803 + class IterableGraphComponent : public _Base {
26.804 +
26.805 + public:
26.806 +
26.807 + typedef _Base Base;
26.808 + typedef typename Base::Node Node;
26.809 + typedef typename Base::Edge Edge;
26.810 +
26.811 + typedef IterableGraphComponent Graph;
26.812 +
26.813 + /// \name Base iteration
26.814 + ///
26.815 + /// This interface provides functions for iteration on graph items
26.816 + ///
26.817 + /// @{
26.818 +
26.819 + /// \brief Gives back the first node in the iterating order.
26.820 + ///
26.821 + /// Gives back the first node in the iterating order.
26.822 + ///
26.823 + void first(Node&) const {}
26.824 +
26.825 + /// \brief Gives back the next node in the iterating order.
26.826 + ///
26.827 + /// Gives back the next node in the iterating order.
26.828 + ///
26.829 + void next(Node&) const {}
26.830 +
26.831 + /// \brief Gives back the first edge in the iterating order.
26.832 + ///
26.833 + /// Gives back the first edge in the iterating order.
26.834 + ///
26.835 + void first(Edge&) const {}
26.836 +
26.837 + /// \brief Gives back the next edge in the iterating order.
26.838 + ///
26.839 + /// Gives back the next edge in the iterating order.
26.840 + ///
26.841 + void next(Edge&) const {}
26.842 +
26.843 +
26.844 + /// \brief Gives back the first of the edges point to the given
26.845 + /// node.
26.846 + ///
26.847 + /// Gives back the first of the edges point to the given node.
26.848 + ///
26.849 + void firstIn(Edge&, const Node&) const {}
26.850 +
26.851 + /// \brief Gives back the next of the edges points to the given
26.852 + /// node.
26.853 + ///
26.854 + /// Gives back the next of the edges points to the given node.
26.855 + ///
26.856 + void nextIn(Edge&) const {}
26.857 +
26.858 + /// \brief Gives back the first of the edges start from the
26.859 + /// given node.
26.860 + ///
26.861 + /// Gives back the first of the edges start from the given node.
26.862 + ///
26.863 + void firstOut(Edge&, const Node&) const {}
26.864 +
26.865 + /// \brief Gives back the next of the edges start from the given
26.866 + /// node.
26.867 + ///
26.868 + /// Gives back the next of the edges start from the given node.
26.869 + ///
26.870 + void nextOut(Edge&) const {}
26.871 +
26.872 + /// @}
26.873 +
26.874 + /// \name Class based iteration
26.875 + ///
26.876 + /// This interface provides functions for iteration on graph items
26.877 + ///
26.878 + /// @{
26.879 +
26.880 + /// \brief This iterator goes through each node.
26.881 + ///
26.882 + /// This iterator goes through each node.
26.883 + ///
26.884 + typedef GraphItemIt<Graph, Node> NodeIt;
26.885 +
26.886 + /// \brief This iterator goes through each node.
26.887 + ///
26.888 + /// This iterator goes through each node.
26.889 + ///
26.890 + typedef GraphItemIt<Graph, Edge> EdgeIt;
26.891 +
26.892 + /// \brief This iterator goes trough the incoming edges of a node.
26.893 + ///
26.894 + /// This iterator goes trough the \e inccoming edges of a certain node
26.895 + /// of a graph.
26.896 + typedef GraphIncIt<Graph, Edge, Node, 'i'> InEdgeIt;
26.897 +
26.898 + /// \brief This iterator goes trough the outgoing edges of a node.
26.899 + ///
26.900 + /// This iterator goes trough the \e outgoing edges of a certain node
26.901 + /// of a graph.
26.902 + typedef GraphIncIt<Graph, Edge, Node, 'o'> OutEdgeIt;
26.903 +
26.904 + /// \brief The base node of the iterator.
26.905 + ///
26.906 + /// Gives back the base node of the iterator.
26.907 + /// It is always the target of the pointed edge.
26.908 + Node baseNode(const InEdgeIt&) const { return INVALID; }
26.909 +
26.910 + /// \brief The running node of the iterator.
26.911 + ///
26.912 + /// Gives back the running node of the iterator.
26.913 + /// It is always the source of the pointed edge.
26.914 + Node runningNode(const InEdgeIt&) const { return INVALID; }
26.915 +
26.916 + /// \brief The base node of the iterator.
26.917 + ///
26.918 + /// Gives back the base node of the iterator.
26.919 + /// It is always the source of the pointed edge.
26.920 + Node baseNode(const OutEdgeIt&) const { return INVALID; }
26.921 +
26.922 + /// \brief The running node of the iterator.
26.923 + ///
26.924 + /// Gives back the running node of the iterator.
26.925 + /// It is always the target of the pointed edge.
26.926 + Node runningNode(const OutEdgeIt&) const { return INVALID; }
26.927 +
26.928 + /// @}
26.929 +
26.930 + template <typename _Graph>
26.931 + struct Constraints {
26.932 + void constraints() {
26.933 + checkConcept<Base, _Graph>();
26.934 +
26.935 + {
26.936 + typename _Graph::Node node(INVALID);
26.937 + typename _Graph::Edge edge(INVALID);
26.938 + {
26.939 + graph.first(node);
26.940 + graph.next(node);
26.941 + }
26.942 + {
26.943 + graph.first(edge);
26.944 + graph.next(edge);
26.945 + }
26.946 + {
26.947 + graph.firstIn(edge, node);
26.948 + graph.nextIn(edge);
26.949 + }
26.950 + {
26.951 + graph.firstOut(edge, node);
26.952 + graph.nextOut(edge);
26.953 + }
26.954 + }
26.955 +
26.956 + {
26.957 + checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
26.958 + typename _Graph::EdgeIt >();
26.959 + checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
26.960 + typename _Graph::NodeIt >();
26.961 + checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
26.962 + typename _Graph::Node, 'i'>, typename _Graph::InEdgeIt>();
26.963 + checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
26.964 + typename _Graph::Node, 'o'>, typename _Graph::OutEdgeIt>();
26.965 +
26.966 + typename _Graph::Node n;
26.967 + typename _Graph::InEdgeIt ieit(INVALID);
26.968 + typename _Graph::OutEdgeIt oeit(INVALID);
26.969 + n = graph.baseNode(ieit);
26.970 + n = graph.runningNode(ieit);
26.971 + n = graph.baseNode(oeit);
26.972 + n = graph.runningNode(oeit);
26.973 + ignore_unused_variable_warning(n);
26.974 + }
26.975 + }
26.976 +
26.977 + const _Graph& graph;
26.978 +
26.979 + };
26.980 + };
26.981 +
26.982 + /// \brief An empty iterable undirected graph class.
26.983 + ///
26.984 + /// This class provides beside the core graph features iterator
26.985 + /// based iterable interface for the undirected graph structure.
26.986 + /// This concept is part of the UGraph concept.
26.987 + template <typename _Base = BaseUGraphComponent>
26.988 + class IterableUGraphComponent : public IterableGraphComponent<_Base> {
26.989 + public:
26.990 +
26.991 + typedef _Base Base;
26.992 + typedef typename Base::Node Node;
26.993 + typedef typename Base::Edge Edge;
26.994 + typedef typename Base::UEdge UEdge;
26.995 +
26.996 +
26.997 + typedef IterableUGraphComponent Graph;
26.998 +
26.999 + /// \name Base iteration
26.1000 + ///
26.1001 + /// This interface provides functions for iteration on graph items
26.1002 + /// @{
26.1003 +
26.1004 + using IterableGraphComponent<_Base>::first;
26.1005 + using IterableGraphComponent<_Base>::next;
26.1006 +
26.1007 + /// \brief Gives back the first undirected edge in the iterating
26.1008 + /// order.
26.1009 + ///
26.1010 + /// Gives back the first undirected edge in the iterating order.
26.1011 + ///
26.1012 + void first(UEdge&) const {}
26.1013 +
26.1014 + /// \brief Gives back the next undirected edge in the iterating
26.1015 + /// order.
26.1016 + ///
26.1017 + /// Gives back the next undirected edge in the iterating order.
26.1018 + ///
26.1019 + void next(UEdge&) const {}
26.1020 +
26.1021 +
26.1022 + /// \brief Gives back the first of the undirected edges from the
26.1023 + /// given node.
26.1024 + ///
26.1025 + /// Gives back the first of the undirected edges from the given
26.1026 + /// node. The bool parameter gives back that direction which
26.1027 + /// gives a good direction of the uedge so the source of the
26.1028 + /// directed edge is the given node.
26.1029 + void firstInc(UEdge&, bool&, const Node&) const {}
26.1030 +
26.1031 + /// \brief Gives back the next of the undirected edges from the
26.1032 + /// given node.
26.1033 + ///
26.1034 + /// Gives back the next of the undirected edges from the given
26.1035 + /// node. The bool parameter should be used as the \c firstInc()
26.1036 + /// use it.
26.1037 + void nextInc(UEdge&, bool&) const {}
26.1038 +
26.1039 + using IterableGraphComponent<_Base>::baseNode;
26.1040 + using IterableGraphComponent<_Base>::runningNode;
26.1041 +
26.1042 + /// @}
26.1043 +
26.1044 + /// \name Class based iteration
26.1045 + ///
26.1046 + /// This interface provides functions for iteration on graph items
26.1047 + ///
26.1048 + /// @{
26.1049 +
26.1050 + /// \brief This iterator goes through each node.
26.1051 + ///
26.1052 + /// This iterator goes through each node.
26.1053 + typedef GraphItemIt<Graph, UEdge> UEdgeIt;
26.1054 + /// \brief This iterator goes trough the incident edges of a
26.1055 + /// node.
26.1056 + ///
26.1057 + /// This iterator goes trough the incident edges of a certain
26.1058 + /// node of a graph.
26.1059 + typedef GraphIncIt<Graph, UEdge, Node, 'u'> IncEdgeIt;
26.1060 + /// \brief The base node of the iterator.
26.1061 + ///
26.1062 + /// Gives back the base node of the iterator.
26.1063 + Node baseNode(const IncEdgeIt&) const { return INVALID; }
26.1064 +
26.1065 + /// \brief The running node of the iterator.
26.1066 + ///
26.1067 + /// Gives back the running node of the iterator.
26.1068 + Node runningNode(const IncEdgeIt&) const { return INVALID; }
26.1069 +
26.1070 + /// @}
26.1071 +
26.1072 + template <typename _Graph>
26.1073 + struct Constraints {
26.1074 + void constraints() {
26.1075 + checkConcept<IterableGraphComponent<Base>, _Graph>();
26.1076 +
26.1077 + {
26.1078 + typename _Graph::Node node(INVALID);
26.1079 + typename _Graph::UEdge uedge(INVALID);
26.1080 + bool dir;
26.1081 + {
26.1082 + graph.first(uedge);
26.1083 + graph.next(uedge);
26.1084 + }
26.1085 + {
26.1086 + graph.firstInc(uedge, dir, node);
26.1087 + graph.nextInc(uedge, dir);
26.1088 + }
26.1089 +
26.1090 + }
26.1091 +
26.1092 + {
26.1093 + checkConcept<GraphItemIt<_Graph, typename _Graph::UEdge>,
26.1094 + typename _Graph::UEdgeIt >();
26.1095 + checkConcept<GraphIncIt<_Graph, typename _Graph::UEdge,
26.1096 + typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
26.1097 +
26.1098 + typename _Graph::Node n;
26.1099 + typename _Graph::IncEdgeIt ueit(INVALID);
26.1100 + n = graph.baseNode(ueit);
26.1101 + n = graph.runningNode(ueit);
26.1102 + }
26.1103 + }
26.1104 +
26.1105 + const _Graph& graph;
26.1106 +
26.1107 + };
26.1108 + };
26.1109 +
26.1110 + /// \brief An empty iterable bipartite undirected graph class.
26.1111 + ///
26.1112 + /// This class provides beside the core graph features iterator
26.1113 + /// based iterable interface for the bipartite undirected graph
26.1114 + /// structure. This concept is part of the BpUGraph concept.
26.1115 + template <typename _Base = BaseUGraphComponent>
26.1116 + class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> {
26.1117 + public:
26.1118 +
26.1119 + typedef _Base Base;
26.1120 + typedef typename Base::Node Node;
26.1121 + typedef typename Base::UEdge UEdge;
26.1122 +
26.1123 + typedef IterableBpUGraphComponent Graph;
26.1124 +
26.1125 + /// \name Base iteration
26.1126 + ///
26.1127 + /// This interface provides functions for iteration on graph items
26.1128 + /// @{
26.1129 +
26.1130 + using IterableUGraphComponent<_Base>::first;
26.1131 + using IterableUGraphComponent<_Base>::next;
26.1132 +
26.1133 + /// \brief Gives back the first A-node in the iterating order.
26.1134 + ///
26.1135 + /// Gives back the first undirected A-node in the iterating
26.1136 + /// order.
26.1137 + ///
26.1138 + void firstANode(Node&) const {}
26.1139 +
26.1140 + /// \brief Gives back the next A-node in the iterating order.
26.1141 + ///
26.1142 + /// Gives back the next A-node in the iterating order.
26.1143 + ///
26.1144 + void nextANode(Node&) const {}
26.1145 +
26.1146 + /// \brief Gives back the first B-node in the iterating order.
26.1147 + ///
26.1148 + /// Gives back the first undirected B-node in the iterating
26.1149 + /// order.
26.1150 + ///
26.1151 + void firstBNode(Node&) const {}
26.1152 +
26.1153 + /// \brief Gives back the next B-node in the iterating order.
26.1154 + ///
26.1155 + /// Gives back the next B-node in the iterating order.
26.1156 + ///
26.1157 + void nextBNode(Node&) const {}
26.1158 +
26.1159 +
26.1160 + /// \brief Gives back the first of the undirected edges start
26.1161 + /// from the given A-node.
26.1162 + ///
26.1163 + /// Gives back the first of the undirected edges start from the
26.1164 + /// given A-node.
26.1165 + void firstFromANode(UEdge&, const Node&) const {}
26.1166 +
26.1167 + /// \brief Gives back the next of the undirected edges start
26.1168 + /// from the given A-node.
26.1169 + ///
26.1170 + /// Gives back the next of the undirected edges start from the
26.1171 + /// given A-node.
26.1172 + void nextFromANode(UEdge&) const {}
26.1173 +
26.1174 + /// \brief Gives back the first of the undirected edges start
26.1175 + /// from the given B-node.
26.1176 + ///
26.1177 + /// Gives back the first of the undirected edges start from the
26.1178 + /// given B-node.
26.1179 + void firstFromBNode(UEdge&, const Node&) const {}
26.1180 +
26.1181 + /// \brief Gives back the next of the undirected edges start
26.1182 + /// from the given B-node.
26.1183 + ///
26.1184 + /// Gives back the next of the undirected edges start from the
26.1185 + /// given B-node.
26.1186 + void nextFromBNode(UEdge&) const {}
26.1187 +
26.1188 +
26.1189 + /// @}
26.1190 +
26.1191 + /// \name Class based iteration
26.1192 + ///
26.1193 + /// This interface provides functions for iteration on graph items
26.1194 + ///
26.1195 + /// @{
26.1196 +
26.1197 + /// \brief This iterator goes through each A-node.
26.1198 + ///
26.1199 + /// This iterator goes through each A-node.
26.1200 + typedef GraphItemIt<Graph, Node> ANodeIt;
26.1201 +
26.1202 + /// \brief This iterator goes through each B-node.
26.1203 + ///
26.1204 + /// This iterator goes through each B-node.
26.1205 + typedef GraphItemIt<Graph, Node> BNodeIt;
26.1206 +
26.1207 + /// @}
26.1208 +
26.1209 + template <typename _Graph>
26.1210 + struct Constraints {
26.1211 + void constraints() {
26.1212 + checkConcept<IterableUGraphComponent<Base>, _Graph>();
26.1213 +
26.1214 + {
26.1215 + typename _Graph::Node node(INVALID);
26.1216 + typename _Graph::UEdge uedge(INVALID);
26.1217 + graph.firstANode(node);
26.1218 + graph.nextANode(node);
26.1219 + graph.firstBNode(node);
26.1220 + graph.nextBNode(node);
26.1221 +
26.1222 + graph.firstFromANode(uedge, node);
26.1223 + graph.nextFromANode(uedge);
26.1224 + graph.firstFromBNode(uedge, node);
26.1225 + graph.nextFromBNode(uedge);
26.1226 + }
26.1227 + {
26.1228 + checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
26.1229 + typename _Graph::ANodeIt >();
26.1230 + checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
26.1231 + typename _Graph::BNodeIt >();
26.1232 + }
26.1233 +
26.1234 + }
26.1235 +
26.1236 + const _Graph& graph;
26.1237 +
26.1238 + };
26.1239 + };
26.1240 +
26.1241 + /// \brief An empty alteration notifier graph class.
26.1242 + ///
26.1243 + /// This class provides beside the core graph features alteration
26.1244 + /// notifier interface for the graph structure. This implements
26.1245 + /// an observer-notifier pattern for each graph item. More
26.1246 + /// obsevers can be registered into the notifier and whenever an
26.1247 + /// alteration occured in the graph all the observers will
26.1248 + /// notified about it.
26.1249 + template <typename _Base = BaseGraphComponent>
26.1250 + class AlterableGraphComponent : public _Base {
26.1251 + public:
26.1252 +
26.1253 + typedef _Base Base;
26.1254 + typedef typename Base::Node Node;
26.1255 + typedef typename Base::Edge Edge;
26.1256 +
26.1257 +
26.1258 + /// The node observer registry.
26.1259 + typedef AlterationNotifier<AlterableGraphComponent, Node>
26.1260 + NodeNotifier;
26.1261 + /// The edge observer registry.
26.1262 + typedef AlterationNotifier<AlterableGraphComponent, Edge>
26.1263 + EdgeNotifier;
26.1264 +
26.1265 + /// \brief Gives back the node alteration notifier.
26.1266 + ///
26.1267 + /// Gives back the node alteration notifier.
26.1268 + NodeNotifier& getNotifier(Node) const {
26.1269 + return NodeNotifier();
26.1270 + }
26.1271 +
26.1272 + /// \brief Gives back the edge alteration notifier.
26.1273 + ///
26.1274 + /// Gives back the edge alteration notifier.
26.1275 + EdgeNotifier& getNotifier(Edge) const {
26.1276 + return EdgeNotifier();
26.1277 + }
26.1278 +
26.1279 + template <typename _Graph>
26.1280 + struct Constraints {
26.1281 + void constraints() {
26.1282 + checkConcept<Base, _Graph>();
26.1283 + typename _Graph::NodeNotifier& nn
26.1284 + = graph.getNotifier(typename _Graph::Node());
26.1285 +
26.1286 + typename _Graph::EdgeNotifier& en
26.1287 + = graph.getNotifier(typename _Graph::Edge());
26.1288 +
26.1289 + ignore_unused_variable_warning(nn);
26.1290 + ignore_unused_variable_warning(en);
26.1291 + }
26.1292 +
26.1293 + const _Graph& graph;
26.1294 +
26.1295 + };
26.1296 +
26.1297 + };
26.1298 +
26.1299 + /// \brief An empty alteration notifier undirected graph class.
26.1300 + ///
26.1301 + /// This class provides beside the core graph features alteration
26.1302 + /// notifier interface for the graph structure. This implements
26.1303 + /// an observer-notifier pattern for each graph item. More
26.1304 + /// obsevers can be registered into the notifier and whenever an
26.1305 + /// alteration occured in the graph all the observers will
26.1306 + /// notified about it.
26.1307 + template <typename _Base = BaseUGraphComponent>
26.1308 + class AlterableUGraphComponent : public AlterableGraphComponent<_Base> {
26.1309 + public:
26.1310 +
26.1311 + typedef _Base Base;
26.1312 + typedef typename Base::UEdge UEdge;
26.1313 +
26.1314 +
26.1315 + /// The edge observer registry.
26.1316 + typedef AlterationNotifier<AlterableUGraphComponent, UEdge>
26.1317 + UEdgeNotifier;
26.1318 +
26.1319 + /// \brief Gives back the edge alteration notifier.
26.1320 + ///
26.1321 + /// Gives back the edge alteration notifier.
26.1322 + UEdgeNotifier& getNotifier(UEdge) const {
26.1323 + return UEdgeNotifier();
26.1324 + }
26.1325 +
26.1326 + template <typename _Graph>
26.1327 + struct Constraints {
26.1328 + void constraints() {
26.1329 + checkConcept<AlterableGraphComponent<Base>, _Graph>();
26.1330 + typename _Graph::UEdgeNotifier& uen
26.1331 + = graph.getNotifier(typename _Graph::UEdge());
26.1332 + ignore_unused_variable_warning(uen);
26.1333 + }
26.1334 +
26.1335 + const _Graph& graph;
26.1336 +
26.1337 + };
26.1338 +
26.1339 + };
26.1340 +
26.1341 + /// \brief An empty alteration notifier bipartite undirected graph
26.1342 + /// class.
26.1343 + ///
26.1344 + /// This class provides beside the core graph features alteration
26.1345 + /// notifier interface for the graph structure. This implements
26.1346 + /// an observer-notifier pattern for each graph item. More
26.1347 + /// obsevers can be registered into the notifier and whenever an
26.1348 + /// alteration occured in the graph all the observers will
26.1349 + /// notified about it.
26.1350 + template <typename _Base = BaseUGraphComponent>
26.1351 + class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> {
26.1352 + public:
26.1353 +
26.1354 + typedef _Base Base;
26.1355 + typedef typename Base::ANode ANode;
26.1356 + typedef typename Base::BNode BNode;
26.1357 +
26.1358 +
26.1359 + /// The A-node observer registry.
26.1360 + typedef AlterationNotifier<AlterableBpUGraphComponent, ANode>
26.1361 + ANodeNotifier;
26.1362 +
26.1363 + /// The B-node observer registry.
26.1364 + typedef AlterationNotifier<AlterableBpUGraphComponent, BNode>
26.1365 + BNodeNotifier;
26.1366 +
26.1367 + /// \brief Gives back the A-node alteration notifier.
26.1368 + ///
26.1369 + /// Gives back the A-node alteration notifier.
26.1370 + ANodeNotifier& getNotifier(ANode) const {
26.1371 + return ANodeNotifier();
26.1372 + }
26.1373 +
26.1374 + /// \brief Gives back the B-node alteration notifier.
26.1375 + ///
26.1376 + /// Gives back the B-node alteration notifier.
26.1377 + BNodeNotifier& getNotifier(BNode) const {
26.1378 + return BNodeNotifier();
26.1379 + }
26.1380 +
26.1381 + template <typename _Graph>
26.1382 + struct Constraints {
26.1383 + void constraints() {
26.1384 + checkConcept<AlterableUGraphComponent<Base>, _Graph>();
26.1385 + typename _Graph::ANodeNotifier& ann
26.1386 + = graph.getNotifier(typename _Graph::ANode());
26.1387 + typename _Graph::BNodeNotifier& bnn
26.1388 + = graph.getNotifier(typename _Graph::BNode());
26.1389 + ignore_unused_variable_warning(ann);
26.1390 + ignore_unused_variable_warning(bnn);
26.1391 + }
26.1392 +
26.1393 + const _Graph& graph;
26.1394 +
26.1395 + };
26.1396 +
26.1397 + };
26.1398 +
26.1399 +
26.1400 + /// \brief Class describing the concept of graph maps
26.1401 + ///
26.1402 + /// This class describes the common interface of the graph maps
26.1403 + /// (NodeMap, EdgeMap), that is \ref maps-page "maps" which can be used to
26.1404 + /// associate data to graph descriptors (nodes or edges).
26.1405 + template <typename _Graph, typename _Item, typename _Value>
26.1406 + class GraphMap : public ReadWriteMap<_Item, _Value> {
26.1407 + public:
26.1408 +
26.1409 + typedef ReadWriteMap<_Item, _Value> Parent;
26.1410 +
26.1411 + /// The graph type of the map.
26.1412 + typedef _Graph Graph;
26.1413 + /// The key type of the map.
26.1414 + typedef _Item Key;
26.1415 + /// The value type of the map.
26.1416 + typedef _Value Value;
26.1417 +
26.1418 + /// \brief Construct a new map.
26.1419 + ///
26.1420 + /// Construct a new map for the graph.
26.1421 + explicit GraphMap(const Graph&) {}
26.1422 + /// \brief Construct a new map with default value.
26.1423 + ///
26.1424 + /// Construct a new map for the graph and initalise the values.
26.1425 + GraphMap(const Graph&, const Value&) {}
26.1426 + /// \brief Copy constructor.
26.1427 + ///
26.1428 + /// Copy Constructor.
26.1429 + GraphMap(const GraphMap&) : Parent() {}
26.1430 +
26.1431 + /// \brief Assign operator.
26.1432 + ///
26.1433 + /// Assign operator. It does not mofify the underlying graph,
26.1434 + /// it just iterates on the current item set and set the map
26.1435 + /// with the value returned by the assigned map.
26.1436 + template <typename CMap>
26.1437 + GraphMap& operator=(const CMap&) {
26.1438 + checkConcept<ReadMap<Key, Value>, CMap>();
26.1439 + return *this;
26.1440 + }
26.1441 +
26.1442 + template<typename _Map>
26.1443 + struct Constraints {
26.1444 + void constraints() {
26.1445 + checkConcept<ReadWriteMap<Key, Value>, _Map >();
26.1446 + // Construction with a graph parameter
26.1447 + _Map a(g);
26.1448 + // Constructor with a graph and a default value parameter
26.1449 + _Map a2(g,t);
26.1450 + // Copy constructor.
26.1451 + _Map b(c);
26.1452 +
26.1453 + ReadMap<Key, Value> cmap;
26.1454 + b = cmap;
26.1455 +
26.1456 + ignore_unused_variable_warning(a2);
26.1457 + ignore_unused_variable_warning(b);
26.1458 + }
26.1459 +
26.1460 + const _Map &c;
26.1461 + const Graph &g;
26.1462 + const typename GraphMap::Value &t;
26.1463 + };
26.1464 +
26.1465 + };
26.1466 +
26.1467 + /// \brief An empty mappable graph class.
26.1468 + ///
26.1469 + /// This class provides beside the core graph features
26.1470 + /// map interface for the graph structure.
26.1471 + /// This concept is part of the Graph concept.
26.1472 + template <typename _Base = BaseGraphComponent>
26.1473 + class MappableGraphComponent : public _Base {
26.1474 + public:
26.1475 +
26.1476 + typedef _Base Base;
26.1477 + typedef typename Base::Node Node;
26.1478 + typedef typename Base::Edge Edge;
26.1479 +
26.1480 + typedef MappableGraphComponent Graph;
26.1481 +
26.1482 + /// \brief ReadWrite map of the nodes.
26.1483 + ///
26.1484 + /// ReadWrite map of the nodes.
26.1485 + ///
26.1486 + template <typename _Value>
26.1487 + class NodeMap : public GraphMap<Graph, Node, _Value> {
26.1488 + private:
26.1489 + NodeMap();
26.1490 + public:
26.1491 + typedef GraphMap<MappableGraphComponent, Node, _Value> Parent;
26.1492 +
26.1493 + /// \brief Construct a new map.
26.1494 + ///
26.1495 + /// Construct a new map for the graph.
26.1496 + /// \todo call the right parent class constructor
26.1497 + explicit NodeMap(const MappableGraphComponent& graph)
26.1498 + : Parent(graph) {}
26.1499 +
26.1500 + /// \brief Construct a new map with default value.
26.1501 + ///
26.1502 + /// Construct a new map for the graph and initalise the values.
26.1503 + NodeMap(const MappableGraphComponent& graph, const _Value& value)
26.1504 + : Parent(graph, value) {}
26.1505 +
26.1506 + /// \brief Copy constructor.
26.1507 + ///
26.1508 + /// Copy Constructor.
26.1509 + NodeMap(const NodeMap& nm) : Parent(nm) {}
26.1510 +
26.1511 + /// \brief Assign operator.
26.1512 + ///
26.1513 + /// Assign operator.
26.1514 + template <typename CMap>
26.1515 + NodeMap& operator=(const CMap&) {
26.1516 + checkConcept<ReadMap<Node, _Value>, CMap>();
26.1517 + return *this;
26.1518 + }
26.1519 +
26.1520 + };
26.1521 +
26.1522 + /// \brief ReadWrite map of the edges.
26.1523 + ///
26.1524 + /// ReadWrite map of the edges.
26.1525 + ///
26.1526 + template <typename _Value>
26.1527 + class EdgeMap : public GraphMap<Graph, Edge, _Value> {
26.1528 + private:
26.1529 + EdgeMap();
26.1530 + public:
26.1531 + typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
26.1532 +
26.1533 + /// \brief Construct a new map.
26.1534 + ///
26.1535 + /// Construct a new map for the graph.
26.1536 + /// \todo call the right parent class constructor
26.1537 + explicit EdgeMap(const MappableGraphComponent& graph)
26.1538 + : Parent(graph) {}
26.1539 +
26.1540 + /// \brief Construct a new map with default value.
26.1541 + ///
26.1542 + /// Construct a new map for the graph and initalise the values.
26.1543 + EdgeMap(const MappableGraphComponent& graph, const _Value& value)
26.1544 + : Parent(graph, value) {}
26.1545 +
26.1546 + /// \brief Copy constructor.
26.1547 + ///
26.1548 + /// Copy Constructor.
26.1549 + EdgeMap(const EdgeMap& nm) : Parent(nm) {}
26.1550 +
26.1551 + /// \brief Assign operator.
26.1552 + ///
26.1553 + /// Assign operator.
26.1554 + template <typename CMap>
26.1555 + EdgeMap& operator=(const CMap&) {
26.1556 + checkConcept<ReadMap<Edge, _Value>, CMap>();
26.1557 + return *this;
26.1558 + }
26.1559 +
26.1560 + };
26.1561 +
26.1562 +
26.1563 + template <typename _Graph>
26.1564 + struct Constraints {
26.1565 +
26.1566 + struct Dummy {
26.1567 + int value;
26.1568 + Dummy() : value(0) {}
26.1569 + Dummy(int _v) : value(_v) {}
26.1570 + };
26.1571 +
26.1572 + void constraints() {
26.1573 + checkConcept<Base, _Graph>();
26.1574 + { // int map test
26.1575 + typedef typename _Graph::template NodeMap<int> IntNodeMap;
26.1576 + checkConcept<GraphMap<_Graph, typename _Graph::Node, int>,
26.1577 + IntNodeMap >();
26.1578 + } { // bool map test
26.1579 + typedef typename _Graph::template NodeMap<bool> BoolNodeMap;
26.1580 + checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>,
26.1581 + BoolNodeMap >();
26.1582 + } { // Dummy map test
26.1583 + typedef typename _Graph::template NodeMap<Dummy> DummyNodeMap;
26.1584 + checkConcept<GraphMap<_Graph, typename _Graph::Node, Dummy>,
26.1585 + DummyNodeMap >();
26.1586 + }
26.1587 +
26.1588 + { // int map test
26.1589 + typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
26.1590 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
26.1591 + IntEdgeMap >();
26.1592 + } { // bool map test
26.1593 + typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
26.1594 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
26.1595 + BoolEdgeMap >();
26.1596 + } { // Dummy map test
26.1597 + typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
26.1598 + checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
26.1599 + DummyEdgeMap >();
26.1600 + }
26.1601 + }
26.1602 +
26.1603 + _Graph& graph;
26.1604 + };
26.1605 + };
26.1606 +
26.1607 + /// \brief An empty mappable base bipartite undirected graph class.
26.1608 + ///
26.1609 + /// This class provides beside the core graph features
26.1610 + /// map interface for the graph structure.
26.1611 + /// This concept is part of the UGraph concept.
26.1612 + template <typename _Base = BaseUGraphComponent>
26.1613 + class MappableUGraphComponent : public MappableGraphComponent<_Base> {
26.1614 + public:
26.1615 +
26.1616 + typedef _Base Base;
26.1617 + typedef typename Base::UEdge UEdge;
26.1618 +
26.1619 + typedef MappableUGraphComponent Graph;
26.1620 +
26.1621 + /// \brief ReadWrite map of the uedges.
26.1622 + ///
26.1623 + /// ReadWrite map of the uedges.
26.1624 + ///
26.1625 + template <typename _Value>
26.1626 + class UEdgeMap : public GraphMap<Graph, UEdge, _Value> {
26.1627 + public:
26.1628 + typedef GraphMap<MappableUGraphComponent, UEdge, _Value> Parent;
26.1629 +
26.1630 + /// \brief Construct a new map.
26.1631 + ///
26.1632 + /// Construct a new map for the graph.
26.1633 + /// \todo call the right parent class constructor
26.1634 + explicit UEdgeMap(const MappableUGraphComponent& graph)
26.1635 + : Parent(graph) {}
26.1636 +
26.1637 + /// \brief Construct a new map with default value.
26.1638 + ///
26.1639 + /// Construct a new map for the graph and initalise the values.
26.1640 + UEdgeMap(const MappableUGraphComponent& graph, const _Value& value)
26.1641 + : Parent(graph, value) {}
26.1642 +
26.1643 + /// \brief Copy constructor.
26.1644 + ///
26.1645 + /// Copy Constructor.
26.1646 + UEdgeMap(const UEdgeMap& nm) : Parent(nm) {}
26.1647 +
26.1648 + /// \brief Assign operator.
26.1649 + ///
26.1650 + /// Assign operator.
26.1651 + template <typename CMap>
26.1652 + UEdgeMap& operator=(const CMap&) {
26.1653 + checkConcept<ReadMap<UEdge, _Value>, CMap>();
26.1654 + return *this;
26.1655 + }
26.1656 +
26.1657 + };
26.1658 +
26.1659 +
26.1660 + template <typename _Graph>
26.1661 + struct Constraints {
26.1662 +
26.1663 + struct Dummy {
26.1664 + int value;
26.1665 + Dummy() : value(0) {}
26.1666 + Dummy(int _v) : value(_v) {}
26.1667 + };
26.1668 +
26.1669 + void constraints() {
26.1670 + checkConcept<MappableGraphComponent<Base>, _Graph>();
26.1671 +
26.1672 + { // int map test
26.1673 + typedef typename _Graph::template UEdgeMap<int> IntUEdgeMap;
26.1674 + checkConcept<GraphMap<_Graph, typename _Graph::UEdge, int>,
26.1675 + IntUEdgeMap >();
26.1676 + } { // bool map test
26.1677 + typedef typename _Graph::template UEdgeMap<bool> BoolUEdgeMap;
26.1678 + checkConcept<GraphMap<_Graph, typename _Graph::UEdge, bool>,
26.1679 + BoolUEdgeMap >();
26.1680 + } { // Dummy map test
26.1681 + typedef typename _Graph::template UEdgeMap<Dummy> DummyUEdgeMap;
26.1682 + checkConcept<GraphMap<_Graph, typename _Graph::UEdge, Dummy>,
26.1683 + DummyUEdgeMap >();
26.1684 + }
26.1685 + }
26.1686 +
26.1687 + _Graph& graph;
26.1688 + };
26.1689 + };
26.1690 +
26.1691 + /// \brief An empty mappable base bipartite undirected graph
26.1692 + /// class.
26.1693 + ///
26.1694 + /// This class provides beside the core graph features
26.1695 + /// map interface for the graph structure.
26.1696 + /// This concept is part of the BpUGraph concept.
26.1697 + template <typename _Base = BaseBpUGraphComponent>
26.1698 + class MappableBpUGraphComponent : public MappableUGraphComponent<_Base> {
26.1699 + public:
26.1700 +
26.1701 + typedef _Base Base;
26.1702 + typedef typename Base::Node Node;
26.1703 +
26.1704 + typedef MappableBpUGraphComponent Graph;
26.1705 +
26.1706 + /// \brief ReadWrite map of the A-nodes.
26.1707 + ///
26.1708 + /// ReadWrite map of the A-nodes.
26.1709 + ///
26.1710 + template <typename _Value>
26.1711 + class ANodeMap : public GraphMap<Graph, Node, _Value> {
26.1712 + public:
26.1713 + typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
26.1714 +
26.1715 + /// \brief Construct a new map.
26.1716 + ///
26.1717 + /// Construct a new map for the graph.
26.1718 + /// \todo call the right parent class constructor
26.1719 + explicit ANodeMap(const MappableBpUGraphComponent& graph)
26.1720 + : Parent(graph) {}
26.1721 +
26.1722 + /// \brief Construct a new map with default value.
26.1723 + ///
26.1724 + /// Construct a new map for the graph and initalise the values.
26.1725 + ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
26.1726 + : Parent(graph, value) {}
26.1727 +
26.1728 + /// \brief Copy constructor.
26.1729 + ///
26.1730 + /// Copy Constructor.
26.1731 + ANodeMap(const ANodeMap& nm) : Parent(nm) {}
26.1732 +
26.1733 + /// \brief Assign operator.
26.1734 + ///
26.1735 + /// Assign operator.
26.1736 + template <typename CMap>
26.1737 + ANodeMap& operator=(const CMap&) {
26.1738 + checkConcept<ReadMap<Node, _Value>, CMap>();
26.1739 + return *this;
26.1740 + }
26.1741 +
26.1742 + };
26.1743 +
26.1744 + /// \brief ReadWrite map of the B-nodes.
26.1745 + ///
26.1746 + /// ReadWrite map of the A-nodes.
26.1747 + ///
26.1748 + template <typename _Value>
26.1749 + class BNodeMap : public GraphMap<Graph, Node, _Value> {
26.1750 + public:
26.1751 + typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
26.1752 +
26.1753 + /// \brief Construct a new map.
26.1754 + ///
26.1755 + /// Construct a new map for the graph.
26.1756 + /// \todo call the right parent class constructor
26.1757 + explicit BNodeMap(const MappableBpUGraphComponent& graph)
26.1758 + : Parent(graph) {}
26.1759 +
26.1760 + /// \brief Construct a new map with default value.
26.1761 + ///
26.1762 + /// Construct a new map for the graph and initalise the values.
26.1763 + BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
26.1764 + : Parent(graph, value) {}
26.1765 +
26.1766 + /// \brief Copy constructor.
26.1767 + ///
26.1768 + /// Copy Constructor.
26.1769 + BNodeMap(const BNodeMap& nm) : Parent(nm) {}
26.1770 +
26.1771 + /// \brief Assign operator.
26.1772 + ///
26.1773 + /// Assign operator.
26.1774 + template <typename CMap>
26.1775 + BNodeMap& operator=(const CMap&) {
26.1776 + checkConcept<ReadMap<Node, _Value>, CMap>();
26.1777 + return *this;
26.1778 + }
26.1779 +
26.1780 + };
26.1781 +
26.1782 +
26.1783 + template <typename _Graph>
26.1784 + struct Constraints {
26.1785 +
26.1786 + struct Dummy {
26.1787 + int value;
26.1788 + Dummy() : value(0) {}
26.1789 + Dummy(int _v) : value(_v) {}
26.1790 + };
26.1791 +
26.1792 + void constraints() {
26.1793 + checkConcept<MappableUGraphComponent<Base>, _Graph>();
26.1794 +
26.1795 + { // int map test
26.1796 + typedef typename _Graph::template ANodeMap<int> IntANodeMap;
26.1797 + checkConcept<GraphMap<_Graph, typename _Graph::ANode, int>,
26.1798 + IntANodeMap >();
26.1799 + } { // bool map test
26.1800 + typedef typename _Graph::template ANodeMap<bool> BoolANodeMap;
26.1801 + checkConcept<GraphMap<_Graph, typename _Graph::ANode, bool>,
26.1802 + BoolANodeMap >();
26.1803 + } { // Dummy map test
26.1804 + typedef typename _Graph::template ANodeMap<Dummy> DummyANodeMap;
26.1805 + checkConcept<GraphMap<_Graph, typename _Graph::ANode, Dummy>,
26.1806 + DummyANodeMap >();
26.1807 + }
26.1808 + }
26.1809 +
26.1810 + _Graph& graph;
26.1811 + };
26.1812 + };
26.1813 +
26.1814 +
26.1815 + /// \brief An empty extendable graph class.
26.1816 + ///
26.1817 + /// This class provides beside the core graph features graph
26.1818 + /// extendable interface for the graph structure. The main
26.1819 + /// difference between the base and this interface is that the
26.1820 + /// graph alterations should handled already on this level.
26.1821 + template <typename _Base = BaseGraphComponent>
26.1822 + class ExtendableGraphComponent : public _Base {
26.1823 + public:
26.1824 + typedef _Base Base;
26.1825 +
26.1826 + typedef typename _Base::Node Node;
26.1827 + typedef typename _Base::Edge Edge;
26.1828 +
26.1829 + /// \brief Adds a new node to the graph.
26.1830 + ///
26.1831 + /// Adds a new node to the graph.
26.1832 + ///
26.1833 + Node addNode() {
26.1834 + return INVALID;
26.1835 + }
26.1836 +
26.1837 + /// \brief Adds a new edge connects the given two nodes.
26.1838 + ///
26.1839 + /// Adds a new edge connects the the given two nodes.
26.1840 + Edge addEdge(const Node&, const Node&) {
26.1841 + return INVALID;
26.1842 + }
26.1843 +
26.1844 + template <typename _Graph>
26.1845 + struct Constraints {
26.1846 + void constraints() {
26.1847 + checkConcept<Base, _Graph>();
26.1848 + typename _Graph::Node node_a, node_b;
26.1849 + node_a = graph.addNode();
26.1850 + node_b = graph.addNode();
26.1851 + typename _Graph::Edge edge;
26.1852 + edge = graph.addEdge(node_a, node_b);
26.1853 + }
26.1854 +
26.1855 + _Graph& graph;
26.1856 + };
26.1857 + };
26.1858 +
26.1859 + /// \brief An empty extendable base undirected graph class.
26.1860 + ///
26.1861 + /// This class provides beside the core undirected graph features
26.1862 + /// core undircted graph extend interface for the graph structure.
26.1863 + /// The main difference between the base and this interface is
26.1864 + /// that the graph alterations should handled already on this
26.1865 + /// level.
26.1866 + template <typename _Base = BaseUGraphComponent>
26.1867 + class ExtendableUGraphComponent : public _Base {
26.1868 + public:
26.1869 +
26.1870 + typedef _Base Base;
26.1871 + typedef typename _Base::Node Node;
26.1872 + typedef typename _Base::UEdge UEdge;
26.1873 +
26.1874 + /// \brief Adds a new node to the graph.
26.1875 + ///
26.1876 + /// Adds a new node to the graph.
26.1877 + ///
26.1878 + Node addNode() {
26.1879 + return INVALID;
26.1880 + }
26.1881 +
26.1882 + /// \brief Adds a new edge connects the given two nodes.
26.1883 + ///
26.1884 + /// Adds a new edge connects the the given two nodes.
26.1885 + UEdge addEdge(const Node&, const Node&) {
26.1886 + return INVALID;
26.1887 + }
26.1888 +
26.1889 + template <typename _Graph>
26.1890 + struct Constraints {
26.1891 + void constraints() {
26.1892 + checkConcept<Base, _Graph>();
26.1893 + typename _Graph::Node node_a, node_b;
26.1894 + node_a = graph.addNode();
26.1895 + node_b = graph.addNode();
26.1896 + typename _Graph::UEdge uedge;
26.1897 + uedge = graph.addUEdge(node_a, node_b);
26.1898 + }
26.1899 +
26.1900 + _Graph& graph;
26.1901 + };
26.1902 + };
26.1903 +
26.1904 + /// \brief An empty extendable base undirected graph class.
26.1905 + ///
26.1906 + /// This class provides beside the core bipartite undirected graph
26.1907 + /// features core undircted graph extend interface for the graph
26.1908 + /// structure. The main difference between the base and this
26.1909 + /// interface is that the graph alterations should handled already
26.1910 + /// on this level.
26.1911 + template <typename _Base = BaseBpUGraphComponent>
26.1912 + class ExtendableBpUGraphComponent
26.1913 + : public ExtendableUGraphComponent<_Base> {
26.1914 +
26.1915 + typedef _Base Base;
26.1916 +
26.1917 + template <typename _Graph>
26.1918 + struct Constraints {
26.1919 + void constraints() {
26.1920 + checkConcept<ExtendableUGraphComponent<Base>, _Graph>();
26.1921 + }
26.1922 + };
26.1923 + };
26.1924 +
26.1925 + /// \brief An empty erasable graph class.
26.1926 + ///
26.1927 + /// This class provides beside the core graph features core erase
26.1928 + /// functions for the graph structure. The main difference between
26.1929 + /// the base and this interface is that the graph alterations
26.1930 + /// should handled already on this level.
26.1931 + template <typename _Base = BaseGraphComponent>
26.1932 + class ErasableGraphComponent : public _Base {
26.1933 + public:
26.1934 +
26.1935 + typedef _Base Base;
26.1936 + typedef typename Base::Node Node;
26.1937 + typedef typename Base::Edge Edge;
26.1938 +
26.1939 + /// \brief Erase a node from the graph.
26.1940 + ///
26.1941 + /// Erase a node from the graph. This function should
26.1942 + /// erase all edges connecting to the node.
26.1943 + void erase(const Node&) {}
26.1944 +
26.1945 + /// \brief Erase an edge from the graph.
26.1946 + ///
26.1947 + /// Erase an edge from the graph.
26.1948 + ///
26.1949 + void erase(const Edge&) {}
26.1950 +
26.1951 + template <typename _Graph>
26.1952 + struct Constraints {
26.1953 + void constraints() {
26.1954 + checkConcept<Base, _Graph>();
26.1955 + typename _Graph::Node node;
26.1956 + graph.erase(node);
26.1957 + typename _Graph::Edge edge;
26.1958 + graph.erase(edge);
26.1959 + }
26.1960 +
26.1961 + _Graph& graph;
26.1962 + };
26.1963 + };
26.1964 +
26.1965 + /// \brief An empty erasable base undirected graph class.
26.1966 + ///
26.1967 + /// This class provides beside the core undirected graph features
26.1968 + /// core erase functions for the undirceted graph structure. The
26.1969 + /// main difference between the base and this interface is that
26.1970 + /// the graph alterations should handled already on this level.
26.1971 + template <typename _Base = BaseUGraphComponent>
26.1972 + class ErasableUGraphComponent : public _Base {
26.1973 + public:
26.1974 +
26.1975 + typedef _Base Base;
26.1976 + typedef typename Base::Node Node;
26.1977 + typedef typename Base::UEdge UEdge;
26.1978 +
26.1979 + /// \brief Erase a node from the graph.
26.1980 + ///
26.1981 + /// Erase a node from the graph. This function should erase
26.1982 + /// edges connecting to the node.
26.1983 + void erase(const Node&) {}
26.1984 +
26.1985 + /// \brief Erase an edge from the graph.
26.1986 + ///
26.1987 + /// Erase an edge from the graph.
26.1988 + ///
26.1989 + void erase(const UEdge&) {}
26.1990 +
26.1991 + template <typename _Graph>
26.1992 + struct Constraints {
26.1993 + void constraints() {
26.1994 + checkConcept<Base, _Graph>();
26.1995 + typename _Graph::Node node;
26.1996 + graph.erase(node);
26.1997 + typename _Graph::Edge edge;
26.1998 + graph.erase(edge);
26.1999 + }
26.2000 +
26.2001 + _Graph& graph;
26.2002 + };
26.2003 + };
26.2004 +
26.2005 + /// \brief An empty erasable base bipartite undirected graph class.
26.2006 + ///
26.2007 + /// This class provides beside the core bipartite undirected graph
26.2008 + /// features core erase functions for the undirceted graph
26.2009 + /// structure. The main difference between the base and this
26.2010 + /// interface is that the graph alterations should handled already
26.2011 + /// on this level.
26.2012 + template <typename _Base = BaseBpUGraphComponent>
26.2013 + class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> {
26.2014 + public:
26.2015 +
26.2016 + typedef _Base Base;
26.2017 +
26.2018 + template <typename _Graph>
26.2019 + struct Constraints {
26.2020 + void constraints() {
26.2021 + checkConcept<ErasableUGraphComponent<Base>, _Graph>();
26.2022 + }
26.2023 + };
26.2024 + };
26.2025 +
26.2026 + /// \brief An empty clearable base graph class.
26.2027 + ///
26.2028 + /// This class provides beside the core graph features core clear
26.2029 + /// functions for the graph structure. The main difference between
26.2030 + /// the base and this interface is that the graph alterations
26.2031 + /// should handled already on this level.
26.2032 + template <typename _Base = BaseGraphComponent>
26.2033 + class ClearableGraphComponent : public _Base {
26.2034 + public:
26.2035 +
26.2036 + typedef _Base Base;
26.2037 +
26.2038 + /// \brief Erase all nodes and edges from the graph.
26.2039 + ///
26.2040 + /// Erase all nodes and edges from the graph.
26.2041 + ///
26.2042 + void clear() {}
26.2043 +
26.2044 + template <typename _Graph>
26.2045 + struct Constraints {
26.2046 + void constraints() {
26.2047 + checkConcept<Base, _Graph>();
26.2048 + graph.clear();
26.2049 + }
26.2050 +
26.2051 + _Graph graph;
26.2052 + };
26.2053 + };
26.2054 +
26.2055 + /// \brief An empty clearable base undirected graph class.
26.2056 + ///
26.2057 + /// This class provides beside the core undirected graph features
26.2058 + /// core clear functions for the undirected graph structure. The
26.2059 + /// main difference between the base and this interface is that
26.2060 + /// the graph alterations should handled already on this level.
26.2061 + template <typename _Base = BaseUGraphComponent>
26.2062 + class ClearableUGraphComponent : public ClearableUGraphComponent<_Base> {
26.2063 + public:
26.2064 +
26.2065 + typedef _Base Base;
26.2066 +
26.2067 + template <typename _Graph>
26.2068 + struct Constraints {
26.2069 + void constraints() {
26.2070 + checkConcept<ClearableUGraphComponent<Base>, _Graph>();
26.2071 + }
26.2072 +
26.2073 + _Graph graph;
26.2074 + };
26.2075 + };
26.2076 +
26.2077 + /// \brief An empty clearable base bipartite undirected graph
26.2078 + /// class.
26.2079 + ///
26.2080 + /// This class provides beside the core bipartite undirected graph
26.2081 + /// features core clear functions for the undirected graph
26.2082 + /// structure. The main difference between the base and this
26.2083 + /// interface is that the graph alterations should handled already
26.2084 + /// on this level.
26.2085 + template <typename _Base = BaseUGraphComponent>
26.2086 + class ClearableBpUGraphComponent
26.2087 + : public ClearableBpUGraphComponent<_Base> {
26.2088 + public:
26.2089 +
26.2090 + typedef _Base Base;
26.2091 +
26.2092 + template <typename _Graph>
26.2093 + struct Constraints {
26.2094 + void constraints() {
26.2095 + checkConcept<ClearableBpUGraphComponent<Base>, _Graph>();
26.2096 + }
26.2097 +
26.2098 + };
26.2099 +
26.2100 + };
26.2101 +
26.2102 + }
26.2103 +
26.2104 +}
26.2105 +
26.2106 +#endif
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/lemon/concepts/heap.h Tue Oct 24 17:19:16 2006 +0000
27.3 @@ -0,0 +1,223 @@
27.4 +/* -*- C++ -*-
27.5 + *
27.6 + * This file is a part of LEMON, a generic C++ optimization library
27.7 + *
27.8 + * Copyright (C) 2003-2006
27.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
27.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
27.11 + *
27.12 + * Permission to use, modify and distribute this software is granted
27.13 + * provided that this copyright notice appears in all copies. For
27.14 + * precise terms see the accompanying LICENSE file.
27.15 + *
27.16 + * This software is provided "AS IS" with no warranty of any kind,
27.17 + * express or implied, and with no claim as to its suitability for any
27.18 + * purpose.
27.19 + *
27.20 + */
27.21 +
27.22 +///\ingroup concept
27.23 +///\file
27.24 +///\brief Classes for representing heaps.
27.25 +///
27.26 +
27.27 +#ifndef LEMON_CONCEPT_HEAP_H
27.28 +#define LEMON_CONCEPT_HEAP_H
27.29 +
27.30 +#include <lemon/bits/invalid.h>
27.31 +
27.32 +namespace lemon {
27.33 + namespace concepts {
27.34 + /// \addtogroup concept
27.35 + /// @{
27.36 +
27.37 +
27.38 + /// \brief A concept structure describes the main interface of heaps.
27.39 + ///
27.40 + /// A concept structure describes the main interface of heaps.
27.41 + ///
27.42 + template <typename Item, typename Prio, typename ItemIntMap>
27.43 + class Heap {
27.44 + public:
27.45 +
27.46 +
27.47 + /// \brief Type to represent the items states.
27.48 + ///
27.49 + /// Each Item element have a state associated to it. It may be "in heap",
27.50 + /// "pre heap" or "post heap". The later two are indifferent from the
27.51 + /// heap's point of view, but may be useful to the user.
27.52 + ///
27.53 + /// The ItemIntMap _should_ be initialized in such way, that it maps
27.54 + /// PRE_HEAP (-1) to any element to be put in the heap...
27.55 + enum state_enum {
27.56 + IN_HEAP = 0,
27.57 + PRE_HEAP = -1,
27.58 + POST_HEAP = -2
27.59 + };
27.60 +
27.61 + /// \brief The constructor.
27.62 + ///
27.63 + /// The constructor.
27.64 + /// \param _iim should be given to the constructor, since it is used
27.65 + /// internally to handle the cross references. The value of the map
27.66 + /// should be PRE_HEAP (-1) for each element.
27.67 + explicit Heap(ItemIntMap &_iim) {}
27.68 +
27.69 + /// \brief The number of items stored in the heap.
27.70 + ///
27.71 + /// Returns the number of items stored in the heap.
27.72 + int size() const { return 0; }
27.73 +
27.74 + /// \brief Checks if the heap stores no items.
27.75 + ///
27.76 + /// Returns \c true if and only if the heap stores no items.
27.77 + bool empty() const { return false; }
27.78 +
27.79 + /// \brief Makes empty this heap.
27.80 + ///
27.81 + /// Makes this heap empty.
27.82 + void clear();
27.83 +
27.84 + /// \brief Insert an item into the heap with the given heap.
27.85 + ///
27.86 + /// Adds \c i to the heap with priority \c p.
27.87 + /// \param i The item to insert.
27.88 + /// \param p The priority of the item.
27.89 + void push(const Item &i, const Prio &p) {}
27.90 +
27.91 + /// \brief Returns the item with minimum priority.
27.92 + ///
27.93 + /// This method returns the item with minimum priority.
27.94 + /// \pre The heap must be nonempty.
27.95 + Item top() const {}
27.96 +
27.97 + /// \brief Returns the minimum priority.
27.98 + ///
27.99 + /// It returns the minimum priority.
27.100 + /// \pre The heap must be nonempty.
27.101 + Prio prio() const {}
27.102 +
27.103 + /// \brief Deletes the item with minimum priority.
27.104 + ///
27.105 + /// This method deletes the item with minimum priority.
27.106 + /// \pre The heap must be non-empty.
27.107 + void pop() {}
27.108 +
27.109 + /// \brief Deletes \c i from the heap.
27.110 + ///
27.111 + /// This method deletes item \c i from the heap, if \c i was
27.112 + /// already stored in the heap.
27.113 + /// \param i The item to erase.
27.114 + void erase(const Item &i) {}
27.115 +
27.116 + /// \brief Returns the priority of \c i.
27.117 + ///
27.118 + /// This function returns the priority of item \c i.
27.119 + /// \pre \c i must be in the heap.
27.120 + /// \param i The item.
27.121 + Prio operator[](const Item &i) const {}
27.122 +
27.123 + /// \brief \c i gets to the heap with priority \c p independently
27.124 + /// if \c i was already there.
27.125 + ///
27.126 + /// This method calls \ref push(\c i, \c p) if \c i is not stored
27.127 + /// in the heap and sets the priority of \c i to \c p otherwise.
27.128 + /// It may throw an \e UnderFlowPriorityException.
27.129 + /// \param i The item.
27.130 + /// \param p The priority.
27.131 + void set(const Item &i, const Prio &p) {}
27.132 +
27.133 + /// \brief Decreases the priority of \c i to \c p.
27.134 + ///
27.135 + /// This method decreases the priority of item \c i to \c p.
27.136 + /// \pre \c i must be stored in the heap with priority at least \c p.
27.137 + /// \param i The item.
27.138 + /// \param p The priority.
27.139 + void decrease(const Item &i, const Prio &p) {}
27.140 +
27.141 + /// \brief Increases the priority of \c i to \c p.
27.142 + ///
27.143 + /// This method sets the priority of item \c i to \c p.
27.144 + /// \pre \c i must be stored in the heap with priority at most \c
27.145 + /// p relative to \c Compare.
27.146 + /// \param i The item.
27.147 + /// \param p The priority.
27.148 + void increase(const Item &i, const Prio &p) {}
27.149 +
27.150 + /// \brief Returns if \c item is in, has already been in, or has
27.151 + /// never been in the heap.
27.152 + ///
27.153 + /// This method returns PRE_HEAP if \c item has never been in the
27.154 + /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
27.155 + /// otherwise. In the latter case it is possible that \c item will
27.156 + /// get back to the heap again.
27.157 + /// \param i The item.
27.158 + state_enum state(const Item &i) const {}
27.159 +
27.160 + /// \brief Sets the state of the \c item in the heap.
27.161 + ///
27.162 + /// Sets the state of the \c item in the heap. It can be used to
27.163 + /// manually clear the heap when it is important to achive the
27.164 + /// better time complexity.
27.165 + /// \param i The item.
27.166 + /// \param st The state. It should not be \c IN_HEAP.
27.167 + void state(const Item& i, state_enum st) {}
27.168 +
27.169 +
27.170 + template <typename _Heap>
27.171 + struct Constraints {
27.172 + public:
27.173 +
27.174 + void constraints() {
27.175 + Item item;
27.176 + Prio prio;
27.177 +
27.178 + item=Item();
27.179 + prio=Prio();
27.180 +
27.181 + ignore_unused_variable_warning(item);
27.182 + ignore_unused_variable_warning(prio);
27.183 +
27.184 + typedef typename _Heap::state_enum state_enum;
27.185 + state_enum state;
27.186 +
27.187 + ignore_unused_variable_warning(state);
27.188 +
27.189 + _Heap heap1 = _Heap(map);
27.190 +
27.191 + ignore_unused_variable_warning(heap1);
27.192 +
27.193 + heap.push(item, prio);
27.194 +
27.195 + prio = heap.prio();
27.196 + item = heap.top();
27.197 +
27.198 + heap.pop();
27.199 +
27.200 + heap.set(item, prio);
27.201 + heap.decrease(item, prio);
27.202 + heap.increase(item, prio);
27.203 + prio = heap[item];
27.204 +
27.205 + heap.erase(item);
27.206 +
27.207 + state = heap.state(item);
27.208 +
27.209 + state = _Heap::PRE_HEAP;
27.210 + state = _Heap::IN_HEAP;
27.211 + state = _Heap::POST_HEAP;
27.212 +
27.213 + heap.clear();
27.214 + }
27.215 +
27.216 + _Heap& heap;
27.217 + ItemIntMap& map;
27.218 +
27.219 + Constraints() : heap(0), map(0) {}
27.220 + };
27.221 + };
27.222 +
27.223 + /// @}
27.224 + } // namespace lemon
27.225 +}
27.226 +#endif // LEMON_CONCEPT_PATH_H
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/lemon/concepts/maps.h Tue Oct 24 17:19:16 2006 +0000
28.3 @@ -0,0 +1,192 @@
28.4 +/* -*- C++ -*-
28.5 + *
28.6 + * This file is a part of LEMON, a generic C++ optimization library
28.7 + *
28.8 + * Copyright (C) 2003-2006
28.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
28.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
28.11 + *
28.12 + * Permission to use, modify and distribute this software is granted
28.13 + * provided that this copyright notice appears in all copies. For
28.14 + * precise terms see the accompanying LICENSE file.
28.15 + *
28.16 + * This software is provided "AS IS" with no warranty of any kind,
28.17 + * express or implied, and with no claim as to its suitability for any
28.18 + * purpose.
28.19 + *
28.20 + */
28.21 +
28.22 +#ifndef LEMON_CONCEPT_MAPS_H
28.23 +#define LEMON_CONCEPT_MAPS_H
28.24 +
28.25 +#include <lemon/bits/utility.h>
28.26 +#include <lemon/concept_check.h>
28.27 +
28.28 +///\ingroup concept
28.29 +///\file
28.30 +///\brief Map concepts checking classes for testing and documenting.
28.31 +
28.32 +namespace lemon {
28.33 +
28.34 + namespace concepts {
28.35 +
28.36 + /// \addtogroup concept
28.37 + /// @{
28.38 +
28.39 + /// Readable map concept
28.40 + template<typename K, typename T>
28.41 + class ReadMap
28.42 + {
28.43 + public:
28.44 + /// Map's key type.
28.45 + typedef K Key;
28.46 + /// Map's value type. (The type of objects associated with the keys).
28.47 + typedef T Value;
28.48 +
28.49 + // \bug Value don't need to be default constructible.
28.50 + /// Returns the value associated with a key.
28.51 + Value operator[](const Key &) const {return Value();}
28.52 +
28.53 + template<typename _ReadMap>
28.54 + struct Constraints {
28.55 +
28.56 + void constraints() {
28.57 + Value val = m[key];
28.58 + val = m[key];
28.59 + typename _ReadMap::Value own_val = m[own_key];
28.60 + own_val = m[own_key];
28.61 +
28.62 + ignore_unused_variable_warning(val);
28.63 + ignore_unused_variable_warning(own_val);
28.64 + ignore_unused_variable_warning(key);
28.65 + }
28.66 + Key& key;
28.67 + typename _ReadMap::Key& own_key;
28.68 + _ReadMap& m;
28.69 + };
28.70 +
28.71 + };
28.72 +
28.73 +
28.74 + /// Writable map concept
28.75 + template<typename K, typename T>
28.76 + class WriteMap
28.77 + {
28.78 + public:
28.79 + /// Map's key type.
28.80 + typedef K Key;
28.81 + /// Map's value type. (The type of objects associated with the keys).
28.82 + typedef T Value;
28.83 +
28.84 + /// Sets the value associated with a key.
28.85 + void set(const Key &,const Value &) {}
28.86 +
28.87 + ///Default constructor
28.88 + WriteMap() {}
28.89 +
28.90 + template <typename _WriteMap>
28.91 + struct Constraints {
28.92 + void constraints() {
28.93 + // No constraints for constructor.
28.94 + m.set(key, val);
28.95 + m.set(own_key, own_val);
28.96 + ignore_unused_variable_warning(key);
28.97 + ignore_unused_variable_warning(val);
28.98 + ignore_unused_variable_warning(own_key);
28.99 + ignore_unused_variable_warning(own_val);
28.100 + }
28.101 +
28.102 + Value& val;
28.103 + typename _WriteMap::Value own_val;
28.104 + Key& key;
28.105 + typename _WriteMap::Key& own_key;
28.106 + _WriteMap& m;
28.107 +
28.108 + };
28.109 + };
28.110 +
28.111 + ///Read/Writable map concept
28.112 + template<typename K, typename T>
28.113 + class ReadWriteMap : public ReadMap<K,T>,
28.114 + public WriteMap<K,T>
28.115 + {
28.116 + public:
28.117 + /// Map's key type.
28.118 + typedef K Key;
28.119 + /// Map's value type. (The type of objects associated with the keys).
28.120 + typedef T Value;
28.121 +
28.122 + /// Returns the value associated with a key.
28.123 + Value operator[](const Key &) const {return Value();}
28.124 + /// Sets the value associated with a key.
28.125 + void set(const Key & ,const Value &) {}
28.126 +
28.127 + template<typename _ReadWriteMap>
28.128 + struct Constraints {
28.129 + void constraints() {
28.130 + checkConcept<ReadMap<K, T>, _ReadWriteMap >();
28.131 + checkConcept<WriteMap<K, T>, _ReadWriteMap >();
28.132 + }
28.133 + };
28.134 + };
28.135 +
28.136 +
28.137 + ///Dereferable map concept
28.138 + template<typename K, typename T, typename R, typename CR>
28.139 + class ReferenceMap : public ReadWriteMap<K,T>
28.140 + {
28.141 + public:
28.142 + /// Tag for reference maps.
28.143 + typedef True ReferenceMapTag;
28.144 + /// Map's key type.
28.145 + typedef K Key;
28.146 + /// Map's value type. (The type of objects associated with the keys).
28.147 + typedef T Value;
28.148 + /// Map's reference type.
28.149 + typedef R Reference;
28.150 + /// Map's const reference type.
28.151 + typedef CR ConstReference;
28.152 +
28.153 + protected:
28.154 + Value tmp;
28.155 + public:
28.156 +
28.157 + ///Returns a reference to the value associated to a key.
28.158 + Reference operator[](const Key &) { return tmp; }
28.159 + ///Returns a const reference to the value associated to a key.
28.160 + ConstReference operator[](const Key &) const
28.161 + { return tmp; }
28.162 + /// Sets the value associated with a key.
28.163 + void set(const Key &k,const Value &t) { operator[](k)=t; }
28.164 +
28.165 + // \todo rethink this concept
28.166 + template<typename _ReferenceMap>
28.167 + struct ReferenceMapConcept {
28.168 +
28.169 + void constraints() {
28.170 + checkConcept<ReadWriteMap, _ReferenceMap >();
28.171 + m[key] = val;
28.172 + val = m[key];
28.173 + m[key] = ref;
28.174 + ref = m[key];
28.175 + m[own_key] = own_val;
28.176 + own_val = m[own_key];
28.177 + m[own_key] = own_ref;
28.178 + own_ref = m[own_key];
28.179 + }
28.180 +
28.181 + typename _ReferenceMap::Key& own_key;
28.182 + typename _ReferenceMap::Value& own_val;
28.183 + typename _ReferenceMap::Reference& own_ref;
28.184 + Key& key;
28.185 + Value& val;
28.186 + Reference& ref;
28.187 + _ReferenceMap& m;
28.188 + };
28.189 + };
28.190 +
28.191 + // @}
28.192 +
28.193 + } //namespace concepts
28.194 +} //namespace lemon
28.195 +#endif // LEMON_CONCEPT_MAPS_H
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/lemon/concepts/matrix_maps.h Tue Oct 24 17:19:16 2006 +0000
29.3 @@ -0,0 +1,207 @@
29.4 +/* -*- C++ -*-
29.5 + *
29.6 + * This file is a part of LEMON, a generic C++ optimization library
29.7 + *
29.8 + * Copyright (C) 2003-2006
29.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
29.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
29.11 + *
29.12 + * Permission to use, modify and distribute this software is granted
29.13 + * provided that this copyright notice appears in all copies. For
29.14 + * precise terms see the accompanying LICENSE file.
29.15 + *
29.16 + * This software is provided "AS IS" with no warranty of any kind,
29.17 + * express or implied, and with no claim as to its suitability for any
29.18 + * purpose.
29.19 + *
29.20 + */
29.21 +
29.22 +#ifndef LEMON_CONCEPT_MATRIX_MAPS_H
29.23 +#define LEMON_CONCEPT_MATRIX_MAPS_H
29.24 +
29.25 +#include <lemon/bits/utility.h>
29.26 +#include <lemon/concept_check.h>
29.27 +
29.28 +///\ingroup concept
29.29 +///\file
29.30 +///\brief MatrixMap concepts checking classes for testing and documenting.
29.31 +
29.32 +namespace lemon {
29.33 +
29.34 + namespace concepts {
29.35 +
29.36 + /// \addtogroup concept
29.37 + /// @{
29.38 +
29.39 + /// Readable matrix map concept
29.40 + template <typename K1, typename K2, typename V>
29.41 + class ReadMatrixMap
29.42 + {
29.43 + public:
29.44 + /// Map's first key type.
29.45 + typedef K1 FirstKey;
29.46 + /// Map's second key type.
29.47 + typedef K2 SecondKey;
29.48 + /// \brief Map's value type.
29.49 + /// (The type of objects associated with the pairs of keys).
29.50 + typedef V Value;
29.51 +
29.52 + // \bug Value don't need to be default constructible.
29.53 + /// Returns the value associated with a key.
29.54 + Value operator()(const FirstKey&, const SecondKey&) const {
29.55 + return Value();
29.56 + }
29.57 +
29.58 + template <typename _ReadMatrixMap>
29.59 + struct Constraints {
29.60 +
29.61 + void constraints() {
29.62 + Value val = m(first_key, second_key);
29.63 + val = m(first_key, second_key);
29.64 + typename _ReadMatrixMap::Value own_val =
29.65 + m(own_first_key, own_second_key);
29.66 + own_val = m(own_first_key, own_second_key);
29.67 + ignore_unused_variable_warning(val);
29.68 + ignore_unused_variable_warning(own_val);
29.69 + }
29.70 +
29.71 + FirstKey& first_key;
29.72 + SecondKey& second_key;
29.73 + typename _ReadMatrixMap::FirstKey& own_first_key;
29.74 + typename _ReadMatrixMap::SecondKey& own_second_key;
29.75 + _ReadMatrixMap& m;
29.76 + };
29.77 +
29.78 + };
29.79 +
29.80 +
29.81 + /// Writable map concept
29.82 + template <typename K1, typename K2, typename V>
29.83 + class WriteMatrixMap {
29.84 + public:
29.85 + /// Map's first key type.
29.86 + typedef K1 FirstKey;
29.87 + /// Map's second key type.
29.88 + typedef K2 SecondKey;
29.89 + /// \brief Map's value type.
29.90 + /// (The type of objects associated with the pairs of keys).
29.91 + typedef V Value;
29.92 +
29.93 + /// Sets the value associated with the pair of keys.
29.94 + void set(const FirstKey&, const SecondKey& ,const Value&) {}
29.95 +
29.96 + template <typename _WriteMatrixMap>
29.97 + struct Constraints {
29.98 + void constraints() {
29.99 + // No constraints for constructor.
29.100 + m.set(first_key, second_key, val);
29.101 + m.set(own_first_key, own_second_key, own_val);
29.102 + }
29.103 +
29.104 + Value& val;
29.105 + typename _WriteMatrixMap::Value own_val;
29.106 + FirstKey& first_key;
29.107 + SecondKey& second_key;
29.108 + typename _WriteMatrixMap::FirstKey& own_first_key;
29.109 + typename _WriteMatrixMap::SecondKey& own_second_key;
29.110 + _WriteMatrixMap& m;
29.111 +
29.112 + };
29.113 + };
29.114 +
29.115 + ///Read/Writable map concept
29.116 + template<typename K1, typename K2, typename V>
29.117 + class ReadWriteMatrixMap
29.118 + : public ReadMatrixMap<K1, K2, V>, public WriteMatrixMap<K1, K2, V> {
29.119 + public:
29.120 + /// Map's first key type.
29.121 + typedef K1 FirstKey;
29.122 + /// Map's second key type.
29.123 + typedef K2 SecondKey;
29.124 + /// \brief Map's value type.
29.125 + /// (The type of objects associated with the pairs of keys).
29.126 + typedef V Value;
29.127 +
29.128 + /// Returns the value associated with a pair of keys.
29.129 + Value operator()(const FirstKey&, const SecondKey&) const {
29.130 + return Value();
29.131 + }
29.132 + /// Sets the value associated with the pair of keys.
29.133 + void set(const FirstKey&, const SecondKey& ,const Value&) {}
29.134 +
29.135 + template<typename _ReadWriteMatrixMap>
29.136 + struct Constraints {
29.137 + void constraints() {
29.138 + checkConcept<ReadMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
29.139 + checkConcept<WriteMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
29.140 + }
29.141 + };
29.142 + };
29.143 +
29.144 +
29.145 + ///Dereferable matrix map concept
29.146 + template<typename K1, typename K2, typename V, typename R, typename CR>
29.147 + class ReferenceMatrixMap : public ReadWriteMatrixMap<K1, K2, V>
29.148 + {
29.149 + public:
29.150 + /// Tag for reference maps.
29.151 + typedef True ReferenceMapTag;
29.152 + /// Map's first key type.
29.153 + typedef K1 FirstKey;
29.154 + /// Map's second key type.
29.155 + typedef K1 SecondKey;
29.156 + /// Map's value type. (The type of objects associated with the keys).
29.157 + typedef V Value;
29.158 + /// Map's reference type.
29.159 + typedef R Reference;
29.160 + /// Map's const reference type.
29.161 + typedef CR ConstReference;
29.162 +
29.163 + protected:
29.164 + Value tmp;
29.165 + public:
29.166 +
29.167 + ///Returns a reference to the value associated to a pair of keys.
29.168 + Reference operator()(const FirstKey&, const SecondKey&) {
29.169 + return tmp;
29.170 + }
29.171 + ///Returns a const reference to the value associated to a pair of keys.
29.172 + ConstReference operator()(const FirstKey&, const SecondKey&) const {
29.173 + return tmp;
29.174 + }
29.175 + /// Sets the value associated with the pair of keys.
29.176 + void set(const FirstKey&, const SecondKey& ,const Value&) {}
29.177 +
29.178 + // \todo rethink this concept
29.179 + template<typename _ReferenceMatrixMap>
29.180 + struct ReferenceMapConcept {
29.181 +
29.182 + void constraints() {
29.183 + checkConcept<ReadWriteMatrixMap, _ReferenceMatrixMap >();
29.184 + m(first_key, second_key) = val;
29.185 + val = m(first_key, second_key);
29.186 + m(first_key, second_key) = ref;
29.187 + ref = m(first_key, second_key);
29.188 + m(own_first_key, own_second_key) = own_val;
29.189 + own_val = m(own_first_key, own_second_key);
29.190 + m(own_first_key, own_second_key) = own_ref;
29.191 + own_ref = m(own_first_key, own_second_key);
29.192 + }
29.193 +
29.194 + typename _ReferenceMatrixMap::Key& own_first_key;
29.195 + typename _ReferenceMatrixMap::Key& own_second_key;
29.196 + typename _ReferenceMatrixMap::Value& own_val;
29.197 + typename _ReferenceMatrixMap::Reference& own_ref;
29.198 + FirstKey& first_key;
29.199 + SecondKey& second_key;
29.200 + Value& val;
29.201 + Reference& ref;
29.202 + _ReferenceMatrixMap& m;
29.203 + };
29.204 + };
29.205 +
29.206 + // @}
29.207 +
29.208 + } //namespace concepts
29.209 +} //namespace lemon
29.210 +#endif // LEMON_CONCEPT_MATRIX_MAPS_H
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/lemon/concepts/path.h Tue Oct 24 17:19:16 2006 +0000
30.3 @@ -0,0 +1,294 @@
30.4 +/* -*- C++ -*-
30.5 + *
30.6 + * This file is a part of LEMON, a generic C++ optimization library
30.7 + *
30.8 + * Copyright (C) 2003-2006
30.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
30.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
30.11 + *
30.12 + * Permission to use, modify and distribute this software is granted
30.13 + * provided that this copyright notice appears in all copies. For
30.14 + * precise terms see the accompanying LICENSE file.
30.15 + *
30.16 + * This software is provided "AS IS" with no warranty of any kind,
30.17 + * express or implied, and with no claim as to its suitability for any
30.18 + * purpose.
30.19 + *
30.20 + */
30.21 +
30.22 +///\ingroup concept
30.23 +///\file
30.24 +///\brief Classes for representing paths in graphs.
30.25 +///
30.26 +///\todo Iterators have obsolete style
30.27 +
30.28 +#ifndef LEMON_CONCEPT_PATH_H
30.29 +#define LEMON_CONCEPT_PATH_H
30.30 +
30.31 +#include <lemon/bits/invalid.h>
30.32 +#include <lemon/concept_check.h>
30.33 +
30.34 +namespace lemon {
30.35 + namespace concepts {
30.36 + /// \addtogroup concept
30.37 + /// @{
30.38 +
30.39 +
30.40 + //! \brief A skeleton structure for representing directed paths in a graph.
30.41 + //!
30.42 + //! A skeleton structure for representing directed paths in a graph.
30.43 + //! \param _Graph The graph type in which the path is.
30.44 + //!
30.45 + //! In a sense, the path can be treated as a graph, for it has \c NodeIt
30.46 + //! and \c EdgeIt with the same usage. These types converts to the \c Node
30.47 + //! and \c Edge of the original graph.
30.48 + template<typename _Graph>
30.49 + class Path {
30.50 + public:
30.51 +
30.52 + /// Type of the underlying graph.
30.53 + typedef _Graph Graph;
30.54 + /// Edge type of the underlying graph.
30.55 + typedef typename Graph::Edge Edge;
30.56 + /// Node type of the underlying graph.
30.57 + typedef typename Graph::Node Node;
30.58 +
30.59 + class NodeIt;
30.60 + class EdgeIt;
30.61 +
30.62 + /// \param _g The graph in which the path is.
30.63 + ///
30.64 + Path(const Graph &_g) {
30.65 + ignore_unused_variable_warning(_g);
30.66 + }
30.67 +
30.68 + /// Length of the path ie. the number of edges in the path.
30.69 + int length() const {return 0;}
30.70 +
30.71 + /// Returns whether the path is empty.
30.72 + bool empty() const { return true;}
30.73 +
30.74 + /// Resets the path to an empty path.
30.75 + void clear() {}
30.76 +
30.77 + /// \brief Starting point of the path.
30.78 + ///
30.79 + /// Starting point of the path.
30.80 + /// Returns INVALID if the path is empty.
30.81 + Node target() const {return INVALID;}
30.82 + /// \brief End point of the path.
30.83 + ///
30.84 + /// End point of the path.
30.85 + /// Returns INVALID if the path is empty.
30.86 + Node source() const {return INVALID;}
30.87 +
30.88 + /// \brief The target of an edge.
30.89 + ///
30.90 + /// Returns node iterator pointing to the target node of the
30.91 + /// given edge iterator.
30.92 + NodeIt target(const EdgeIt&) const {return INVALID;}
30.93 +
30.94 + /// \brief The source of an edge.
30.95 + ///
30.96 + /// Returns node iterator pointing to the source node of the
30.97 + /// given edge iterator.
30.98 + NodeIt source(const EdgeIt&) const {return INVALID;}
30.99 +
30.100 + /// \brief Iterator class to iterate on the nodes of the paths
30.101 + ///
30.102 + /// This class is used to iterate on the nodes of the paths
30.103 + ///
30.104 + /// Of course it converts to Graph::Node.
30.105 + class NodeIt {
30.106 + public:
30.107 + /// Default constructor
30.108 + NodeIt() {}
30.109 + /// Invalid constructor
30.110 + NodeIt(Invalid) {}
30.111 + /// Constructor with starting point
30.112 + NodeIt(const Path &) {}
30.113 +
30.114 + ///Conversion to Graph::Node
30.115 + operator Node() const { return INVALID; }
30.116 + /// Next node
30.117 + NodeIt& operator++() {return *this;}
30.118 +
30.119 + /// Comparison operator
30.120 + bool operator==(const NodeIt&) const {return true;}
30.121 + /// Comparison operator
30.122 + bool operator!=(const NodeIt&) const {return true;}
30.123 + /// Comparison operator
30.124 + bool operator<(const NodeIt&) const {return false;}
30.125 +
30.126 + };
30.127 +
30.128 + /// \brief Iterator class to iterate on the edges of the paths
30.129 + ///
30.130 + /// This class is used to iterate on the edges of the paths
30.131 + ///
30.132 + /// Of course it converts to Graph::Edge
30.133 + class EdgeIt {
30.134 + public:
30.135 + /// Default constructor
30.136 + EdgeIt() {}
30.137 + /// Invalid constructor
30.138 + EdgeIt(Invalid) {}
30.139 + /// Constructor with starting point
30.140 + EdgeIt(const Path &) {}
30.141 +
30.142 + operator Edge() const { return INVALID; }
30.143 +
30.144 + /// Next edge
30.145 + EdgeIt& operator++() {return *this;}
30.146 +
30.147 + /// Comparison operator
30.148 + bool operator==(const EdgeIt&) const {return true;}
30.149 + /// Comparison operator
30.150 + bool operator!=(const EdgeIt&) const {return true;}
30.151 + /// Comparison operator
30.152 + bool operator<(const EdgeIt&) const {return false;}
30.153 +
30.154 + };
30.155 +
30.156 +
30.157 + friend class Builder;
30.158 +
30.159 + /// \brief Class to build paths
30.160 + ///
30.161 + /// This class is used to fill a path with edges.
30.162 + ///
30.163 + /// You can push new edges to the front and to the back of the path in
30.164 + /// arbitrary order then you should commit these changes to the graph.
30.165 + ///
30.166 + /// While the builder is active (after the first modifying
30.167 + /// operation and until the call of \ref commit()) the
30.168 + /// underlining Path is in a "transitional" state (operations on
30.169 + /// it have undefined result).
30.170 + class Builder {
30.171 + public:
30.172 +
30.173 + /// Constructor
30.174 +
30.175 + /// Constructor
30.176 + /// \param _path the path you want to fill in.
30.177 + ///
30.178 +
30.179 + Builder(Path &_path) { ignore_unused_variable_warning(_path); }
30.180 +
30.181 + /// Sets the starting node of the path.
30.182 +
30.183 + /// Sets the starting node of the path. Edge added to the path
30.184 + /// afterwards have to be incident to this node.
30.185 + /// You \em must start building an empty path with these functions.
30.186 + /// (And you \em must \em not use it later).
30.187 + /// \sa pushFront()
30.188 + /// \sa pushBack()
30.189 + void setStartNode(const Node &) {}
30.190 +
30.191 + ///Push a new edge to the front of the path
30.192 +
30.193 + ///Push a new edge to the front of the path.
30.194 + ///If the path is empty, you \em must call \ref setStartNode() before
30.195 + ///the first use of \ref pushFront().
30.196 + void pushFront(const Edge&) {}
30.197 +
30.198 + ///Push a new edge to the back of the path
30.199 +
30.200 + ///Push a new edge to the back of the path.
30.201 + ///If the path is empty, you \em must call \ref setStartNode() before
30.202 + ///the first use of \ref pushBack().
30.203 + void pushBack(const Edge&) {}
30.204 +
30.205 + ///Commit the changes to the path.
30.206 +
30.207 + ///Commit the changes to the path.
30.208 + ///
30.209 + void commit() {}
30.210 +
30.211 + ///Reserve (front) storage for the builder in advance.
30.212 +
30.213 + ///If you know a reasonable upper bound on the number of the edges
30.214 + ///to add to the front of the path,
30.215 + ///using this function you may speed up the building.
30.216 + void reserveFront(size_t) {}
30.217 + ///Reserve (back) storage for the builder in advance.
30.218 +
30.219 + ///If you know a reasonable upper bound on the number of the edges
30.220 + ///to add to the back of the path,
30.221 + ///using this function you may speed up the building.
30.222 + void reserveBack(size_t) {}
30.223 + };
30.224 +
30.225 + template <typename _Path>
30.226 + struct Constraints {
30.227 + void constraints() {
30.228 + typedef typename _Path::Node Node;
30.229 + typedef typename _Path::NodeIt NodeIt;
30.230 + typedef typename Graph::Node GraphNode;
30.231 +
30.232 + typedef typename _Path::Edge Edge;
30.233 + typedef typename _Path::EdgeIt EdgeIt;
30.234 + typedef typename Graph::Edge GraphEdge;
30.235 +
30.236 + typedef typename _Path::Builder Builder;
30.237 +
30.238 + path = _Path(graph);
30.239 +
30.240 + bool b = cpath.empty();
30.241 + int l = cpath.length();
30.242 +
30.243 + Node gn;
30.244 + Edge ge;
30.245 + gn = cpath.source();
30.246 + gn = cpath.target();
30.247 +
30.248 + NodeIt nit;
30.249 + EdgeIt eit(INVALID);
30.250 + nit = path.source(eit);
30.251 + nit = path.target(eit);
30.252 +
30.253 + nit = NodeIt();
30.254 + nit = NodeIt(cpath);
30.255 + nit = INVALID;
30.256 + gn = nit;
30.257 + ++nit;
30.258 + b = nit == nit;
30.259 + b = nit != nit;
30.260 + b = nit < nit;
30.261 +
30.262 + eit = EdgeIt();
30.263 + eit = EdgeIt(cpath);
30.264 + eit = INVALID;
30.265 + ge = eit;
30.266 + ++eit;
30.267 + b = eit == eit;
30.268 + b = eit != eit;
30.269 + b = eit < eit;
30.270 +
30.271 + size_t st = 0;
30.272 +
30.273 + Builder builder(path);
30.274 + builder.setStartNode(gn);
30.275 + builder.pushFront(ge);
30.276 + builder.pushBack(ge);
30.277 + builder.commit();
30.278 + builder.reserveFront(st);
30.279 + builder.reserveBack(st);
30.280 +
30.281 + ignore_unused_variable_warning(l);
30.282 + ignore_unused_variable_warning(b);
30.283 + }
30.284 +
30.285 + const Graph& graph;
30.286 + const _Path& cpath;
30.287 + _Path& path;
30.288 + };
30.289 +
30.290 + };
30.291 +
30.292 + ///@}
30.293 + }
30.294 +
30.295 +} // namespace lemon
30.296 +
30.297 +#endif // LEMON_CONCEPT_PATH_H
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/lemon/concepts/ugraph.h Tue Oct 24 17:19:16 2006 +0000
31.3 @@ -0,0 +1,713 @@
31.4 +/* -*- C++ -*-
31.5 + *
31.6 + * This file is a part of LEMON, a generic C++ optimization library
31.7 + *
31.8 + * Copyright (C) 2003-2006
31.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
31.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
31.11 + *
31.12 + * Permission to use, modify and distribute this software is granted
31.13 + * provided that this copyright notice appears in all copies. For
31.14 + * precise terms see the accompanying LICENSE file.
31.15 + *
31.16 + * This software is provided "AS IS" with no warranty of any kind,
31.17 + * express or implied, and with no claim as to its suitability for any
31.18 + * purpose.
31.19 + *
31.20 + */
31.21 +
31.22 +///\ingroup graph_concepts
31.23 +///\file
31.24 +///\brief The concept of the undirected graphs.
31.25 +
31.26 +
31.27 +#ifndef LEMON_CONCEPT_UGRAPH_H
31.28 +#define LEMON_CONCEPT_UGRAPH_H
31.29 +
31.30 +#include <lemon/concepts/graph_components.h>
31.31 +#include <lemon/concepts/graph.h>
31.32 +#include <lemon/bits/utility.h>
31.33 +
31.34 +namespace lemon {
31.35 + namespace concepts {
31.36 +
31.37 + /// \addtogroup graph_concepts
31.38 + /// @{
31.39 +
31.40 +
31.41 + /// \brief Class describing the concept of Undirected Graphs.
31.42 + ///
31.43 + /// This class describes the common interface of all Undirected
31.44 + /// Graphs.
31.45 + ///
31.46 + /// As all concept describing classes it provides only interface
31.47 + /// without any sensible implementation. So any algorithm for
31.48 + /// undirected graph should compile with this class, but it will not
31.49 + /// run properly, of course.
31.50 + ///
31.51 + /// The LEMON undirected graphs also fulfill the concept of
31.52 + /// directed graphs (\ref lemon::concepts::Graph "Graph
31.53 + /// Concept"). Each undirected edges can be seen as two opposite
31.54 + /// directed edge and consequently the undirected graph can be
31.55 + /// seen as the direceted graph of these directed edges. The
31.56 + /// UGraph has the UEdge inner class for the undirected edges and
31.57 + /// the Edge type for the directed edges. The Edge type is
31.58 + /// convertible to UEdge or inherited from it so from a directed
31.59 + /// edge we can get the represented undirected edge.
31.60 + ///
31.61 + /// In the sense of the LEMON each undirected edge has a default
31.62 + /// direction (it should be in every computer implementation,
31.63 + /// because the order of undirected edge's nodes defines an
31.64 + /// orientation). With the default orientation we can define that
31.65 + /// the directed edge is forward or backward directed. With the \c
31.66 + /// direction() and \c direct() function we can get the direction
31.67 + /// of the directed edge and we can direct an undirected edge.
31.68 + ///
31.69 + /// The UEdgeIt is an iterator for the undirected edges. We can use
31.70 + /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and
31.71 + /// OutEdgeIt iterates on the same undirected edges but with opposite
31.72 + /// direction. The IncEdgeIt iterates also on the same undirected edges
31.73 + /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just
31.74 + /// to UEdge.
31.75 + class UGraph {
31.76 + public:
31.77 + /// \brief The undirected graph should be tagged by the
31.78 + /// UndirectedTag.
31.79 + ///
31.80 + /// The undirected graph should be tagged by the UndirectedTag. This
31.81 + /// tag helps the enable_if technics to make compile time
31.82 + /// specializations for undirected graphs.
31.83 + typedef True UndirectedTag;
31.84 +
31.85 + /// \brief The base type of node iterators,
31.86 + /// or in other words, the trivial node iterator.
31.87 + ///
31.88 + /// This is the base type of each node iterator,
31.89 + /// thus each kind of node iterator converts to this.
31.90 + /// More precisely each kind of node iterator should be inherited
31.91 + /// from the trivial node iterator.
31.92 + class Node {
31.93 + public:
31.94 + /// Default constructor
31.95 +
31.96 + /// @warning The default constructor sets the iterator
31.97 + /// to an undefined value.
31.98 + Node() { }
31.99 + /// Copy constructor.
31.100 +
31.101 + /// Copy constructor.
31.102 + ///
31.103 + Node(const Node&) { }
31.104 +
31.105 + /// Invalid constructor \& conversion.
31.106 +
31.107 + /// This constructor initializes the iterator to be invalid.
31.108 + /// \sa Invalid for more details.
31.109 + Node(Invalid) { }
31.110 + /// Equality operator
31.111 +
31.112 + /// Two iterators are equal if and only if they point to the
31.113 + /// same object or both are invalid.
31.114 + bool operator==(Node) const { return true; }
31.115 +
31.116 + /// Inequality operator
31.117 +
31.118 + /// \sa operator==(Node n)
31.119 + ///
31.120 + bool operator!=(Node) const { return true; }
31.121 +
31.122 + /// Artificial ordering operator.
31.123 +
31.124 + /// To allow the use of graph descriptors as key type in std::map or
31.125 + /// similar associative container we require this.
31.126 + ///
31.127 + /// \note This operator only have to define some strict ordering of
31.128 + /// the items; this order has nothing to do with the iteration
31.129 + /// ordering of the items.
31.130 + bool operator<(Node) const { return false; }
31.131 +
31.132 + };
31.133 +
31.134 + /// This iterator goes through each node.
31.135 +
31.136 + /// This iterator goes through each node.
31.137 + /// Its usage is quite simple, for example you can count the number
31.138 + /// of nodes in graph \c g of type \c Graph like this:
31.139 + ///\code
31.140 + /// int count=0;
31.141 + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
31.142 + ///\endcode
31.143 + class NodeIt : public Node {
31.144 + public:
31.145 + /// Default constructor
31.146 +
31.147 + /// @warning The default constructor sets the iterator
31.148 + /// to an undefined value.
31.149 + NodeIt() { }
31.150 + /// Copy constructor.
31.151 +
31.152 + /// Copy constructor.
31.153 + ///
31.154 + NodeIt(const NodeIt& n) : Node(n) { }
31.155 + /// Invalid constructor \& conversion.
31.156 +
31.157 + /// Initialize the iterator to be invalid.
31.158 + /// \sa Invalid for more details.
31.159 + NodeIt(Invalid) { }
31.160 + /// Sets the iterator to the first node.
31.161 +
31.162 + /// Sets the iterator to the first node of \c g.
31.163 + ///
31.164 + NodeIt(const UGraph&) { }
31.165 + /// Node -> NodeIt conversion.
31.166 +
31.167 + /// Sets the iterator to the node of \c the graph pointed by
31.168 + /// the trivial iterator.
31.169 + /// This feature necessitates that each time we
31.170 + /// iterate the edge-set, the iteration order is the same.
31.171 + NodeIt(const UGraph&, const Node&) { }
31.172 + /// Next node.
31.173 +
31.174 + /// Assign the iterator to the next node.
31.175 + ///
31.176 + NodeIt& operator++() { return *this; }
31.177 + };
31.178 +
31.179 +
31.180 + /// The base type of the undirected edge iterators.
31.181 +
31.182 + /// The base type of the undirected edge iterators.
31.183 + ///
31.184 + class UEdge {
31.185 + public:
31.186 + /// Default constructor
31.187 +
31.188 + /// @warning The default constructor sets the iterator
31.189 + /// to an undefined value.
31.190 + UEdge() { }
31.191 + /// Copy constructor.
31.192 +
31.193 + /// Copy constructor.
31.194 + ///
31.195 + UEdge(const UEdge&) { }
31.196 + /// Initialize the iterator to be invalid.
31.197 +
31.198 + /// Initialize the iterator to be invalid.
31.199 + ///
31.200 + UEdge(Invalid) { }
31.201 + /// Equality operator
31.202 +
31.203 + /// Two iterators are equal if and only if they point to the
31.204 + /// same object or both are invalid.
31.205 + bool operator==(UEdge) const { return true; }
31.206 + /// Inequality operator
31.207 +
31.208 + /// \sa operator==(UEdge n)
31.209 + ///
31.210 + bool operator!=(UEdge) const { return true; }
31.211 +
31.212 + /// Artificial ordering operator.
31.213 +
31.214 + /// To allow the use of graph descriptors as key type in std::map or
31.215 + /// similar associative container we require this.
31.216 + ///
31.217 + /// \note This operator only have to define some strict ordering of
31.218 + /// the items; this order has nothing to do with the iteration
31.219 + /// ordering of the items.
31.220 + bool operator<(UEdge) const { return false; }
31.221 + };
31.222 +
31.223 + /// This iterator goes through each undirected edge.
31.224 +
31.225 + /// This iterator goes through each undirected edge of a graph.
31.226 + /// Its usage is quite simple, for example you can count the number
31.227 + /// of undirected edges in a graph \c g of type \c Graph as follows:
31.228 + ///\code
31.229 + /// int count=0;
31.230 + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
31.231 + ///\endcode
31.232 + class UEdgeIt : public UEdge {
31.233 + public:
31.234 + /// Default constructor
31.235 +
31.236 + /// @warning The default constructor sets the iterator
31.237 + /// to an undefined value.
31.238 + UEdgeIt() { }
31.239 + /// Copy constructor.
31.240 +
31.241 + /// Copy constructor.
31.242 + ///
31.243 + UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
31.244 + /// Initialize the iterator to be invalid.
31.245 +
31.246 + /// Initialize the iterator to be invalid.
31.247 + ///
31.248 + UEdgeIt(Invalid) { }
31.249 + /// This constructor sets the iterator to the first undirected edge.
31.250 +
31.251 + /// This constructor sets the iterator to the first undirected edge.
31.252 + UEdgeIt(const UGraph&) { }
31.253 + /// UEdge -> UEdgeIt conversion
31.254 +
31.255 + /// Sets the iterator to the value of the trivial iterator.
31.256 + /// This feature necessitates that each time we
31.257 + /// iterate the undirected edge-set, the iteration order is the
31.258 + /// same.
31.259 + UEdgeIt(const UGraph&, const UEdge&) { }
31.260 + /// Next undirected edge
31.261 +
31.262 + /// Assign the iterator to the next undirected edge.
31.263 + UEdgeIt& operator++() { return *this; }
31.264 + };
31.265 +
31.266 + /// \brief This iterator goes trough the incident undirected
31.267 + /// edges of a node.
31.268 + ///
31.269 + /// This iterator goes trough the incident undirected edges
31.270 + /// of a certain node of a graph. You should assume that the
31.271 + /// loop edges will be iterated twice.
31.272 + ///
31.273 + /// Its usage is quite simple, for example you can compute the
31.274 + /// degree (i.e. count the number of incident edges of a node \c n
31.275 + /// in graph \c g of type \c Graph as follows.
31.276 + ///
31.277 + ///\code
31.278 + /// int count=0;
31.279 + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
31.280 + ///\endcode
31.281 + class IncEdgeIt : public UEdge {
31.282 + public:
31.283 + /// Default constructor
31.284 +
31.285 + /// @warning The default constructor sets the iterator
31.286 + /// to an undefined value.
31.287 + IncEdgeIt() { }
31.288 + /// Copy constructor.
31.289 +
31.290 + /// Copy constructor.
31.291 + ///
31.292 + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
31.293 + /// Initialize the iterator to be invalid.
31.294 +
31.295 + /// Initialize the iterator to be invalid.
31.296 + ///
31.297 + IncEdgeIt(Invalid) { }
31.298 + /// This constructor sets the iterator to first incident edge.
31.299 +
31.300 + /// This constructor set the iterator to the first incident edge of
31.301 + /// the node.
31.302 + IncEdgeIt(const UGraph&, const Node&) { }
31.303 + /// UEdge -> IncEdgeIt conversion
31.304 +
31.305 + /// Sets the iterator to the value of the trivial iterator \c e.
31.306 + /// This feature necessitates that each time we
31.307 + /// iterate the edge-set, the iteration order is the same.
31.308 + IncEdgeIt(const UGraph&, const UEdge&) { }
31.309 + /// Next incident edge
31.310 +
31.311 + /// Assign the iterator to the next incident edge
31.312 + /// of the corresponding node.
31.313 + IncEdgeIt& operator++() { return *this; }
31.314 + };
31.315 +
31.316 + /// The directed edge type.
31.317 +
31.318 + /// The directed edge type. It can be converted to the
31.319 + /// undirected edge or it should be inherited from the undirected
31.320 + /// edge.
31.321 + class Edge : public UEdge {
31.322 + public:
31.323 + /// Default constructor
31.324 +
31.325 + /// @warning The default constructor sets the iterator
31.326 + /// to an undefined value.
31.327 + Edge() { }
31.328 + /// Copy constructor.
31.329 +
31.330 + /// Copy constructor.
31.331 + ///
31.332 + Edge(const Edge& e) : UEdge(e) { }
31.333 + /// Initialize the iterator to be invalid.
31.334 +
31.335 + /// Initialize the iterator to be invalid.
31.336 + ///
31.337 + Edge(Invalid) { }
31.338 + /// Equality operator
31.339 +
31.340 + /// Two iterators are equal if and only if they point to the
31.341 + /// same object or both are invalid.
31.342 + bool operator==(Edge) const { return true; }
31.343 + /// Inequality operator
31.344 +
31.345 + /// \sa operator==(Edge n)
31.346 + ///
31.347 + bool operator!=(Edge) const { return true; }
31.348 +
31.349 + /// Artificial ordering operator.
31.350 +
31.351 + /// To allow the use of graph descriptors as key type in std::map or
31.352 + /// similar associative container we require this.
31.353 + ///
31.354 + /// \note This operator only have to define some strict ordering of
31.355 + /// the items; this order has nothing to do with the iteration
31.356 + /// ordering of the items.
31.357 + bool operator<(Edge) const { return false; }
31.358 +
31.359 + };
31.360 + /// This iterator goes through each directed edge.
31.361 +
31.362 + /// This iterator goes through each edge of a graph.
31.363 + /// Its usage is quite simple, for example you can count the number
31.364 + /// of edges in a graph \c g of type \c Graph as follows:
31.365 + ///\code
31.366 + /// int count=0;
31.367 + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
31.368 + ///\endcode
31.369 + class EdgeIt : public Edge {
31.370 + public:
31.371 + /// Default constructor
31.372 +
31.373 + /// @warning The default constructor sets the iterator
31.374 + /// to an undefined value.
31.375 + EdgeIt() { }
31.376 + /// Copy constructor.
31.377 +
31.378 + /// Copy constructor.
31.379 + ///
31.380 + EdgeIt(const EdgeIt& e) : Edge(e) { }
31.381 + /// Initialize the iterator to be invalid.
31.382 +
31.383 + /// Initialize the iterator to be invalid.
31.384 + ///
31.385 + EdgeIt(Invalid) { }
31.386 + /// This constructor sets the iterator to the first edge.
31.387 +
31.388 + /// This constructor sets the iterator to the first edge of \c g.
31.389 + ///@param g the graph
31.390 + EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); }
31.391 + /// Edge -> EdgeIt conversion
31.392 +
31.393 + /// Sets the iterator to the value of the trivial iterator \c e.
31.394 + /// This feature necessitates that each time we
31.395 + /// iterate the edge-set, the iteration order is the same.
31.396 + EdgeIt(const UGraph&, const Edge&) { }
31.397 + ///Next edge
31.398 +
31.399 + /// Assign the iterator to the next edge.
31.400 + EdgeIt& operator++() { return *this; }
31.401 + };
31.402 +
31.403 + /// This iterator goes trough the outgoing directed edges of a node.
31.404 +
31.405 + /// This iterator goes trough the \e outgoing edges of a certain node
31.406 + /// of a graph.
31.407 + /// Its usage is quite simple, for example you can count the number
31.408 + /// of outgoing edges of a node \c n
31.409 + /// in graph \c g of type \c Graph as follows.
31.410 + ///\code
31.411 + /// int count=0;
31.412 + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
31.413 + ///\endcode
31.414 +
31.415 + class OutEdgeIt : public Edge {
31.416 + public:
31.417 + /// Default constructor
31.418 +
31.419 + /// @warning The default constructor sets the iterator
31.420 + /// to an undefined value.
31.421 + OutEdgeIt() { }
31.422 + /// Copy constructor.
31.423 +
31.424 + /// Copy constructor.
31.425 + ///
31.426 + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
31.427 + /// Initialize the iterator to be invalid.
31.428 +
31.429 + /// Initialize the iterator to be invalid.
31.430 + ///
31.431 + OutEdgeIt(Invalid) { }
31.432 + /// This constructor sets the iterator to the first outgoing edge.
31.433 +
31.434 + /// This constructor sets the iterator to the first outgoing edge of
31.435 + /// the node.
31.436 + ///@param n the node
31.437 + ///@param g the graph
31.438 + OutEdgeIt(const UGraph& n, const Node& g) {
31.439 + ignore_unused_variable_warning(n);
31.440 + ignore_unused_variable_warning(g);
31.441 + }
31.442 + /// Edge -> OutEdgeIt conversion
31.443 +
31.444 + /// Sets the iterator to the value of the trivial iterator.
31.445 + /// This feature necessitates that each time we
31.446 + /// iterate the edge-set, the iteration order is the same.
31.447 + OutEdgeIt(const UGraph&, const Edge&) { }
31.448 + ///Next outgoing edge
31.449 +
31.450 + /// Assign the iterator to the next
31.451 + /// outgoing edge of the corresponding node.
31.452 + OutEdgeIt& operator++() { return *this; }
31.453 + };
31.454 +
31.455 + /// This iterator goes trough the incoming directed edges of a node.
31.456 +
31.457 + /// This iterator goes trough the \e incoming edges of a certain node
31.458 + /// of a graph.
31.459 + /// Its usage is quite simple, for example you can count the number
31.460 + /// of outgoing edges of a node \c n
31.461 + /// in graph \c g of type \c Graph as follows.
31.462 + ///\code
31.463 + /// int count=0;
31.464 + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
31.465 + ///\endcode
31.466 +
31.467 + class InEdgeIt : public Edge {
31.468 + public:
31.469 + /// Default constructor
31.470 +
31.471 + /// @warning The default constructor sets the iterator
31.472 + /// to an undefined value.
31.473 + InEdgeIt() { }
31.474 + /// Copy constructor.
31.475 +
31.476 + /// Copy constructor.
31.477 + ///
31.478 + InEdgeIt(const InEdgeIt& e) : Edge(e) { }
31.479 + /// Initialize the iterator to be invalid.
31.480 +
31.481 + /// Initialize the iterator to be invalid.
31.482 + ///
31.483 + InEdgeIt(Invalid) { }
31.484 + /// This constructor sets the iterator to first incoming edge.
31.485 +
31.486 + /// This constructor set the iterator to the first incoming edge of
31.487 + /// the node.
31.488 + ///@param n the node
31.489 + ///@param g the graph
31.490 + InEdgeIt(const UGraph& g, const Node& n) {
31.491 + ignore_unused_variable_warning(n);
31.492 + ignore_unused_variable_warning(g);
31.493 + }
31.494 + /// Edge -> InEdgeIt conversion
31.495 +
31.496 + /// Sets the iterator to the value of the trivial iterator \c e.
31.497 + /// This feature necessitates that each time we
31.498 + /// iterate the edge-set, the iteration order is the same.
31.499 + InEdgeIt(const UGraph&, const Edge&) { }
31.500 + /// Next incoming edge
31.501 +
31.502 + /// Assign the iterator to the next inedge of the corresponding node.
31.503 + ///
31.504 + InEdgeIt& operator++() { return *this; }
31.505 + };
31.506 +
31.507 + /// \brief Read write map of the nodes to type \c T.
31.508 + ///
31.509 + /// ReadWrite map of the nodes to type \c T.
31.510 + /// \sa Reference
31.511 + /// \warning Making maps that can handle bool type (NodeMap<bool>)
31.512 + /// needs some extra attention!
31.513 + template<class T>
31.514 + class NodeMap : public ReadWriteMap< Node, T >
31.515 + {
31.516 + public:
31.517 +
31.518 + ///\e
31.519 + NodeMap(const UGraph&) { }
31.520 + ///\e
31.521 + NodeMap(const UGraph&, T) { }
31.522 +
31.523 + ///Copy constructor
31.524 + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
31.525 + ///Assignment operator
31.526 + template <typename CMap>
31.527 + NodeMap& operator=(const CMap&) {
31.528 + checkConcept<ReadMap<Node, T>, CMap>();
31.529 + return *this;
31.530 + }
31.531 + };
31.532 +
31.533 + /// \brief Read write map of the directed edges to type \c T.
31.534 + ///
31.535 + /// Reference map of the directed edges to type \c T.
31.536 + /// \sa Reference
31.537 + /// \warning Making maps that can handle bool type (EdgeMap<bool>)
31.538 + /// needs some extra attention!
31.539 + template<class T>
31.540 + class EdgeMap : public ReadWriteMap<Edge,T>
31.541 + {
31.542 + public:
31.543 +
31.544 + ///\e
31.545 + EdgeMap(const UGraph&) { }
31.546 + ///\e
31.547 + EdgeMap(const UGraph&, T) { }
31.548 + ///Copy constructor
31.549 + EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
31.550 + ///Assignment operator
31.551 + template <typename CMap>
31.552 + EdgeMap& operator=(const CMap&) {
31.553 + checkConcept<ReadMap<Edge, T>, CMap>();
31.554 + return *this;
31.555 + }
31.556 + };
31.557 +
31.558 + /// Read write map of the undirected edges to type \c T.
31.559 +
31.560 + /// Reference map of the edges to type \c T.
31.561 + /// \sa Reference
31.562 + /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
31.563 + /// needs some extra attention!
31.564 + template<class T>
31.565 + class UEdgeMap : public ReadWriteMap<UEdge,T>
31.566 + {
31.567 + public:
31.568 +
31.569 + ///\e
31.570 + UEdgeMap(const UGraph&) { }
31.571 + ///\e
31.572 + UEdgeMap(const UGraph&, T) { }
31.573 + ///Copy constructor
31.574 + UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
31.575 + ///Assignment operator
31.576 + template <typename CMap>
31.577 + UEdgeMap& operator=(const CMap&) {
31.578 + checkConcept<ReadMap<UEdge, T>, CMap>();
31.579 + return *this;
31.580 + }
31.581 + };
31.582 +
31.583 + /// \brief Direct the given undirected edge.
31.584 + ///
31.585 + /// Direct the given undirected edge. The returned edge source
31.586 + /// will be the given node.
31.587 + Edge direct(const UEdge&, const Node&) const {
31.588 + return INVALID;
31.589 + }
31.590 +
31.591 + /// \brief Direct the given undirected edge.
31.592 + ///
31.593 + /// Direct the given undirected edge. The returned edge
31.594 + /// represents the given undireted edge and the direction comes
31.595 + /// from the given bool. The source of the undirected edge and
31.596 + /// the directed edge is the same when the given bool is true.
31.597 + Edge direct(const UEdge&, bool) const {
31.598 + return INVALID;
31.599 + }
31.600 +
31.601 + /// \brief Returns true if the edge has default orientation.
31.602 + ///
31.603 + /// Returns whether the given directed edge is same orientation as
31.604 + /// the corresponding undirected edge's default orientation.
31.605 + bool direction(Edge) const { return true; }
31.606 +
31.607 + /// \brief Returns the opposite directed edge.
31.608 + ///
31.609 + /// Returns the opposite directed edge.
31.610 + Edge oppositeEdge(Edge) const { return INVALID; }
31.611 +
31.612 + /// \brief Opposite node on an edge
31.613 + ///
31.614 + /// \return the opposite of the given Node on the given UEdge
31.615 + Node oppositeNode(Node, UEdge) const { return INVALID; }
31.616 +
31.617 + /// \brief First node of the undirected edge.
31.618 + ///
31.619 + /// \return the first node of the given UEdge.
31.620 + ///
31.621 + /// Naturally undirected edges don't have direction and thus
31.622 + /// don't have source and target node. But we use these two methods
31.623 + /// to query the two nodes of the edge. The direction of the edge
31.624 + /// which arises this way is called the inherent direction of the
31.625 + /// undirected edge, and is used to define the "default" direction
31.626 + /// of the directed versions of the edges.
31.627 + /// \sa direction
31.628 + Node source(UEdge) const { return INVALID; }
31.629 +
31.630 + /// \brief Second node of the undirected edge.
31.631 + Node target(UEdge) const { return INVALID; }
31.632 +
31.633 + /// \brief Source node of the directed edge.
31.634 + Node source(Edge) const { return INVALID; }
31.635 +
31.636 + /// \brief Target node of the directed edge.
31.637 + Node target(Edge) const { return INVALID; }
31.638 +
31.639 + void first(Node&) const {}
31.640 + void next(Node&) const {}
31.641 +
31.642 + void first(UEdge&) const {}
31.643 + void next(UEdge&) const {}
31.644 +
31.645 + void first(Edge&) const {}
31.646 + void next(Edge&) const {}
31.647 +
31.648 + void firstOut(Edge&, Node) const {}
31.649 + void nextOut(Edge&) const {}
31.650 +
31.651 + void firstIn(Edge&, Node) const {}
31.652 + void nextIn(Edge&) const {}
31.653 +
31.654 +
31.655 + void firstInc(UEdge &, bool &, const Node &) const {}
31.656 + void nextInc(UEdge &, bool &) const {}
31.657 +
31.658 + /// \brief Base node of the iterator
31.659 + ///
31.660 + /// Returns the base node (the source in this case) of the iterator
31.661 + Node baseNode(OutEdgeIt e) const {
31.662 + return source(e);
31.663 + }
31.664 + /// \brief Running node of the iterator
31.665 + ///
31.666 + /// Returns the running node (the target in this case) of the
31.667 + /// iterator
31.668 + Node runningNode(OutEdgeIt e) const {
31.669 + return target(e);
31.670 + }
31.671 +
31.672 + /// \brief Base node of the iterator
31.673 + ///
31.674 + /// Returns the base node (the target in this case) of the iterator
31.675 + Node baseNode(InEdgeIt e) const {
31.676 + return target(e);
31.677 + }
31.678 + /// \brief Running node of the iterator
31.679 + ///
31.680 + /// Returns the running node (the source in this case) of the
31.681 + /// iterator
31.682 + Node runningNode(InEdgeIt e) const {
31.683 + return source(e);
31.684 + }
31.685 +
31.686 + /// \brief Base node of the iterator
31.687 + ///
31.688 + /// Returns the base node of the iterator
31.689 + Node baseNode(IncEdgeIt) const {
31.690 + return INVALID;
31.691 + }
31.692 +
31.693 + /// \brief Running node of the iterator
31.694 + ///
31.695 + /// Returns the running node of the iterator
31.696 + Node runningNode(IncEdgeIt) const {
31.697 + return INVALID;
31.698 + }
31.699 +
31.700 + template <typename Graph>
31.701 + struct Constraints {
31.702 + void constraints() {
31.703 + checkConcept<IterableUGraphComponent<>, Graph>();
31.704 + checkConcept<MappableUGraphComponent<>, Graph>();
31.705 + }
31.706 + };
31.707 +
31.708 + };
31.709 +
31.710 + /// @}
31.711 +
31.712 + }
31.713 +
31.714 +}
31.715 +
31.716 +#endif
32.1 --- a/lemon/dag_shortest_path.h Tue Oct 24 16:49:41 2006 +0000
32.2 +++ b/lemon/dag_shortest_path.h Tue Oct 24 17:19:16 2006 +0000
32.3 @@ -93,7 +93,7 @@
32.4 /// \brief The type of the map that stores the edge lengths.
32.5 ///
32.6 /// The type of the map that stores the edge lengths.
32.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
32.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
32.9 typedef _LengthMap LengthMap;
32.10
32.11 // The type of the length of the edges.
32.12 @@ -111,7 +111,7 @@
32.13 ///
32.14 /// The type of the map that stores the last
32.15 /// edges of the shortest paths.
32.16 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.17 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.18 ///
32.19 typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
32.20
32.21 @@ -128,7 +128,7 @@
32.22 /// \brief The type of the map that stores the dists of the nodes.
32.23 ///
32.24 /// The type of the map that stores the dists of the nodes.
32.25 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.26 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.27 ///
32.28 typedef typename Graph::template NodeMap<typename _LengthMap::Value>
32.29 DistMap;
32.30 @@ -205,7 +205,7 @@
32.31 /// \brief The type of the map that stores the edge lengths.
32.32 ///
32.33 /// The type of the map that stores the edge lengths.
32.34 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
32.35 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
32.36 typedef _LengthMap LengthMap;
32.37
32.38 // The type of the length of the edges.
32.39 @@ -223,7 +223,7 @@
32.40 ///
32.41 /// The type of the map that stores the last
32.42 /// edges of the longest paths.
32.43 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.44 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.45 ///
32.46 typedef typename Graph::template NodeMap<typename _Graph::Edge> PredMap;
32.47
32.48 @@ -240,7 +240,7 @@
32.49 /// \brief The type of the map that stores the dists of the nodes.
32.50 ///
32.51 /// The type of the map that stores the dists of the nodes.
32.52 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.53 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.54 ///
32.55 typedef typename Graph::template NodeMap<typename _LengthMap::Value>
32.56 DistMap;
32.57 @@ -262,19 +262,19 @@
32.58 /// \ingroup flowalgs
32.59 /// This class provides an efficient implementation of a Dag sortest path
32.60 /// searching algorithm. The edge lengths are passed to the algorithm
32.61 - /// using a \ref concept::ReadMap "ReadMap", so it is easy to change it
32.62 + /// using a \ref concepts::ReadMap "ReadMap", so it is easy to change it
32.63 /// to any kind of length.
32.64 ///
32.65 /// The complexity of the algorithm is O(n + e).
32.66 ///
32.67 /// The type of the length is determined by the
32.68 - /// \ref concept::ReadMap::Value "Value" of the length map.
32.69 + /// \ref concepts::ReadMap::Value "Value" of the length map.
32.70 ///
32.71 /// \param _Graph The graph type the algorithm runs on. The default value
32.72 /// is \ref ListGraph. The value of _Graph is not used directly by
32.73 /// DagShortestPath, it is only passed to \ref DagShortestPathDefaultTraits.
32.74 /// \param _LengthMap This read-only EdgeMap determines the lengths of the
32.75 - /// edges. The default map type is \ref concept::Graph::EdgeMap
32.76 + /// edges. The default map type is \ref concepts::Graph::EdgeMap
32.77 /// "Graph::EdgeMap<int>". The value of _LengthMap is not used directly
32.78 /// by DagShortestPath, it is only passed to \ref DagShortestPathDefaultTraits.
32.79 /// \param _Traits Traits class to set various data types used by the
32.80 @@ -811,7 +811,7 @@
32.81 /// \brief The type of the map that stores the edge lengths.
32.82 ///
32.83 /// The type of the map that stores the edge lengths.
32.84 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
32.85 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
32.86 typedef _LengthMap LengthMap;
32.87
32.88 /// \brief The value type of the length map.
32.89 @@ -829,7 +829,7 @@
32.90 ///
32.91 /// The type of the map that stores the last
32.92 /// edges of the shortest paths.
32.93 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.94 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.95 typedef NullMap <typename _Graph::Node,typename _Graph::Edge> PredMap;
32.96
32.97 /// \brief Instantiates a PredMap.
32.98 @@ -841,7 +841,7 @@
32.99 /// \brief The type of the map that stores the dists of the nodes.
32.100 ///
32.101 /// The type of the map that stores the dists of the nodes.
32.102 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
32.103 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
32.104 typedef NullMap<typename Graph::Node, Value> DistMap;
32.105 /// \brief Instantiates a DistMap.
32.106 ///
33.1 --- a/lemon/dfs.h Tue Oct 24 16:49:41 2006 +0000
33.2 +++ b/lemon/dfs.h Tue Oct 24 17:19:16 2006 +0000
33.3 @@ -48,7 +48,7 @@
33.4 ///
33.5 ///The type of the map that stores the last
33.6 ///edges of the %DFS paths.
33.7 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.8 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.9 ///
33.10 typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
33.11 ///Instantiates a PredMap.
33.12 @@ -64,7 +64,7 @@
33.13 ///The type of the map that indicates which nodes are processed.
33.14
33.15 ///The type of the map that indicates which nodes are processed.
33.16 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.17 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.18 ///\todo named parameter to set this type, function to read and write.
33.19 typedef NullMap<typename Graph::Node,bool> ProcessedMap;
33.20 ///Instantiates a ProcessedMap.
33.21 @@ -83,7 +83,7 @@
33.22 ///The type of the map that indicates which nodes are reached.
33.23
33.24 ///The type of the map that indicates which nodes are reached.
33.25 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.26 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.27 ///\todo named parameter to set this type, function to read and write.
33.28 typedef typename Graph::template NodeMap<bool> ReachedMap;
33.29 ///Instantiates a ReachedMap.
33.30 @@ -98,7 +98,7 @@
33.31 ///The type of the map that stores the dists of the nodes.
33.32
33.33 ///The type of the map that stores the dists of the nodes.
33.34 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.35 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.36 ///
33.37 typedef typename Graph::template NodeMap<int> DistMap;
33.38 ///Instantiates a DistMap.
33.39 @@ -752,7 +752,7 @@
33.40 ///
33.41 ///The type of the map that stores the last
33.42 ///edges of the %DFS paths.
33.43 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.44 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.45 ///
33.46 typedef NullMap<typename Graph::Node,typename GR::Edge> PredMap;
33.47 ///Instantiates a PredMap.
33.48 @@ -772,7 +772,7 @@
33.49 ///The type of the map that indicates which nodes are processed.
33.50
33.51 ///The type of the map that indicates which nodes are processed.
33.52 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.53 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.54 ///\todo named parameter to set this type, function to read and write.
33.55 typedef NullMap<typename Graph::Node,bool> ProcessedMap;
33.56 ///Instantiates a ProcessedMap.
33.57 @@ -791,7 +791,7 @@
33.58 ///The type of the map that indicates which nodes are reached.
33.59
33.60 ///The type of the map that indicates which nodes are reached.
33.61 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.62 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.63 ///\todo named parameter to set this type, function to read and write.
33.64 typedef typename Graph::template NodeMap<bool> ReachedMap;
33.65 ///Instantiates a ReachedMap.
33.66 @@ -806,7 +806,7 @@
33.67 ///The type of the map that stores the dists of the nodes.
33.68
33.69 ///The type of the map that stores the dists of the nodes.
33.70 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
33.71 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.72 ///
33.73 typedef NullMap<typename Graph::Node,int> DistMap;
33.74 ///Instantiates a DistMap.
33.75 @@ -1168,7 +1168,7 @@
33.76 /// \brief The type of the map that indicates which nodes are reached.
33.77 ///
33.78 /// The type of the map that indicates which nodes are reached.
33.79 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
33.80 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
33.81 /// \todo named parameter to set this type, function to read and write.
33.82 typedef typename Graph::template NodeMap<bool> ReachedMap;
33.83
34.1 --- a/lemon/dijkstra.h Tue Oct 24 16:49:41 2006 +0000
34.2 +++ b/lemon/dijkstra.h Tue Oct 24 17:19:16 2006 +0000
34.3 @@ -48,7 +48,7 @@
34.4 ///The type of the map that stores the edge lengths.
34.5
34.6 ///The type of the map that stores the edge lengths.
34.7 - ///It must meet the \ref concept::ReadMap "ReadMap" concept.
34.8 + ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
34.9 typedef LM LengthMap;
34.10 //The type of the length of the edges.
34.11 typedef typename LM::Value Value;
34.12 @@ -86,7 +86,7 @@
34.13 ///
34.14 ///The type of the map that stores the last
34.15 ///edges of the shortest paths.
34.16 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.17 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.18 ///
34.19 typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
34.20 ///Instantiates a PredMap.
34.21 @@ -102,7 +102,7 @@
34.22 ///The type of the map that stores whether a nodes is processed.
34.23
34.24 ///The type of the map that stores whether a nodes is processed.
34.25 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.26 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.27 ///By default it is a NullMap.
34.28 ///\todo If it is set to a real map,
34.29 ///Dijkstra::processed() should read this.
34.30 @@ -124,7 +124,7 @@
34.31 ///The type of the map that stores the dists of the nodes.
34.32
34.33 ///The type of the map that stores the dists of the nodes.
34.34 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.35 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.36 ///
34.37 typedef typename Graph::template NodeMap<typename LM::Value> DistMap;
34.38 ///Instantiates a DistMap.
34.39 @@ -142,11 +142,11 @@
34.40 /// \ingroup flowalgs
34.41 ///This class provides an efficient implementation of %Dijkstra algorithm.
34.42 ///The edge lengths are passed to the algorithm using a
34.43 - ///\ref concept::ReadMap "ReadMap",
34.44 + ///\ref concepts::ReadMap "ReadMap",
34.45 ///so it is easy to change it to any kind of length.
34.46 ///
34.47 ///The type of the length is determined by the
34.48 - ///\ref concept::ReadMap::Value "Value" of the length map.
34.49 + ///\ref concepts::ReadMap::Value "Value" of the length map.
34.50 ///
34.51 ///It is also possible to change the underlying priority heap.
34.52 ///
34.53 @@ -157,7 +157,7 @@
34.54 ///edges. It is read once for each edge, so the map may involve in
34.55 ///relatively time consuming process to compute the edge length if
34.56 ///it is necessary. The default map type is \ref
34.57 - ///concept::Graph::EdgeMap "Graph::EdgeMap<int>". The value
34.58 + ///concepts::Graph::EdgeMap "Graph::EdgeMap<int>". The value
34.59 ///of LM is not used directly by Dijkstra, it is only passed to \ref
34.60 ///DijkstraDefaultTraits. \param TR Traits class to set
34.61 ///various data types used by the algorithm. The default traits
34.62 @@ -819,7 +819,7 @@
34.63 ///The type of the map that stores the edge lengths.
34.64
34.65 ///The type of the map that stores the edge lengths.
34.66 - ///It must meet the \ref concept::ReadMap "ReadMap" concept.
34.67 + ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
34.68 typedef LM LengthMap;
34.69 //The type of the length of the edges.
34.70 typedef typename LM::Value Value;
34.71 @@ -861,7 +861,7 @@
34.72 ///
34.73 ///The type of the map that stores the last
34.74 ///edges of the shortest paths.
34.75 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.76 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.77 ///
34.78 typedef NullMap <typename GR::Node,typename GR::Edge> PredMap;
34.79 ///Instantiates a PredMap.
34.80 @@ -880,7 +880,7 @@
34.81 ///The type of the map that stores whether a nodes is processed.
34.82
34.83 ///The type of the map that stores whether a nodes is processed.
34.84 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.85 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.86 ///By default it is a NullMap.
34.87 ///\todo If it is set to a real map,
34.88 ///Dijkstra::processed() should read this.
34.89 @@ -902,7 +902,7 @@
34.90 ///The type of the map that stores the dists of the nodes.
34.91
34.92 ///The type of the map that stores the dists of the nodes.
34.93 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
34.94 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
34.95 ///
34.96 typedef NullMap<typename Graph::Node,typename LM::Value> DistMap;
34.97 ///Instantiates a DistMap.
35.1 --- a/lemon/edge_set.h Tue Oct 24 16:49:41 2006 +0000
35.2 +++ b/lemon/edge_set.h Tue Oct 24 17:19:16 2006 +0000
35.3 @@ -238,11 +238,11 @@
35.4 /// original graph.
35.5 ///
35.6 /// \param _Graph The type of the graph which shares its node set with
35.7 - /// this class. Its interface must conform to the \ref concept::Graph
35.8 + /// this class. Its interface must conform to the \ref concepts::Graph
35.9 /// "Graph" concept.
35.10 ///
35.11 /// In the edge extension and removing it conforms to the
35.12 - /// \ref concept::Graph "Graph" concept.
35.13 + /// \ref concepts::Graph "Graph" concept.
35.14 template <typename _Graph>
35.15 class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<_Graph> > {
35.16
35.17 @@ -330,11 +330,11 @@
35.18 /// original graph.
35.19 ///
35.20 /// \param _Graph The type of the graph which shares its node set with
35.21 - /// this class. Its interface must conform to the \ref concept::Graph
35.22 + /// this class. Its interface must conform to the \ref concepts::Graph
35.23 /// "Graph" concept.
35.24 ///
35.25 /// In the edge extension and removing it conforms to the
35.26 - /// \ref concept::UGraph "UGraph" concept.
35.27 + /// \ref concepts::UGraph "UGraph" concept.
35.28 template <typename _Graph>
35.29 class ListUEdgeSet
35.30 : public UEdgeSetExtender<UndirGraphExtender<ListEdgeSetBase<_Graph> > > {
35.31 @@ -567,11 +567,11 @@
35.32 /// original graph.
35.33 ///
35.34 /// \param _Graph The type of the graph which shares its node set with
35.35 - /// this class. Its interface must conform to the \ref concept::Graph
35.36 + /// this class. Its interface must conform to the \ref concepts::Graph
35.37 /// "Graph" concept.
35.38 ///
35.39 /// In the edge extension and removing it conforms to the
35.40 - /// \ref concept::Graph "Graph" concept.
35.41 + /// \ref concepts::Graph "Graph" concept.
35.42 template <typename _Graph>
35.43 class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<_Graph> > {
35.44
35.45 @@ -671,11 +671,11 @@
35.46 /// original graph.
35.47 ///
35.48 /// \param _Graph The type of the graph which shares its node set with
35.49 - /// this class. Its interface must conform to the \ref concept::Graph
35.50 + /// this class. Its interface must conform to the \ref concepts::Graph
35.51 /// "Graph" concept.
35.52 ///
35.53 /// In the edge extension and removing it conforms to the
35.54 - /// \ref concept::UGraph "UGraph" concept.
35.55 + /// \ref concepts::UGraph "UGraph" concept.
35.56 template <typename _Graph>
35.57 class SmartUEdgeSet
35.58 : public UEdgeSetExtender<UndirGraphExtender<SmartEdgeSetBase<_Graph> > > {
36.1 --- a/lemon/floyd_warshall.h Tue Oct 24 16:49:41 2006 +0000
36.2 +++ b/lemon/floyd_warshall.h Tue Oct 24 17:19:16 2006 +0000
36.3 @@ -94,7 +94,7 @@
36.4 /// \brief The type of the map that stores the edge lengths.
36.5 ///
36.6 /// The type of the map that stores the edge lengths.
36.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
36.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
36.9 typedef _LengthMap LengthMap;
36.10
36.11 // The type of the length of the edges.
36.12 @@ -129,7 +129,7 @@
36.13 /// \brief The type of the map that stores the dists of the nodes.
36.14 ///
36.15 /// The type of the map that stores the dists of the nodes.
36.16 - /// It must meet the \ref concept::WriteMatrixMap "WriteMatrixMap" concept.
36.17 + /// It must meet the \ref concepts::WriteMatrixMap "WriteMatrixMap" concept.
36.18 ///
36.19 typedef DynamicMatrixMap<Graph, typename Graph::Node, Value> DistMap;
36.20
36.21 @@ -149,7 +149,7 @@
36.22 /// \ingroup flowalgs
36.23 /// This class provides an efficient implementation of \c Floyd-Warshall
36.24 /// algorithm. The edge lengths are passed to the algorithm using a
36.25 - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any
36.26 + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any
36.27 /// kind of length.
36.28 ///
36.29 /// The algorithm solves the shortest path problem for each pair
36.30 @@ -162,7 +162,7 @@
36.31 /// The complexity of this algorithm is \f$ O(n^3+e) \f$.
36.32 ///
36.33 /// The type of the length is determined by the
36.34 - /// \ref concept::ReadMap::Value "Value" of the length map.
36.35 + /// \ref concepts::ReadMap::Value "Value" of the length map.
36.36 ///
36.37 /// \param _Graph The graph type the algorithm runs on. The default value
36.38 /// is \ref ListGraph. The value of _Graph is not used directly by
36.39 @@ -171,7 +171,7 @@
36.40 /// edges. It is read once for each edge, so the map may involve in
36.41 /// relatively time consuming process to compute the edge length if
36.42 /// it is necessary. The default map type is \ref
36.43 - /// concept::Graph::EdgeMap "Graph::EdgeMap<int>". The value
36.44 + /// concepts::Graph::EdgeMap "Graph::EdgeMap<int>". The value
36.45 /// of _LengthMap is not used directly by FloydWarshall, it is only passed
36.46 /// to \ref FloydWarshallDefaultTraits. \param _Traits Traits class to set
36.47 /// various data types used by the algorithm. The default traits
37.1 --- a/lemon/fredman_tarjan.h Tue Oct 24 16:49:41 2006 +0000
37.2 +++ b/lemon/fredman_tarjan.h Tue Oct 24 17:19:16 2006 +0000
37.3 @@ -36,7 +36,7 @@
37.4 #include <lemon/bits/traits.h>
37.5 #include <lemon/graph_utils.h>
37.6
37.7 -#include <lemon/concept/ugraph.h>
37.8 +#include <lemon/concepts/ugraph.h>
37.9
37.10 namespace lemon {
37.11
37.12 @@ -52,7 +52,7 @@
37.13 ///The type of the map that stores the edge costs.
37.14
37.15 ///The type of the map that stores the edge costs.
37.16 - ///It must meet the \ref concept::ReadMap "ReadMap" concept.
37.17 + ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
37.18 typedef CM CostMap;
37.19 //The type of the cost of the edges.
37.20 typedef typename CM::Value Value;
37.21 @@ -61,7 +61,7 @@
37.22
37.23 ///The type of the map that stores whether an edge is in the
37.24 ///spanning tree or not.
37.25 - ///It must meet the \ref concept::ReadWriteMap "ReadWriteMap" concept.
37.26 + ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
37.27 ///By default it is a BoolEdgeMap.
37.28 typedef typename UGraph::template UEdgeMap<bool> TreeMap;
37.29 ///Instantiates a TreeMap.
37.30 @@ -88,11 +88,11 @@
37.31 /// \f$ \log^{i+1}(n)=\log(\log^{i}(n)) \f$
37.32 ///
37.33 ///The edge costs are passed to the algorithm using a \ref
37.34 - ///concept::ReadMap "ReadMap", so it is easy to change it to any
37.35 + ///concepts::ReadMap "ReadMap", so it is easy to change it to any
37.36 ///kind of cost.
37.37 ///
37.38 ///The type of the cost is determined by the \ref
37.39 - ///concept::ReadMap::Value "Value" of the cost map.
37.40 + ///concepts::ReadMap::Value "Value" of the cost map.
37.41 ///
37.42 ///\param GR The graph type the algorithm runs on. The default value
37.43 ///is \ref ListUGraph. The value of GR is not used directly by
37.44 @@ -103,7 +103,7 @@
37.45 ///edges. It is read once for each edge, so the map may involve in
37.46 ///relatively time consuming process to compute the edge cost if it
37.47 ///is necessary. The default map type is \ref
37.48 - ///concept::UGraph::UEdgeMap "UGraph::UEdgeMap<int>". The value of
37.49 + ///concepts::UGraph::UEdgeMap "UGraph::UEdgeMap<int>". The value of
37.50 ///CM is not used directly by FredmanTarjan, it is only passed to
37.51 ///\ref FredmanTarjanDefaultTraits.
37.52 ///
37.53 @@ -365,7 +365,7 @@
37.54 graph(&_graph), cost(&_cost),
37.55 _tree(0), local_tree(false)
37.56 {
37.57 - checkConcept<concept::UGraph, UGraph>();
37.58 + checkConcept<concepts::UGraph, UGraph>();
37.59 }
37.60
37.61 ///Destructor.
38.1 --- a/lemon/full_graph.h Tue Oct 24 16:49:41 2006 +0000
38.2 +++ b/lemon/full_graph.h Tue Oct 24 17:19:16 2006 +0000
38.3 @@ -167,11 +167,11 @@
38.4 /// It is completely static, so you can neither add nor delete either
38.5 /// edges or nodes.
38.6 /// Thus it conforms to
38.7 - /// the \ref concept::Graph "Graph" concept and
38.8 + /// the \ref concepts::Graph "Graph" concept and
38.9 ///it also has an
38.10 ///important extra feature that
38.11 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
38.12 - /// \sa concept::Graph.
38.13 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
38.14 + /// \sa concepts::Graph.
38.15 ///
38.16 /// \sa FullUGraph
38.17 ///
38.18 @@ -384,7 +384,7 @@
38.19 ///
38.20 ///It also has an
38.21 ///important extra feature that
38.22 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
38.23 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
38.24 ///
38.25 /// \sa FullGraph
38.26 ///
39.1 --- a/lemon/graph_adaptor.h Tue Oct 24 16:49:41 2006 +0000
39.2 +++ b/lemon/graph_adaptor.h Tue Oct 24 17:19:16 2006 +0000
39.3 @@ -2492,7 +2492,7 @@
39.4 /// The full code can be found in the \ref disjoint_paths_demo.cc demo file.
39.5 ///
39.6 /// This graph adaptor is fully conform to the
39.7 - /// \ref concept::Graph "Graph" concept and
39.8 + /// \ref concepts::Graph "Graph" concept and
39.9 /// contains some additional member functions and types. The
39.10 /// documentation of some member functions may be found just in the
39.11 /// SplitGraphAdaptorBase class.
40.1 --- a/lemon/grid_ugraph.h Tue Oct 24 16:49:41 2006 +0000
40.2 +++ b/lemon/grid_ugraph.h Tue Oct 24 17:19:16 2006 +0000
40.3 @@ -292,10 +292,10 @@
40.4 /// }
40.5 ///\endcode
40.6 ///
40.7 - /// The graph type is fully conform to the \ref concept::UGraph
40.8 + /// The graph type is fully conform to the \ref concepts::UGraph
40.9 /// "Undirected Graph" concept, and it also has an
40.10 ///important extra feature that
40.11 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
40.12 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
40.13 ///
40.14 ///
40.15 /// \author Balazs Dezso
41.1 --- a/lemon/hypercube_graph.h Tue Oct 24 16:49:41 2006 +0000
41.2 +++ b/lemon/hypercube_graph.h Tue Oct 24 17:19:16 2006 +0000
41.3 @@ -189,8 +189,8 @@
41.4 /// reasons. This way the maximal dimension of this implementation
41.5 /// is 26.
41.6 ///
41.7 - /// The graph type is fully conform to the \ref concept::Graph
41.8 - /// concept but it does not conform to the \ref concept::UGraph.
41.9 + /// The graph type is fully conform to the \ref concepts::Graph
41.10 + /// concept but it does not conform to the \ref concepts::UGraph.
41.11 ///
41.12 /// \author Balazs Dezso
41.13 class HyperCubeGraph : public ExtendedHyperCubeGraphBase {
42.1 --- a/lemon/johnson.h Tue Oct 24 16:49:41 2006 +0000
42.2 +++ b/lemon/johnson.h Tue Oct 24 17:19:16 2006 +0000
42.3 @@ -96,7 +96,7 @@
42.4 /// \brief The type of the map that stores the edge lengths.
42.5 ///
42.6 /// The type of the map that stores the edge lengths.
42.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
42.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
42.9 typedef _LengthMap LengthMap;
42.10
42.11 // The type of the length of the edges.
42.12 @@ -162,7 +162,7 @@
42.13 /// \brief The type of the matrix map that stores the dists of the nodes.
42.14 ///
42.15 /// The type of the matrix map that stores the dists of the nodes.
42.16 - /// It must meet the \ref concept::WriteMatrixMap "WriteMatrixMap" concept.
42.17 + /// It must meet the \ref concepts::WriteMatrixMap "WriteMatrixMap" concept.
42.18 ///
42.19 typedef DynamicMatrixMap<Graph, typename Graph::Node, Value> DistMap;
42.20
42.21 @@ -182,7 +182,7 @@
42.22 /// \ingroup flowalgs
42.23 /// This class provides an efficient implementation of \c %Johnson
42.24 /// algorithm. The edge lengths are passed to the algorithm using a
42.25 - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any
42.26 + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any
42.27 /// kind of length.
42.28 ///
42.29 /// The algorithm solves the shortest path problem for each pair
42.30 @@ -197,7 +197,7 @@
42.31 /// Floyd-Warshall algorithm.
42.32 ///
42.33 /// The type of the length is determined by the
42.34 - /// \ref concept::ReadMap::Value "Value" of the length map.
42.35 + /// \ref concepts::ReadMap::Value "Value" of the length map.
42.36 ///
42.37 /// \param _Graph The graph type the algorithm runs on. The default value
42.38 /// is \ref ListGraph. The value of _Graph is not used directly by
42.39 @@ -206,7 +206,7 @@
42.40 /// edges. It is read once for each edge, so the map may involve in
42.41 /// relatively time consuming process to compute the edge length if
42.42 /// it is necessary. The default map type is \ref
42.43 - /// concept::Graph::EdgeMap "Graph::EdgeMap<int>". The value
42.44 + /// concepts::Graph::EdgeMap "Graph::EdgeMap<int>". The value
42.45 /// of _LengthMap is not used directly by Johnson, it is only passed
42.46 /// to \ref JohnsonDefaultTraits. \param _Traits Traits class to set
42.47 /// various data types used by the algorithm. The default traits
43.1 --- a/lemon/kruskal.h Tue Oct 24 16:49:41 2006 +0000
43.2 +++ b/lemon/kruskal.h Tue Oct 24 17:19:16 2006 +0000
43.3 @@ -44,8 +44,8 @@
43.4 /// Due to hard C++ hacking, it accepts various input and output types.
43.5 ///
43.6 /// \param g The graph the algorithm runs on.
43.7 - /// It can be either \ref concept::Graph "directed" or
43.8 - /// \ref concept::UGraph "undirected".
43.9 + /// It can be either \ref concepts::Graph "directed" or
43.10 + /// \ref concepts::UGraph "undirected".
43.11 /// If the graph is directed, the algorithm consider it to be
43.12 /// undirected by disregarding the direction of the edges.
43.13 ///
43.14 @@ -83,7 +83,7 @@
43.15 /// \return The cost of the found tree.
43.16 ///
43.17 /// \warning If kruskal runs on an
43.18 - /// \ref lemon::concept::UGraph "undirected graph", be sure that the
43.19 + /// \ref lemon::concepts::UGraph "undirected graph", be sure that the
43.20 /// map storing the tree is also undirected
43.21 /// (e.g. ListUGraph::UEdgeMap<bool>, otherwise the values of the
43.22 /// half of the edges will not be set.
44.1 --- a/lemon/lemon_reader.h Tue Oct 24 16:49:41 2006 +0000
44.2 +++ b/lemon/lemon_reader.h Tue Oct 24 17:19:16 2006 +0000
44.3 @@ -41,7 +41,7 @@
44.4 #include <lemon/dim2.h>
44.5
44.6 #include <lemon/concept_check.h>
44.7 -#include <lemon/concept/maps.h>
44.8 +#include <lemon/concepts/maps.h>
44.9
44.10 namespace lemon {
44.11
44.12 @@ -831,7 +831,7 @@
44.13 template <typename Reader, typename Map, typename MapParameter>
44.14 NodeSetReader& _readMap(std::string name, MapParameter map,
44.15 const Reader& reader = Reader()) {
44.16 - checkConcept<concept::WriteMap<Node, typename Map::Value>, Map>();
44.17 + checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
44.18 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
44.19 if (readers.find(name) != readers.end()) {
44.20 ErrorMessage msg;
44.21 @@ -1061,7 +1061,7 @@
44.22 template <typename Reader, typename Map, typename MapParameter>
44.23 EdgeSetReader& _readMap(std::string name, MapParameter map,
44.24 const Reader& reader = Reader()) {
44.25 - checkConcept<concept::WriteMap<Edge, typename Map::Value>, Map>();
44.26 + checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
44.27 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
44.28 if (readers.find(name) != readers.end()) {
44.29 ErrorMessage msg;
44.30 @@ -1305,7 +1305,7 @@
44.31 template <typename Reader, typename Map, typename MapParameter>
44.32 UEdgeSetReader& _readMap(std::string name, MapParameter map,
44.33 const Reader& reader = Reader()) {
44.34 - checkConcept<concept::WriteMap<UEdge, typename Map::Value>, Map>();
44.35 + checkConcept<concepts::WriteMap<UEdge, typename Map::Value>, Map>();
44.36 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
44.37 if (readers.find(name) != readers.end()) {
44.38 ErrorMessage msg;
44.39 @@ -1376,7 +1376,7 @@
44.40 UEdgeSetReader& _readDirMap(std::string name, MapParameter map,
44.41 const Reader& reader = Reader()) {
44.42 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
44.43 - checkConcept<concept::WriteMap<Edge, typename Map::Value>, Map>();
44.44 + checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
44.45 readMap("+" + name,
44.46 _reader_bits::forwardComposeMap(graph, map), reader);
44.47 readMap("-" + name,
45.1 --- a/lemon/lemon_writer.h Tue Oct 24 16:49:41 2006 +0000
45.2 +++ b/lemon/lemon_writer.h Tue Oct 24 17:19:16 2006 +0000
45.3 @@ -40,7 +40,7 @@
45.4 #include <lemon/dim2.h>
45.5
45.6 #include <lemon/concept_check.h>
45.7 -#include <lemon/concept/maps.h>
45.8 +#include <lemon/concepts/maps.h>
45.9
45.10
45.11 namespace lemon {
45.12 @@ -483,7 +483,7 @@
45.13 template <typename Writer, typename Map>
45.14 NodeSetWriter& writeNodeMap(std::string name, const Map& map,
45.15 const Writer& writer = Writer()) {
45.16 - checkConcept<concept::ReadMap<Node, typename Map::Value>, Map>();
45.17 + checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
45.18 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
45.19 writers.push_back(
45.20 make_pair(name, new _writer_bits::
45.21 @@ -672,7 +672,7 @@
45.22 template <typename Writer, typename Map>
45.23 EdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
45.24 const Writer& writer = Writer()) {
45.25 - checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>();
45.26 + checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
45.27 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
45.28 writers.push_back(
45.29 make_pair(name, new _writer_bits::
45.30 @@ -878,7 +878,7 @@
45.31 template <typename Writer, typename Map>
45.32 UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map,
45.33 const Writer& writer = Writer()) {
45.34 - checkConcept<concept::ReadMap<UEdge, typename Map::Value>, Map>();
45.35 + checkConcept<concepts::ReadMap<UEdge, typename Map::Value>, Map>();
45.36 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
45.37 writers.push_back(
45.38 make_pair(name, new _writer_bits::
45.39 @@ -901,7 +901,7 @@
45.40 template <typename Writer, typename Map>
45.41 UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
45.42 const Writer& writer = Writer()) {
45.43 - checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>();
45.44 + checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
45.45 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
45.46 writeUEdge("+" + name,
45.47 _writer_bits::forwardComposeMap(graph, map), writer);
46.1 --- a/lemon/list_graph.h Tue Oct 24 16:49:41 2006 +0000
46.2 +++ b/lemon/list_graph.h Tue Oct 24 17:19:16 2006 +0000
46.3 @@ -318,15 +318,15 @@
46.4
46.5 ///This is a simple and fast graph implementation.
46.6 ///
46.7 - ///It conforms to the \ref concept::Graph "Graph concept" and it
46.8 + ///It conforms to the \ref concepts::Graph "Graph concept" and it
46.9 ///also provides several additional useful extra functionalities.
46.10 ///The most of the member functions and nested classes are
46.11 ///documented only in the concept class.
46.12 ///
46.13 ///An important extra feature of this graph implementation is that
46.14 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
46.15 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
46.16 ///
46.17 - ///\sa concept::Graph.
46.18 + ///\sa concepts::Graph.
46.19
46.20 class ListGraph : public ExtendedListGraphBase {
46.21 private:
46.22 @@ -748,12 +748,12 @@
46.23 ///This is a simple and fast undirected graph implementation.
46.24 ///
46.25 ///An important extra feature of this graph implementation is that
46.26 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
46.27 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
46.28 ///
46.29 ///It conforms to the
46.30 - ///\ref concept::UGraph "UGraph concept".
46.31 + ///\ref concepts::UGraph "UGraph concept".
46.32 ///
46.33 - ///\sa concept::UGraph.
46.34 + ///\sa concepts::UGraph.
46.35 ///
46.36 class ListUGraph : public ExtendedListUGraphBase {
46.37 private:
46.38 @@ -1497,12 +1497,12 @@
46.39 /// \brief A smart bipartite undirected graph class.
46.40 ///
46.41 /// This is a bipartite undirected graph implementation.
46.42 - /// It is conforms to the \ref concept::BpUGraph "BpUGraph concept".
46.43 + /// It is conforms to the \ref concepts::BpUGraph "BpUGraph concept".
46.44 ///
46.45 ///An important extra feature of this graph implementation is that
46.46 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
46.47 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
46.48 ///
46.49 - /// \sa concept::BpUGraph.
46.50 + /// \sa concepts::BpUGraph.
46.51 ///
46.52 class ListBpUGraph : public ExtendedListBpUGraphBase {
46.53 /// \brief ListBpUGraph is \e not copy constructible.
47.1 --- a/lemon/lp_base.h Tue Oct 24 16:49:41 2006 +0000
47.2 +++ b/lemon/lp_base.h Tue Oct 24 17:19:16 2006 +0000
47.3 @@ -665,7 +665,7 @@
47.4 ///\code
47.5 ///std::map<AnyType,LpSolverBase::Col>
47.6 ///\endcode
47.7 - ///- an iterable lemon \ref concept::WriteMap "write map" like
47.8 + ///- an iterable lemon \ref concepts::WriteMap "write map" like
47.9 ///\code
47.10 ///ListGraph::NodeMap<LpSolverBase::Col>
47.11 ///ListGraph::EdgeMap<LpSolverBase::Col>
47.12 @@ -765,7 +765,7 @@
47.13 ///\code
47.14 ///std::map<AnyType,LpSolverBase::Row>
47.15 ///\endcode
47.16 - ///- an iterable lemon \ref concept::WriteMap "write map" like
47.17 + ///- an iterable lemon \ref concepts::WriteMap "write map" like
47.18 ///\code
47.19 ///ListGraph::NodeMap<LpSolverBase::Row>
47.20 ///ListGraph::EdgeMap<LpSolverBase::Row>
48.1 --- a/lemon/maps.h Tue Oct 24 16:49:41 2006 +0000
48.2 +++ b/lemon/maps.h Tue Oct 24 17:19:16 2006 +0000
48.3 @@ -29,7 +29,7 @@
48.4 ///\ingroup maps
48.5 ///\brief Miscellaneous property maps
48.6 ///
48.7 -///\todo This file has the same name as the concept file in concept/,
48.8 +///\todo This file has the same name as the concept file in concepts/,
48.9 /// and this is not easily detectable in docs...
48.10
48.11 #include <map>
48.12 @@ -252,7 +252,7 @@
48.13
48.14 ///Convert the \c Value of a map to another type.
48.15
48.16 - ///This \ref concept::ReadMap "read only map"
48.17 + ///This \ref concepts::ReadMap "read only map"
48.18 ///converts the \c Value of a maps to type \c T.
48.19 ///Its \c Key is inherited from \c M.
48.20 template <typename M, typename T>
48.21 @@ -289,7 +289,7 @@
48.22
48.23 ///Simple wrapping of the map
48.24
48.25 - ///This \ref concept::ReadMap "read only map" returns the simple
48.26 + ///This \ref concepts::ReadMap "read only map" returns the simple
48.27 ///wrapping of the given map. Sometimes the reference maps cannot be
48.28 ///combined with simple read maps. This map adaptor wraps the given
48.29 ///map to simple read map.
48.30 @@ -309,7 +309,7 @@
48.31
48.32 ///Simple writeable wrapping of the map
48.33
48.34 - ///This \ref concept::ReadMap "read only map" returns the simple
48.35 + ///This \ref concepts::ReadMap "read only map" returns the simple
48.36 ///wrapping of the given map. Sometimes the reference maps cannot be
48.37 ///combined with simple read-write maps. This map adaptor wraps the
48.38 ///given map to simple read-write map.
48.39 @@ -330,7 +330,7 @@
48.40
48.41 ///Sum of two maps
48.42
48.43 - ///This \ref concept::ReadMap "read only map" returns the sum of the two
48.44 + ///This \ref concepts::ReadMap "read only map" returns the sum of the two
48.45 ///given maps. Its \c Key and \c Value will be inherited from \c M1.
48.46 ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
48.47
48.48 @@ -363,7 +363,7 @@
48.49
48.50 ///Shift a map with a constant.
48.51
48.52 - ///This \ref concept::ReadMap "read only map" returns the sum of the
48.53 + ///This \ref concepts::ReadMap "read only map" returns the sum of the
48.54 ///given map and a constant value.
48.55 ///Its \c Key and \c Value is inherited from \c M.
48.56 ///
48.57 @@ -396,7 +396,7 @@
48.58
48.59 ///Shift a map with a constant.
48.60
48.61 - ///This \ref concept::ReadWriteMap "read-write map" returns the sum of the
48.62 + ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the
48.63 ///given map and a constant value. It makes also possible to write the map.
48.64 ///Its \c Key and \c Value is inherited from \c M.
48.65 ///
48.66 @@ -445,7 +445,7 @@
48.67
48.68 ///Difference of two maps
48.69
48.70 - ///This \ref concept::ReadMap "read only map" returns the difference
48.71 + ///This \ref concepts::ReadMap "read only map" returns the difference
48.72 ///of the values of the two
48.73 ///given maps. Its \c Key and \c Value will be inherited from \c M1.
48.74 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
48.75 @@ -476,7 +476,7 @@
48.76
48.77 ///Product of two maps
48.78
48.79 - ///This \ref concept::ReadMap "read only map" returns the product of the
48.80 + ///This \ref concepts::ReadMap "read only map" returns the product of the
48.81 ///values of the two
48.82 ///given
48.83 ///maps. Its \c Key and \c Value will be inherited from \c M1.
48.84 @@ -507,7 +507,7 @@
48.85
48.86 ///Scales a maps with a constant.
48.87
48.88 - ///This \ref concept::ReadMap "read only map" returns the value of the
48.89 + ///This \ref concepts::ReadMap "read only map" returns the value of the
48.90 ///given map multiplied from the left side with a constant value.
48.91 ///Its \c Key and \c Value is inherited from \c M.
48.92 ///
48.93 @@ -540,7 +540,7 @@
48.94
48.95 ///Scales a maps with a constant.
48.96
48.97 - ///This \ref concept::ReadWriteMap "read-write map" returns the value of the
48.98 + ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the
48.99 ///given map multiplied from the left side with a constant value. It can
48.100 ///be used as write map also if the given multiplier is not zero.
48.101 ///Its \c Key and \c Value is inherited from \c M.
48.102 @@ -580,7 +580,7 @@
48.103
48.104 ///Quotient of two maps
48.105
48.106 - ///This \ref concept::ReadMap "read only map" returns the quotient of the
48.107 + ///This \ref concepts::ReadMap "read only map" returns the quotient of the
48.108 ///values of the two
48.109 ///given maps. Its \c Key and \c Value will be inherited from \c M1.
48.110 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
48.111 @@ -610,7 +610,7 @@
48.112
48.113 ///Composition of two maps
48.114
48.115 - ///This \ref concept::ReadMap "read only map" returns the composition of
48.116 + ///This \ref concepts::ReadMap "read only map" returns the composition of
48.117 ///two
48.118 ///given maps. That is to say, if \c m1 is of type \c M1 and \c m2 is
48.119 ///of \c M2,
48.120 @@ -655,7 +655,7 @@
48.121 ///Combines of two maps using an STL (binary) functor.
48.122 ///
48.123 ///
48.124 - ///This \ref concept::ReadMap "read only map" takes two maps and a
48.125 + ///This \ref concepts::ReadMap "read only map" takes two maps and a
48.126 ///binary functor and returns the composition of
48.127 ///the two
48.128 ///given maps unsing the functor.
48.129 @@ -727,7 +727,7 @@
48.130
48.131 ///Negative value of a map
48.132
48.133 - ///This \ref concept::ReadMap "read only map" returns the negative
48.134 + ///This \ref concepts::ReadMap "read only map" returns the negative
48.135 ///value of the
48.136 ///value returned by the
48.137 ///given map. Its \c Key and \c Value will be inherited from \c M.
48.138 @@ -748,7 +748,7 @@
48.139
48.140 ///Negative value of a map
48.141
48.142 - ///This \ref concept::ReadWriteMap "read-write map" returns the negative
48.143 + ///This \ref concepts::ReadWriteMap "read-write map" returns the negative
48.144 ///value of the value returned by the
48.145 ///given map. Its \c Key and \c Value will be inherited from \c M.
48.146 ///The unary \c - operator must be defined for \c Value, of course.
48.147 @@ -783,7 +783,7 @@
48.148
48.149 ///Absolute value of a map
48.150
48.151 - ///This \ref concept::ReadMap "read only map" returns the absolute value
48.152 + ///This \ref concepts::ReadMap "read only map" returns the absolute value
48.153 ///of the
48.154 ///value returned by the
48.155 ///given map. Its \c Key and \c Value will be inherited
48.156 @@ -832,7 +832,7 @@
48.157
48.158 ///Converts an STL style functor to a map
48.159
48.160 - ///This \ref concept::ReadMap "read only map" returns the value
48.161 + ///This \ref concepts::ReadMap "read only map" returns the value
48.162 ///of a
48.163 ///given map.
48.164 ///
48.165 @@ -890,7 +890,7 @@
48.166 ///that is it provides an <tt>operator()</tt> to read its values.
48.167 ///
48.168 ///For the sake of convenience it also works as
48.169 - ///a ususal \ref concept::ReadMap "readable map",
48.170 + ///a ususal \ref concepts::ReadMap "readable map",
48.171 ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
48.172
48.173 template <typename M>
48.174 @@ -925,7 +925,7 @@
48.175
48.176 ///Applies all map setting operations to two maps
48.177
48.178 - ///This map has two \ref concept::ReadMap "readable map"
48.179 + ///This map has two \ref concepts::ReadMap "readable map"
48.180 ///parameters and each read request will be passed just to the
48.181 ///first map. This class is the just readable map type of the ForkWriteMap.
48.182 ///
48.183 @@ -949,9 +949,9 @@
48.184
48.185 ///Applies all map setting operations to two maps
48.186
48.187 - ///This map has two \ref concept::WriteMap "writable map"
48.188 + ///This map has two \ref concepts::WriteMap "writable map"
48.189 ///parameters and each write request will be passed to both of them.
48.190 - ///If \c M1 is also \ref concept::ReadMap "readable",
48.191 + ///If \c M1 is also \ref concepts::ReadMap "readable",
48.192 ///then the read operations will return the
48.193 ///corresponding values of \c M1.
48.194 ///
48.195 @@ -996,7 +996,7 @@
48.196
48.197 ///Logical 'not' of a map
48.198
48.199 - ///This bool \ref concept::ReadMap "read only map" returns the
48.200 + ///This bool \ref concepts::ReadMap "read only map" returns the
48.201 ///logical negation of
48.202 ///value returned by the
48.203 ///given map. Its \c Key and will be inherited from \c M,
48.204 @@ -1017,7 +1017,7 @@
48.205
48.206 ///Logical 'not' of a map with writing possibility
48.207
48.208 - ///This bool \ref concept::ReadWriteMap "read-write map" returns the
48.209 + ///This bool \ref concepts::ReadWriteMap "read-write map" returns the
48.210 ///logical negation of value returned by the given map. When it is set,
48.211 ///the opposite value is set to the original map.
48.212 ///Its \c Key and will be inherited from \c M,
49.1 --- a/lemon/matrix_maps.h Tue Oct 24 16:49:41 2006 +0000
49.2 +++ b/lemon/matrix_maps.h Tue Oct 24 17:19:16 2006 +0000
49.3 @@ -25,13 +25,13 @@
49.4 #include <lemon/bits/invalid.h>
49.5 #include <lemon/maps.h>
49.6
49.7 -#include <lemon/concept/matrix_maps.h>
49.8 +#include <lemon/concepts/matrix_maps.h>
49.9
49.10 /// \file
49.11 /// \ingroup matrices
49.12 /// \brief Maps indexed with pairs of items.
49.13 ///
49.14 -/// \todo This file has the same name as the concept file in concept/,
49.15 +/// \todo This file has the same name as the concept file in concepts/,
49.16 /// and this is not easily detectable in docs...
49.17 namespace lemon {
49.18
49.19 @@ -295,7 +295,7 @@
49.20 ///type of the two map shall be the same.
49.21 template <typename CMap>
49.22 DynamicMatrixMap& operator=(const CMap& _cmap){
49.23 - checkConcept<concept::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.24 + checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.25 typename Parent::Notifier* notifier = Parent::getNotifier();
49.26 Key first, second;
49.27 for(notifier->first(first); first != INVALID;
49.28 @@ -432,7 +432,7 @@
49.29 ///type of the two map shall be the same.
49.30 template <typename CMap>
49.31 DynamicSymMatrixMap& operator=(const CMap& _cmap){
49.32 - checkConcept<concept::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.33 + checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.34 typename Parent::Notifier* notifier = Parent::getNotifier();
49.35 Key first, second;
49.36 for(notifier->first(first); first != INVALID;
49.37 @@ -519,7 +519,7 @@
49.38 ///content change, so it is updated automaticly whenever it is
49.39 ///needed.
49.40 ///
49.41 - ///This map meet with the concept::ReferenceMatrixMap<typename K1,
49.42 + ///This map meet with the concepts::ReferenceMatrixMap<typename K1,
49.43 ///typename K2, typename V, typename R, typename CR> called as
49.44 ///"ReferenceMatrixMap".
49.45 ///
49.46 @@ -860,7 +860,7 @@
49.47 ///type of the two map shall be the same.
49.48 template <typename CMap>
49.49 DynamicAsymMatrixMap& operator=(const CMap& _cdmap){
49.50 - checkConcept<concept::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.51 + checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>();
49.52 const typename FirstKeyProxy::Notifier* notifierFirstKey =
49.53 _first_key_proxy.getNotifier();
49.54 const typename SecondKeyProxy::Notifier* notifierSecondKey =
50.1 --- a/lemon/min_cost_arborescence.h Tue Oct 24 16:49:41 2006 +0000
50.2 +++ b/lemon/min_cost_arborescence.h Tue Oct 24 17:19:16 2006 +0000
50.3 @@ -45,7 +45,7 @@
50.4 /// \brief The type of the map that stores the edge costs.
50.5 ///
50.6 /// The type of the map that stores the edge costs.
50.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
50.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
50.9 typedef _CostMap CostMap;
50.10
50.11 /// \brief The value type of the costs.
50.12 @@ -57,7 +57,7 @@
50.13 /// in the arborescence.
50.14 ///
50.15 /// The type of the map that stores which edges are in the arborescence.
50.16 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
50.17 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
50.18 /// Initially it will be set to false on each edge. After it
50.19 /// will set all arborescence edges once.
50.20 typedef typename Graph::template EdgeMap<bool> ArborescenceMap;
50.21 @@ -110,7 +110,7 @@
50.22 /// edges. It is read once for each edge, so the map may involve in
50.23 /// relatively time consuming process to compute the edge cost if
50.24 /// it is necessary. The default map type is \ref
50.25 - /// concept::Graph::EdgeMap "Graph::EdgeMap<int>". The value
50.26 + /// concepts::Graph::EdgeMap "Graph::EdgeMap<int>". The value
50.27 /// of _CostMap is not used directly by MinCostArborescence,
50.28 /// it is only passed to \ref MinCostArborescenceDefaultTraits.
50.29 /// \param _Traits Traits class to set various data types used
51.1 --- a/lemon/min_cut.h Tue Oct 24 16:49:41 2006 +0000
51.2 +++ b/lemon/min_cut.h Tue Oct 24 17:19:16 2006 +0000
51.3 @@ -67,7 +67,7 @@
51.4 /// \brief The type of the map that stores the edge capacities.
51.5 ///
51.6 /// The type of the map that stores the edge capacities.
51.7 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
51.8 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
51.9 typedef _CapacityMap CapacityMap;
51.10
51.11 /// \brief The type of the capacity of the edges.
51.12 @@ -113,7 +113,7 @@
51.13 /// \brief The type of the map that stores whether a nodes is processed.
51.14 ///
51.15 /// The type of the map that stores whether a nodes is processed.
51.16 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
51.17 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
51.18 /// By default it is a NullMap.
51.19 typedef NullMap<typename Graph::Node, bool> ProcessedMap;
51.20
51.21 @@ -134,7 +134,7 @@
51.22 /// \brief The type of the map that stores the cardinalties of the nodes.
51.23 ///
51.24 /// The type of the map that stores the cardinalities of the nodes.
51.25 - /// It must meet the \ref concept::WriteMap "WriteMap" concept.
51.26 + /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
51.27 typedef typename Graph::template NodeMap<Value> CardinalityMap;
51.28
51.29 /// \brief Instantiates a CardinalityMap.
51.30 @@ -162,11 +162,11 @@
51.31 /// before the given node.
51.32 ///
51.33 /// The edge capacities are passed to the algorithm using a
51.34 - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any
51.35 + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any
51.36 /// kind of capacity.
51.37 ///
51.38 /// The type of the capacity is determined by the \ref
51.39 - /// concept::ReadMap::Value "Value" of the capacity map.
51.40 + /// concepts::ReadMap::Value "Value" of the capacity map.
51.41 ///
51.42 /// It is also possible to change the underlying priority heap.
51.43 ///
51.44 @@ -179,7 +179,7 @@
51.45 /// the edges. It is read once for each edge, so the map may involve in
51.46 /// relatively time consuming process to compute the edge capacity if
51.47 /// it is necessary. The default map type is \ref
51.48 - /// concept::Graph::EdgeMap "Graph::EdgeMap<int>". The value
51.49 + /// concepts::Graph::EdgeMap "Graph::EdgeMap<int>". The value
51.50 /// of CapacityMap is not used directly by search algorithm, it is only
51.51 /// passed to \ref MaxCardinalitySearchDefaultTraits.
51.52 /// \param _Traits Traits class to set various data types used by the
51.53 @@ -714,7 +714,7 @@
51.54 /// \brief The type of the map that stores the edge capacities.
51.55 ///
51.56 /// The type of the map that stores the edge capacities.
51.57 - /// It must meet the \ref concept::ReadMap "ReadMap" concept.
51.58 + /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
51.59 typedef _CapacityMap CapacityMap;
51.60
51.61 /// \brief Instantiates a CapacityMap.
52.1 --- a/lemon/prim.h Tue Oct 24 16:49:41 2006 +0000
52.2 +++ b/lemon/prim.h Tue Oct 24 17:19:16 2006 +0000
52.3 @@ -30,7 +30,7 @@
52.4 #include <lemon/maps.h>
52.5 #include <lemon/bits/traits.h>
52.6
52.7 -#include <lemon/concept/ugraph.h>
52.8 +#include <lemon/concepts/ugraph.h>
52.9
52.10 namespace lemon {
52.11
52.12 @@ -46,7 +46,7 @@
52.13 ///The type of the map that stores the edge costs.
52.14
52.15 ///The type of the map that stores the edge costs.
52.16 - ///It must meet the \ref concept::ReadMap "ReadMap" concept.
52.17 + ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
52.18 typedef CM CostMap;
52.19 //The type of the cost of the edges.
52.20 typedef typename CM::Value Value;
52.21 @@ -82,7 +82,7 @@
52.22 ///
52.23 ///The type of the map that stores the last
52.24 ///edges of the minimum spanning tree.
52.25 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
52.26 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
52.27 ///
52.28 typedef typename UGraph::template NodeMap<typename GR::UEdge> PredMap;
52.29 ///Instantiates a PredMap.
52.30 @@ -113,7 +113,7 @@
52.31 ///The type of the map that stores whether a nodes is processed.
52.32
52.33 ///The type of the map that stores whether a nodes is processed.
52.34 - ///It must meet the \ref concept::WriteMap "WriteMap" concept.
52.35 + ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
52.36 ///By default it is a NodeMap<bool>.
52.37 typedef NullMap<typename UGraph::Node,bool> ProcessedMap;
52.38 ///Instantiates a ProcessedMap.
52.39 @@ -140,11 +140,11 @@
52.40 ///n is the number of nodes in the graph.
52.41 ///
52.42 ///The edge costs are passed to the algorithm using a
52.43 - ///\ref concept::ReadMap "ReadMap",
52.44 + ///\ref concepts::ReadMap "ReadMap",
52.45 ///so it is easy to change it to any kind of cost.
52.46 ///
52.47 ///The type of the cost is determined by the
52.48 - ///\ref concept::ReadMap::Value "Value" of the cost map.
52.49 + ///\ref concepts::ReadMap::Value "Value" of the cost map.
52.50 ///
52.51 ///It is also possible to change the underlying priority heap.
52.52 ///
52.53 @@ -156,7 +156,7 @@
52.54 ///edges. It is read once for each edge, so the map may involve in
52.55 ///relatively time consuming process to compute the edge cost if
52.56 ///it is necessary. The default map type is \ref
52.57 - ///concept::UGraph::UEdgeMap "UGraph::UEdgeMap<int>". The value
52.58 + ///concepts::UGraph::UEdgeMap "UGraph::UEdgeMap<int>". The value
52.59 ///of CM is not used directly by Prim, it is only passed to \ref
52.60 ///PrimDefaultTraits.
52.61 ///
52.62 @@ -412,7 +412,7 @@
52.63 _heap_cross_ref(NULL), local_heap_cross_ref(false),
52.64 _heap(NULL), local_heap(false)
52.65 {
52.66 - checkConcept<concept::UGraph, UGraph>();
52.67 + checkConcept<concepts::UGraph, UGraph>();
52.68 }
52.69
52.70 ///Destructor.
53.1 --- a/lemon/smart_graph.h Tue Oct 24 16:49:41 2006 +0000
53.2 +++ b/lemon/smart_graph.h Tue Oct 24 17:19:16 2006 +0000
53.3 @@ -194,11 +194,11 @@
53.4 ///that <b> it does support only limited (only stack-like)
53.5 ///node and edge deletions</b>.
53.6 ///It conforms to
53.7 - ///the \ref concept::Graph "Graph concept" with an
53.8 + ///the \ref concepts::Graph "Graph concept" with an
53.9 ///important extra feature that
53.10 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
53.11 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
53.12 ///
53.13 - ///\sa concept::Graph.
53.14 + ///\sa concepts::Graph.
53.15 ///
53.16 ///\author Alpar Juttner
53.17 class SmartGraph : public ExtendedSmartGraphBase {
53.18 @@ -380,13 +380,13 @@
53.19 /// that <b> it does support only limited (only stack-like)
53.20 /// node and edge deletions</b>.
53.21 /// Except from this it conforms to
53.22 - /// the \ref concept::UGraph "UGraph concept".
53.23 + /// the \ref concepts::UGraph "UGraph concept".
53.24 ///
53.25 ///It also has an
53.26 ///important extra feature that
53.27 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
53.28 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
53.29 ///
53.30 - /// \sa concept::UGraph.
53.31 + /// \sa concepts::UGraph.
53.32 ///
53.33 /// \todo Snapshot hasn't been implemented yet.
53.34 ///
53.35 @@ -762,13 +762,13 @@
53.36 /// It is also quite memory efficient, but at the price
53.37 /// that <b> it does not support node and edge deletions</b>.
53.38 /// Except from this it conforms to
53.39 - /// the \ref concept::BpUGraph "BpUGraph concept".
53.40 + /// the \ref concepts::BpUGraph "BpUGraph concept".
53.41 ///
53.42 ///It also has an
53.43 ///important extra feature that
53.44 - ///its maps are real \ref concept::ReferenceMap "reference map"s.
53.45 + ///its maps are real \ref concepts::ReferenceMap "reference map"s.
53.46 ///
53.47 - /// \sa concept::BpUGraph.
53.48 + /// \sa concepts::BpUGraph.
53.49 ///
53.50 class SmartBpUGraph : public ExtendedSmartBpUGraphBase {
53.51 private:
54.1 --- a/lemon/topology.h Tue Oct 24 16:49:41 2006 +0000
54.2 +++ b/lemon/topology.h Tue Oct 24 17:19:16 2006 +0000
54.3 @@ -25,8 +25,8 @@
54.4 #include <lemon/graph_adaptor.h>
54.5 #include <lemon/maps.h>
54.6
54.7 -#include <lemon/concept/graph.h>
54.8 -#include <lemon/concept/ugraph.h>
54.9 +#include <lemon/concepts/graph.h>
54.10 +#include <lemon/concepts/ugraph.h>
54.11 #include <lemon/concept_check.h>
54.12
54.13 #include <lemon/bin_heap.h>
54.14 @@ -53,7 +53,7 @@
54.15 /// \note By definition, the empty graph is connected.
54.16 template <typename UGraph>
54.17 bool connected(const UGraph& graph) {
54.18 - checkConcept<concept::UGraph, UGraph>();
54.19 + checkConcept<concepts::UGraph, UGraph>();
54.20 typedef typename UGraph::NodeIt NodeIt;
54.21 if (NodeIt(graph) == INVALID) return true;
54.22 Dfs<UGraph> dfs(graph);
54.23 @@ -78,7 +78,7 @@
54.24 /// of zero connected components.
54.25 template <typename UGraph>
54.26 int countConnectedComponents(const UGraph &graph) {
54.27 - checkConcept<concept::UGraph, UGraph>();
54.28 + checkConcept<concepts::UGraph, UGraph>();
54.29 typedef typename UGraph::Node Node;
54.30 typedef typename UGraph::Edge Edge;
54.31
54.32 @@ -126,10 +126,10 @@
54.33 ///
54.34 template <class UGraph, class NodeMap>
54.35 int connectedComponents(const UGraph &graph, NodeMap &compMap) {
54.36 - checkConcept<concept::UGraph, UGraph>();
54.37 + checkConcept<concepts::UGraph, UGraph>();
54.38 typedef typename UGraph::Node Node;
54.39 typedef typename UGraph::Edge Edge;
54.40 - checkConcept<concept::WriteMap<Node, int>, NodeMap>();
54.41 + checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
54.42
54.43 typedef NullMap<Node, Edge> PredMap;
54.44 typedef NullMap<Node, int> DistMap;
54.45 @@ -244,7 +244,7 @@
54.46 /// \note By definition, the empty graph is strongly connected.
54.47 template <typename Graph>
54.48 bool stronglyConnected(const Graph& graph) {
54.49 - checkConcept<concept::Graph, Graph>();
54.50 + checkConcept<concepts::Graph, Graph>();
54.51
54.52 typedef typename Graph::Node Node;
54.53 typedef typename Graph::NodeIt NodeIt;
54.54 @@ -302,7 +302,7 @@
54.55 /// strongly connected components.
54.56 template <typename Graph>
54.57 int countStronglyConnectedComponents(const Graph& graph) {
54.58 - checkConcept<concept::Graph, Graph>();
54.59 + checkConcept<concepts::Graph, Graph>();
54.60
54.61 using namespace _topology_bits;
54.62
54.63 @@ -371,10 +371,10 @@
54.64 ///
54.65 template <typename Graph, typename NodeMap>
54.66 int stronglyConnectedComponents(const Graph& graph, NodeMap& compMap) {
54.67 - checkConcept<concept::Graph, Graph>();
54.68 + checkConcept<concepts::Graph, Graph>();
54.69 typedef typename Graph::Node Node;
54.70 typedef typename Graph::NodeIt NodeIt;
54.71 - checkConcept<concept::WriteMap<Node, int>, NodeMap>();
54.72 + checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
54.73
54.74 using namespace _topology_bits;
54.75
54.76 @@ -434,11 +434,11 @@
54.77 /// \return The number of cut edges
54.78 template <typename Graph, typename EdgeMap>
54.79 int stronglyConnectedCutEdges(const Graph& graph, EdgeMap& cutMap) {
54.80 - checkConcept<concept::Graph, Graph>();
54.81 + checkConcept<concepts::Graph, Graph>();
54.82 typedef typename Graph::Node Node;
54.83 typedef typename Graph::Edge Edge;
54.84 typedef typename Graph::NodeIt NodeIt;
54.85 - checkConcept<concept::WriteMap<Edge, bool>, EdgeMap>();
54.86 + checkConcept<concepts::WriteMap<Edge, bool>, EdgeMap>();
54.87
54.88 using namespace _topology_bits;
54.89
54.90 @@ -730,7 +730,7 @@
54.91 /// \return The number of components.
54.92 template <typename UGraph>
54.93 int countBiNodeConnectedComponents(const UGraph& graph) {
54.94 - checkConcept<concept::UGraph, UGraph>();
54.95 + checkConcept<concepts::UGraph, UGraph>();
54.96 typedef typename UGraph::NodeIt NodeIt;
54.97
54.98 using namespace _topology_bits;
54.99 @@ -774,10 +774,10 @@
54.100 template <typename UGraph, typename UEdgeMap>
54.101 int biNodeConnectedComponents(const UGraph& graph,
54.102 UEdgeMap& compMap) {
54.103 - checkConcept<concept::UGraph, UGraph>();
54.104 + checkConcept<concepts::UGraph, UGraph>();
54.105 typedef typename UGraph::NodeIt NodeIt;
54.106 typedef typename UGraph::UEdge UEdge;
54.107 - checkConcept<concept::WriteMap<UEdge, int>, UEdgeMap>();
54.108 + checkConcept<concepts::WriteMap<UEdge, int>, UEdgeMap>();
54.109
54.110 using namespace _topology_bits;
54.111
54.112 @@ -814,10 +814,10 @@
54.113 /// \return The number of the cut nodes.
54.114 template <typename UGraph, typename NodeMap>
54.115 int biNodeConnectedCutNodes(const UGraph& graph, NodeMap& cutMap) {
54.116 - checkConcept<concept::UGraph, UGraph>();
54.117 + checkConcept<concepts::UGraph, UGraph>();
54.118 typedef typename UGraph::Node Node;
54.119 typedef typename UGraph::NodeIt NodeIt;
54.120 - checkConcept<concept::WriteMap<Node, bool>, NodeMap>();
54.121 + checkConcept<concepts::WriteMap<Node, bool>, NodeMap>();
54.122
54.123 using namespace _topology_bits;
54.124
54.125 @@ -1057,7 +1057,7 @@
54.126 /// \return The number of components.
54.127 template <typename UGraph>
54.128 int countBiEdgeConnectedComponents(const UGraph& graph) {
54.129 - checkConcept<concept::UGraph, UGraph>();
54.130 + checkConcept<concepts::UGraph, UGraph>();
54.131 typedef typename UGraph::NodeIt NodeIt;
54.132
54.133 using namespace _topology_bits;
54.134 @@ -1100,10 +1100,10 @@
54.135 ///
54.136 template <typename UGraph, typename NodeMap>
54.137 int biEdgeConnectedComponents(const UGraph& graph, NodeMap& compMap) {
54.138 - checkConcept<concept::UGraph, UGraph>();
54.139 + checkConcept<concepts::UGraph, UGraph>();
54.140 typedef typename UGraph::NodeIt NodeIt;
54.141 typedef typename UGraph::Node Node;
54.142 - checkConcept<concept::WriteMap<Node, int>, NodeMap>();
54.143 + checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
54.144
54.145 using namespace _topology_bits;
54.146
54.147 @@ -1141,10 +1141,10 @@
54.148 /// \return The number of cut edges.
54.149 template <typename UGraph, typename UEdgeMap>
54.150 int biEdgeConnectedCutEdges(const UGraph& graph, UEdgeMap& cutMap) {
54.151 - checkConcept<concept::UGraph, UGraph>();
54.152 + checkConcept<concepts::UGraph, UGraph>();
54.153 typedef typename UGraph::NodeIt NodeIt;
54.154 typedef typename UGraph::UEdge UEdge;
54.155 - checkConcept<concept::WriteMap<UEdge, bool>, UEdgeMap>();
54.156 + checkConcept<concepts::WriteMap<UEdge, bool>, UEdgeMap>();
54.157
54.158 using namespace _topology_bits;
54.159
54.160 @@ -1205,8 +1205,8 @@
54.161 void topologicalSort(const Graph& graph, NodeMap& order) {
54.162 using namespace _topology_bits;
54.163
54.164 - checkConcept<concept::Graph, Graph>();
54.165 - checkConcept<concept::WriteMap<typename Graph::Node, int>, NodeMap>();
54.166 + checkConcept<concepts::Graph, Graph>();
54.167 + checkConcept<concepts::WriteMap<typename Graph::Node, int>, NodeMap>();
54.168
54.169 typedef typename Graph::Node Node;
54.170 typedef typename Graph::NodeIt NodeIt;
54.171 @@ -1247,8 +1247,8 @@
54.172 bool checkedTopologicalSort(const Graph& graph, NodeMap& order) {
54.173 using namespace _topology_bits;
54.174
54.175 - checkConcept<concept::Graph, Graph>();
54.176 - checkConcept<concept::ReadWriteMap<typename Graph::Node, int>, NodeMap>();
54.177 + checkConcept<concepts::Graph, Graph>();
54.178 + checkConcept<concepts::ReadWriteMap<typename Graph::Node, int>, NodeMap>();
54.179
54.180 typedef typename Graph::Node Node;
54.181 typedef typename Graph::NodeIt NodeIt;
54.182 @@ -1290,7 +1290,7 @@
54.183 template <typename Graph>
54.184 bool dag(const Graph& graph) {
54.185
54.186 - checkConcept<concept::Graph, Graph>();
54.187 + checkConcept<concepts::Graph, Graph>();
54.188
54.189 typedef typename Graph::Node Node;
54.190 typedef typename Graph::NodeIt NodeIt;
54.191 @@ -1331,7 +1331,7 @@
54.192 /// \see dag
54.193 template <typename UGraph>
54.194 bool acyclic(const UGraph& graph) {
54.195 - checkConcept<concept::UGraph, UGraph>();
54.196 + checkConcept<concepts::UGraph, UGraph>();
54.197 typedef typename UGraph::Node Node;
54.198 typedef typename UGraph::NodeIt NodeIt;
54.199 typedef typename UGraph::Edge Edge;
54.200 @@ -1364,7 +1364,7 @@
54.201 /// \return %True when the graph is acyclic and connected.
54.202 template <typename UGraph>
54.203 bool tree(const UGraph& graph) {
54.204 - checkConcept<concept::UGraph, UGraph>();
54.205 + checkConcept<concepts::UGraph, UGraph>();
54.206 typedef typename UGraph::Node Node;
54.207 typedef typename UGraph::NodeIt NodeIt;
54.208 typedef typename UGraph::Edge Edge;
54.209 @@ -1402,7 +1402,7 @@
54.210 /// \author Balazs Attila Mihaly
54.211 template<typename UGraph>
54.212 inline bool bipartite(const UGraph &graph){
54.213 - checkConcept<concept::UGraph, UGraph>();
54.214 + checkConcept<concepts::UGraph, UGraph>();
54.215
54.216 typedef typename UGraph::NodeIt NodeIt;
54.217 typedef typename UGraph::EdgeIt EdgeIt;
54.218 @@ -1439,7 +1439,7 @@
54.219 /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth
54.220 template<typename UGraph, typename NodeMap>
54.221 inline bool bipartitePartitions(const UGraph &graph, NodeMap &partMap){
54.222 - checkConcept<concept::UGraph, UGraph>();
54.223 + checkConcept<concepts::UGraph, UGraph>();
54.224
54.225 typedef typename UGraph::Node Node;
54.226 typedef typename UGraph::NodeIt NodeIt;
55.1 --- a/lemon/vmap.h Tue Oct 24 16:49:41 2006 +0000
55.2 +++ b/lemon/vmap.h Tue Oct 24 17:19:16 2006 +0000
55.3 @@ -59,7 +59,7 @@
55.4 virtual void set(const Key &,const Value &) = 0;
55.5 };
55.6
55.7 - ///Makes a virtual map from a \ref concept::ReadMap "ReadMap"
55.8 + ///Makes a virtual map from a \ref concepts::ReadMap "ReadMap"
55.9 template<class M, class K=typename M::Key,class V=typename M::Value>
55.10 class VReadMap : public VMapBase<K,V>
55.11 {
55.12 @@ -74,7 +74,7 @@
55.13 template<class M, class K=typename M::Key,class V=typename M::Value>
55.14 vReadMap(const M& m) {return VReadMap<M,K,V>(m);}
55.15
55.16 - ///Makes a virtual map from a \ref concept::WriteMap "WriteMap"
55.17 + ///Makes a virtual map from a \ref concepts::WriteMap "WriteMap"
55.18 template<class M, class K=typename M::Key,class V=typename M::Value>
55.19 class VWriteMap :public VMapBase<K,V>
55.20 {
55.21 @@ -89,7 +89,7 @@
55.22 template<class M, class K=typename M::Key,class V=typename M::Value>
55.23 vWriteMap(const M& m) {return VReadMap<M,K,V>(m);}
55.24
55.25 - ///Makes a virtual map from a \ref concept::ReadWriteMap "ReadWriteMap"
55.26 + ///Makes a virtual map from a \ref concepts::ReadWriteMap "ReadWriteMap"
55.27 template<class M, class K=typename M::Key,class V=typename M::Value>
55.28 class VReadWriteMap :public VMapBase<K,V>
55.29 {
56.1 --- a/test/bfs_test.cc Tue Oct 24 16:49:41 2006 +0000
56.2 +++ b/test/bfs_test.cc Tue Oct 24 17:19:16 2006 +0000
56.3 @@ -20,7 +20,7 @@
56.4 #include <lemon/smart_graph.h>
56.5 #include <lemon/bfs.h>
56.6 #include <lemon/path.h>
56.7 -#include<lemon/concept/graph.h>
56.8 +#include<lemon/concepts/graph.h>
56.9
56.10 using namespace lemon;
56.11
56.12 @@ -29,7 +29,7 @@
56.13
56.14 void check_Bfs_Compile()
56.15 {
56.16 - typedef concept::Graph Graph;
56.17 + typedef concepts::Graph Graph;
56.18
56.19 typedef Graph::Edge Edge;
56.20 typedef Graph::Node Node;
56.21 @@ -66,22 +66,22 @@
56.22 void check_Bfs_Function_Compile()
56.23 {
56.24 typedef int VType;
56.25 - typedef concept::Graph Graph;
56.26 + typedef concepts::Graph Graph;
56.27
56.28 typedef Graph::Edge Edge;
56.29 typedef Graph::Node Node;
56.30 typedef Graph::EdgeIt EdgeIt;
56.31 typedef Graph::NodeIt NodeIt;
56.32 - typedef concept::ReadMap<Edge,VType> LengthMap;
56.33 + typedef concepts::ReadMap<Edge,VType> LengthMap;
56.34
56.35 Graph g;
56.36 bfs(g,Node()).run();
56.37 bfs(g).source(Node()).run();
56.38 bfs(g)
56.39 - .predMap(concept::WriteMap<Node,Edge>())
56.40 - .distMap(concept::WriteMap<Node,VType>())
56.41 - .reachedMap(concept::ReadWriteMap<Node,bool>())
56.42 - .processedMap(concept::WriteMap<Node,bool>())
56.43 + .predMap(concepts::WriteMap<Node,Edge>())
56.44 + .distMap(concepts::WriteMap<Node,VType>())
56.45 + .reachedMap(concepts::ReadWriteMap<Node,bool>())
56.46 + .processedMap(concepts::WriteMap<Node,bool>())
56.47 .run(Node());
56.48
56.49 }
57.1 --- a/test/bpugraph_test.cc Tue Oct 24 16:49:41 2006 +0000
57.2 +++ b/test/bpugraph_test.cc Tue Oct 24 17:19:16 2006 +0000
57.3 @@ -16,7 +16,7 @@
57.4 *
57.5 */
57.6
57.7 -#include <lemon/concept/bpugraph.h>
57.8 +#include <lemon/concepts/bpugraph.h>
57.9 #include <lemon/list_graph.h>
57.10 #include <lemon/smart_graph.h>
57.11 #include <lemon/full_graph.h>
57.12 @@ -28,7 +28,7 @@
57.13
57.14
57.15 using namespace lemon;
57.16 -using namespace lemon::concept;
57.17 +using namespace lemon::concepts;
57.18
57.19 void check_concepts() {
57.20
58.1 --- a/test/dfs_test.cc Tue Oct 24 16:49:41 2006 +0000
58.2 +++ b/test/dfs_test.cc Tue Oct 24 17:19:16 2006 +0000
58.3 @@ -20,7 +20,7 @@
58.4 #include <lemon/smart_graph.h>
58.5 #include <lemon/dfs.h>
58.6 #include <lemon/path.h>
58.7 -#include <lemon/concept/graph.h>
58.8 +#include <lemon/concepts/graph.h>
58.9
58.10 using namespace lemon;
58.11
58.12 @@ -29,7 +29,7 @@
58.13
58.14 void check_Dfs_SmartGraph_Compile()
58.15 {
58.16 - typedef concept::Graph Graph;
58.17 + typedef concepts::Graph Graph;
58.18
58.19 typedef Graph::Edge Edge;
58.20 typedef Graph::Node Node;
58.21 @@ -67,22 +67,22 @@
58.22 void check_Dfs_Function_Compile()
58.23 {
58.24 typedef int VType;
58.25 - typedef concept::Graph Graph;
58.26 + typedef concepts::Graph Graph;
58.27
58.28 typedef Graph::Edge Edge;
58.29 typedef Graph::Node Node;
58.30 typedef Graph::EdgeIt EdgeIt;
58.31 typedef Graph::NodeIt NodeIt;
58.32 - typedef concept::ReadMap<Edge,VType> LengthMap;
58.33 + typedef concepts::ReadMap<Edge,VType> LengthMap;
58.34
58.35 Graph g;
58.36 dfs(g,Node()).run();
58.37 dfs(g).source(Node()).run();
58.38 dfs(g)
58.39 - .predMap(concept::WriteMap<Node,Edge>())
58.40 - .distMap(concept::WriteMap<Node,VType>())
58.41 - .reachedMap(concept::ReadWriteMap<Node,bool>())
58.42 - .processedMap(concept::WriteMap<Node,bool>())
58.43 + .predMap(concepts::WriteMap<Node,Edge>())
58.44 + .distMap(concepts::WriteMap<Node,VType>())
58.45 + .reachedMap(concepts::ReadWriteMap<Node,bool>())
58.46 + .processedMap(concepts::WriteMap<Node,bool>())
58.47 .run(Node());
58.48
58.49 }
59.1 --- a/test/dijkstra_test.cc Tue Oct 24 16:49:41 2006 +0000
59.2 +++ b/test/dijkstra_test.cc Tue Oct 24 17:19:16 2006 +0000
59.3 @@ -21,8 +21,8 @@
59.4 #include <lemon/dijkstra.h>
59.5 #include <lemon/path.h>
59.6 #include <lemon/maps.h>
59.7 -#include <lemon/concept/graph.h>
59.8 -#include <lemon/concept/maps.h>
59.9 +#include <lemon/concepts/graph.h>
59.10 +#include <lemon/concepts/maps.h>
59.11 using namespace lemon;
59.12
59.13 const int PET_SIZE =5;
59.14 @@ -31,13 +31,13 @@
59.15 void check_Dijkstra_BinHeap_Compile()
59.16 {
59.17 typedef int VType;
59.18 - typedef concept::Graph Graph;
59.19 + typedef concepts::Graph Graph;
59.20
59.21 typedef Graph::Edge Edge;
59.22 typedef Graph::Node Node;
59.23 typedef Graph::EdgeIt EdgeIt;
59.24 typedef Graph::NodeIt NodeIt;
59.25 - typedef concept::ReadMap<Edge,VType> LengthMap;
59.26 + typedef concepts::ReadMap<Edge,VType> LengthMap;
59.27
59.28 typedef Dijkstra<Graph, LengthMap> DType;
59.29
59.30 @@ -70,20 +70,20 @@
59.31 void check_Dijkstra_Function_Compile()
59.32 {
59.33 typedef int VType;
59.34 - typedef concept::Graph Graph;
59.35 + typedef concepts::Graph Graph;
59.36
59.37 typedef Graph::Edge Edge;
59.38 typedef Graph::Node Node;
59.39 typedef Graph::EdgeIt EdgeIt;
59.40 typedef Graph::NodeIt NodeIt;
59.41 - typedef concept::ReadMap<Edge,VType> LengthMap;
59.42 + typedef concepts::ReadMap<Edge,VType> LengthMap;
59.43
59.44 Graph g;
59.45 dijkstra(g,LengthMap(),Node()).run();
59.46 dijkstra(g,LengthMap()).source(Node()).run();
59.47 dijkstra(g,LengthMap())
59.48 - .predMap(concept::WriteMap<Node,Edge>())
59.49 - .distMap(concept::WriteMap<Node,VType>())
59.50 + .predMap(concepts::WriteMap<Node,Edge>())
59.51 + .distMap(concepts::WriteMap<Node,VType>())
59.52 .run(Node());
59.53
59.54 }
60.1 --- a/test/edge_set_test.cc Tue Oct 24 16:49:41 2006 +0000
60.2 +++ b/test/edge_set_test.cc Tue Oct 24 17:19:16 2006 +0000
60.3 @@ -3,8 +3,8 @@
60.4 #include <iostream>
60.5 #include <vector>
60.6
60.7 -#include <lemon/concept/graph.h>
60.8 -#include <lemon/concept/ugraph.h>
60.9 +#include <lemon/concepts/graph.h>
60.10 +#include <lemon/concepts/ugraph.h>
60.11 #include <lemon/smart_graph.h>
60.12
60.13 #include <lemon/edge_set.h>
60.14 @@ -15,7 +15,7 @@
60.15
60.16
60.17 using namespace lemon;
60.18 -using namespace lemon::concept;
60.19 +using namespace lemon::concepts;
60.20
60.21 typedef SmartGraph RGraph;
60.22
61.1 --- a/test/graph_adaptor_test.cc Tue Oct 24 16:49:41 2006 +0000
61.2 +++ b/test/graph_adaptor_test.cc Tue Oct 24 17:19:16 2006 +0000
61.3 @@ -20,9 +20,9 @@
61.4 #include<lemon/concept_check.h>
61.5
61.6 #include<lemon/smart_graph.h>
61.7 -#include<lemon/concept/graph.h>
61.8 -#include<lemon/concept/ugraph.h>
61.9 -#include<lemon/concept/bpugraph.h>
61.10 +#include<lemon/concepts/graph.h>
61.11 +#include<lemon/concepts/ugraph.h>
61.12 +#include<lemon/concepts/bpugraph.h>
61.13
61.14 #include<lemon/list_graph.h>
61.15 #include<lemon/full_graph.h>
61.16 @@ -41,7 +41,7 @@
61.17 */
61.18
61.19 using namespace lemon;
61.20 -using namespace lemon::concept;
61.21 +using namespace lemon::concepts;
61.22
61.23
61.24
62.1 --- a/test/graph_factory_test.cc Tue Oct 24 16:49:41 2006 +0000
62.2 +++ b/test/graph_factory_test.cc Tue Oct 24 17:19:16 2006 +0000
62.3 @@ -18,8 +18,8 @@
62.4
62.5 #include<iostream>
62.6 #include<lemon/smart_graph.h>
62.7 -#include<lemon/concept/graph.h>
62.8 -#include<lemon/concept/maps.h>
62.9 +#include<lemon/concepts/graph.h>
62.10 +#include<lemon/concepts/maps.h>
62.11 #include<lemon/list_graph_base.h>
62.12 #include<lemon/full_graph.h>
62.13
62.14 @@ -70,22 +70,22 @@
62.15 }
62.16
62.17 //Compile Graph
62.18 -template void lemon::concept::checkCompileGraph<concept::Graph>
62.19 -(concept::Graph &);
62.20 +template void lemon::concepts::checkCompileGraph<concepts::Graph>
62.21 +(concepts::Graph &);
62.22
62.23 template
62.24 -void lemon::concept::checkCompileGraph<concept::Graph>
62.25 -(concept::Graph &);
62.26 +void lemon::concepts::checkCompileGraph<concepts::Graph>
62.27 +(concepts::Graph &);
62.28
62.29 template
62.30 -void lemon::concept::checkCompileGraph<concept::Graph>
62.31 -(concept::Graph &);
62.32 +void lemon::concepts::checkCompileGraph<concepts::Graph>
62.33 +(concepts::Graph &);
62.34
62.35 //Compile SmartGraph
62.36 template
62.37 -void lemon::concept::checkCompileGraph<SmartGraph>(SmartGraph &);
62.38 +void lemon::concepts::checkCompileGraph<SmartGraph>(SmartGraph &);
62.39 template
62.40 -void lemon::concept::checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
62.41 +void lemon::concepts::checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
62.42
62.43 //Compile SymSmartGraph
62.44 //template void hugo::checkCompileGraph<SymSmartGraph>(SymSmartGraph &);
62.45 @@ -93,11 +93,11 @@
62.46
62.47 //Compile ListGraph
62.48 template
62.49 -void lemon::concept::checkCompileGraph<ListGraph>(ListGraph &);
62.50 +void lemon::concepts::checkCompileGraph<ListGraph>(ListGraph &);
62.51 template
62.52 -void lemon::concept::checkCompileGraph<ListGraph>(ListGraph &);
62.53 +void lemon::concepts::checkCompileGraph<ListGraph>(ListGraph &);
62.54 template
62.55 -void lemon::concept::checkCompileGraphFindEdge<ListGraph>(ListGraph &);
62.56 +void lemon::concepts::checkCompileGraphFindEdge<ListGraph>(ListGraph &);
62.57
62.58
62.59 //Compile SymListGraph
62.60 @@ -106,9 +106,9 @@
62.61 //template void hugo::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
62.62
62.63 //Compile FullGraph
62.64 -template void lemon::concept::checkCompileGraph<FullGraph>(FullGraph &);
62.65 +template void lemon::concepts::checkCompileGraph<FullGraph>(FullGraph &);
62.66 template
62.67 -void lemon::concept::checkCompileGraphFindEdge<FullGraph>(FullGraph &);
62.68 +void lemon::concepts::checkCompileGraphFindEdge<FullGraph>(FullGraph &);
62.69
62.70
62.71 int main()
62.72 @@ -143,7 +143,7 @@
62.73
62.74 // Some map tests.
62.75 // FIXME: These shouldn't be here.
62.76 - using namespace concept;
62.77 + using namespace concepts;
62.78 function_requires< ReadMapConcept< ReadMap<int,int> > >();
62.79 function_requires< WriteMapConcept< WriteMap<int,int> > >();
62.80 function_requires< ReadWriteMapConcept< ReadWriteMap<int,int> > >();
63.1 --- a/test/graph_test.cc Tue Oct 24 16:49:41 2006 +0000
63.2 +++ b/test/graph_test.cc Tue Oct 24 17:19:16 2006 +0000
63.3 @@ -19,7 +19,7 @@
63.4 #include <iostream>
63.5 #include <vector>
63.6
63.7 -#include <lemon/concept/graph.h>
63.8 +#include <lemon/concepts/graph.h>
63.9 #include <lemon/list_graph.h>
63.10 #include <lemon/smart_graph.h>
63.11 #include <lemon/full_graph.h>
63.12 @@ -31,7 +31,7 @@
63.13
63.14
63.15 using namespace lemon;
63.16 -using namespace lemon::concept;
63.17 +using namespace lemon::concepts;
63.18
63.19
63.20 int main() {
64.1 --- a/test/heap_test.cc Tue Oct 24 16:49:41 2006 +0000
64.2 +++ b/test/heap_test.cc Tue Oct 24 17:19:16 2006 +0000
64.3 @@ -22,7 +22,7 @@
64.4 #include <vector>
64.5
64.6 #include <lemon/concept_check.h>
64.7 -#include <lemon/concept/heap.h>
64.8 +#include <lemon/concepts/heap.h>
64.9
64.10 #include <lemon/smart_graph.h>
64.11
64.12 @@ -40,7 +40,7 @@
64.13 #include <lemon/time_measure.h>
64.14
64.15 using namespace lemon;
64.16 -using namespace lemon::concept;
64.17 +using namespace lemon::concepts;
64.18
64.19
64.20 int main() {
65.1 --- a/test/kruskal_test.cc Tue Oct 24 16:49:41 2006 +0000
65.2 +++ b/test/kruskal_test.cc Tue Oct 24 17:19:16 2006 +0000
65.3 @@ -23,8 +23,8 @@
65.4 #include <lemon/maps.h>
65.5 #include <lemon/kruskal.h>
65.6 #include <lemon/list_graph.h>
65.7 -#include <lemon/concept/maps.h>
65.8 -#include <lemon/concept/graph.h>
65.9 +#include <lemon/concepts/maps.h>
65.10 +#include <lemon/concepts/graph.h>
65.11
65.12
65.13 using namespace std;
65.14 @@ -32,11 +32,11 @@
65.15
65.16 void checkCompileKruskal()
65.17 {
65.18 - concept::WriteMap<concept::Graph::Edge,bool> w;
65.19 + concepts::WriteMap<concepts::Graph::Edge,bool> w;
65.20
65.21 - concept::Graph g;
65.22 + concepts::Graph g;
65.23 kruskal(g,
65.24 - concept::ReadMap<concept::Graph::Edge,int>(),
65.25 + concepts::ReadMap<concepts::Graph::Edge,int>(),
65.26 w);
65.27 }
65.28
66.1 --- a/test/maps_test.cc Tue Oct 24 16:49:41 2006 +0000
66.2 +++ b/test/maps_test.cc Tue Oct 24 17:19:16 2006 +0000
66.3 @@ -20,13 +20,13 @@
66.4 #include <set>
66.5
66.6 #include <lemon/concept_check.h>
66.7 -#include <lemon/concept/maps.h>
66.8 +#include <lemon/concepts/maps.h>
66.9 #include <lemon/maps.h>
66.10
66.11 #include "test_tools.h"
66.12
66.13 using namespace lemon;
66.14 -using namespace lemon::concept;
66.15 +using namespace lemon::concepts;
66.16
66.17 struct A {};
66.18 inline bool operator<(A, A) { return true; }
67.1 --- a/test/matrix_maps_test.cc Tue Oct 24 16:49:41 2006 +0000
67.2 +++ b/test/matrix_maps_test.cc Tue Oct 24 17:19:16 2006 +0000
67.3 @@ -21,9 +21,9 @@
67.4
67.5 #include <lemon/concept_check.h>
67.6
67.7 -#include <lemon/concept/matrix_maps.h>
67.8 -#include <lemon/concept/maps.h>
67.9 -#include <lemon/concept/graph.h>
67.10 +#include <lemon/concepts/matrix_maps.h>
67.11 +#include <lemon/concepts/maps.h>
67.12 +#include <lemon/concepts/graph.h>
67.13
67.14 #include <lemon/matrix_maps.h>
67.15
67.16 @@ -35,7 +35,7 @@
67.17
67.18
67.19 using namespace lemon;
67.20 -using namespace lemon::concept;
67.21 +using namespace lemon::concepts;
67.22
67.23 int main() {
67.24 typedef SmartGraph Graph;
68.1 --- a/test/path_test.cc Tue Oct 24 16:49:41 2006 +0000
68.2 +++ b/test/path_test.cc Tue Oct 24 17:19:16 2006 +0000
68.3 @@ -19,8 +19,8 @@
68.4 #include <string>
68.5 #include <iostream>
68.6
68.7 -#include <lemon/concept/path.h>
68.8 -#include <lemon/concept/graph.h>
68.9 +#include <lemon/concepts/path.h>
68.10 +#include <lemon/concepts/graph.h>
68.11
68.12 #include <lemon/path.h>
68.13 #include <lemon/list_graph.h>
68.14 @@ -31,11 +31,11 @@
68.15 using namespace lemon;
68.16
68.17 void check_concepts() {
68.18 - checkConcept<concept::Path<concept::Graph>,
68.19 - concept::Path<concept::Graph> >();
68.20 - checkConcept<concept::Path<concept::Graph>,
68.21 - Path<concept::Graph> >();
68.22 - checkConcept<concept::Path<ListGraph>, Path<ListGraph> >();
68.23 + checkConcept<concepts::Path<concepts::Graph>,
68.24 + concepts::Path<concepts::Graph> >();
68.25 + checkConcept<concepts::Path<concepts::Graph>,
68.26 + Path<concepts::Graph> >();
68.27 + checkConcept<concepts::Path<ListGraph>, Path<ListGraph> >();
68.28 }
68.29
68.30 int main() {
69.1 --- a/test/preflow_test.cc Tue Oct 24 16:49:41 2006 +0000
69.2 +++ b/test/preflow_test.cc Tue Oct 24 17:19:16 2006 +0000
69.3 @@ -23,21 +23,21 @@
69.4 #include <lemon/smart_graph.h>
69.5 #include <lemon/dimacs.h>
69.6 #include <lemon/preflow.h>
69.7 -#include <lemon/concept/graph.h>
69.8 -#include <lemon/concept/maps.h>
69.9 +#include <lemon/concepts/graph.h>
69.10 +#include <lemon/concepts/maps.h>
69.11
69.12 using namespace lemon;
69.13
69.14 void check_Preflow()
69.15 {
69.16 typedef int VType;
69.17 - typedef concept::Graph Graph;
69.18 + typedef concepts::Graph Graph;
69.19
69.20 typedef Graph::Node Node;
69.21 typedef Graph::Edge Edge;
69.22 - typedef concept::ReadMap<Edge,VType> CapMap;
69.23 - typedef concept::ReadWriteMap<Edge,VType> FlowMap;
69.24 - typedef concept::ReadWriteMap<Node,bool> CutMap;
69.25 + typedef concepts::ReadMap<Edge,VType> CapMap;
69.26 + typedef concepts::ReadWriteMap<Edge,VType> FlowMap;
69.27 + typedef concepts::ReadWriteMap<Node,bool> CutMap;
69.28
69.29 typedef Preflow<Graph, int, CapMap, FlowMap> PType;
69.30
70.1 --- a/test/test_tools.h Tue Oct 24 16:49:41 2006 +0000
70.2 +++ b/test/test_tools.h Tue Oct 24 17:19:16 2006 +0000
70.3 @@ -26,7 +26,7 @@
70.4 #include <ctime>
70.5
70.6 #include <lemon/concept_check.h>
70.7 -#include <lemon/concept/graph.h>
70.8 +#include <lemon/concepts/graph.h>
70.9
70.10 #include <lemon/random.h>
70.11
71.1 --- a/test/ugraph_test.cc Tue Oct 24 16:49:41 2006 +0000
71.2 +++ b/test/ugraph_test.cc Tue Oct 24 17:19:16 2006 +0000
71.3 @@ -17,7 +17,7 @@
71.4 */
71.5
71.6 #include <lemon/bits/graph_extender.h>
71.7 -#include <lemon/concept/ugraph.h>
71.8 +#include <lemon/concepts/ugraph.h>
71.9 #include <lemon/list_graph.h>
71.10 #include <lemon/smart_graph.h>
71.11 #include <lemon/full_graph.h>
71.12 @@ -29,7 +29,7 @@
71.13
71.14
71.15 using namespace lemon;
71.16 -using namespace lemon::concept;
71.17 +using namespace lemon::concepts;
71.18
71.19 void check_concepts() {
71.20