# HG changeset patch # User alpar # Date 1161710356 0 # Node ID 4274224f8a7d7f6e40775b907c9c742976b6a3af # Parent da142c310d022f0309a4d2d6a0b97aac2dfc0372 concept -> concepts (namespace & directory) diff -r da142c310d02 -r 4274224f8a7d Makefile.am --- a/Makefile.am Tue Oct 24 16:49:41 2006 +0000 +++ b/Makefile.am Tue Oct 24 17:19:16 2006 +0000 @@ -13,7 +13,7 @@ pkgconfigdir = $(libdir)/pkgconfig lemondir = $(pkgincludedir) bitsdir = $(lemondir)/bits -conceptdir = $(lemondir)/concept +conceptdir = $(lemondir)/concepts pkgconfig_DATA = lib_LTLIBRARIES = lemon_HEADERS = diff -r da142c310d02 -r 4274224f8a7d doc/graphs.dox --- a/doc/graphs.dox Tue Oct 24 16:49:41 2006 +0000 +++ b/doc/graphs.dox Tue Oct 24 17:19:16 2006 +0000 @@ -11,29 +11,29 @@ functionalities to list the nodes and the edges of the graph as well as incoming and outgoing edges of a given node. -Each graph should meet the \ref lemon::concept::Graph "Graph" concept. +Each graph should meet the \ref lemon::concepts::Graph "Graph" concept. This concept does not make it possible to change the graph (i.e. it is not possible to add or delete edges or nodes). Most of the graph algorithms will run on these graphs. In case of graphs meeting the full feature -\ref lemon::concept::ErasableGraph "ErasableGraph" +\ref lemon::concepts::ErasableGraph "ErasableGraph" concept you can also erase individual edges and nodes in arbitrary order. The implemented graph structures are the following. \li \ref lemon::ListGraph "ListGraph" is the most versatile graph class. It meets -the \ref lemon::concept::ErasableGraph "ErasableGraph" concept +the \ref lemon::concepts::ErasableGraph "ErasableGraph" concept and it also has some convenient extra features. \li \ref lemon::SmartGraph "SmartGraph" is a more memory efficient version of \ref lemon::ListGraph "ListGraph". The price of this is that it only meets the -\ref lemon::concept::ExtendableGraph "ExtendableGraph" concept, +\ref lemon::concepts::ExtendableGraph "ExtendableGraph" concept, so you cannot delete individual edges or nodes. \li \ref lemon::FullGraph "FullGraph" implements a complete graph. It is a -\ref lemon::concept::Graph "Graph", so you cannot +\ref lemon::concepts::Graph "Graph", so you cannot change the number of nodes once it is constructed. It is extremely memory efficient: it uses constant amount of memory independently from the number of the nodes of the graph. Of course, the size of the \ref maps-page "NodeMap"'s and diff -r da142c310d02 -r 4274224f8a7d doc/groups.dox --- a/doc/groups.dox Tue Oct 24 16:49:41 2006 +0000 +++ b/doc/groups.dox Tue Oct 24 17:19:16 2006 +0000 @@ -76,7 +76,7 @@ Map adaptors are used to create "implicit" maps from other maps. -Most of them are \ref lemon::concept::ReadMap "ReadMap"s. They can +Most of them are \ref lemon::concepts::ReadMap "ReadMap"s. They can make arithmetic operations between one or two maps (negation, scaling, addition, multiplication etc.) or e.g. convert a map to another one of different Value type. @@ -102,7 +102,7 @@ using a standard Builder subclass. This make is easy to have e.g. the Dijkstra algorithm to store its result in any kind of path structure. -\sa lemon::concept::Path +\sa lemon::concepts::Path */ diff -r da142c310d02 -r 4274224f8a7d doc/maps.dox --- a/doc/maps.dox Tue Oct 24 16:49:41 2006 +0000 +++ b/doc/maps.dox Tue Oct 24 17:19:16 2006 +0000 @@ -13,11 +13,11 @@ \endcode A map can be -\e readable (\ref lemon::concept::ReadMap "ReadMap", for short), -\e writable (\ref lemon::concept::WriteMap "WriteMap") or both -(\ref lemon::concept::ReadWriteMap "ReadWriteMap"). +\e readable (\ref lemon::concepts::ReadMap "ReadMap", for short), +\e writable (\ref lemon::concepts::WriteMap "WriteMap") or both +(\ref lemon::concepts::ReadWriteMap "ReadWriteMap"). There also exists a special type of -ReadWrite map called \ref lemon::concept::ReferenceMap "reference map". +ReadWrite map called \ref lemon::concepts::ReferenceMap "reference map". In addition that you can read and write the values of a key, a reference map can also give you a reference to the diff -r da142c310d02 -r 4274224f8a7d doc/namespaces.dox --- a/doc/namespaces.dox Tue Oct 24 16:49:41 2006 +0000 +++ b/doc/namespaces.dox Tue Oct 24 17:19:16 2006 +0000 @@ -8,5 +8,5 @@ /// The namespace of LEMON concepts and concept checking classes /// - namespace concept {} + namespace concepts {} } diff -r da142c310d02 -r 4274224f8a7d lemon/Makefile.am --- a/lemon/Makefile.am Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/Makefile.am Tue Oct 24 17:19:16 2006 +0000 @@ -121,11 +121,11 @@ concept_HEADERS += \ lemon/concept_check.h \ - lemon/concept/bpugraph.h \ - lemon/concept/graph.h \ - lemon/concept/graph_components.h \ - lemon/concept/heap.h \ - lemon/concept/maps.h \ - lemon/concept/matrix_maps.h \ - lemon/concept/path.h \ - lemon/concept/ugraph.h + lemon/concepts/bpugraph.h \ + lemon/concepts/graph.h \ + lemon/concepts/graph_components.h \ + lemon/concepts/heap.h \ + lemon/concepts/maps.h \ + lemon/concepts/matrix_maps.h \ + lemon/concepts/path.h \ + lemon/concepts/ugraph.h diff -r da142c310d02 -r 4274224f8a7d lemon/bellman_ford.h --- a/lemon/bellman_ford.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bellman_ford.h Tue Oct 24 17:19:16 2006 +0000 @@ -92,7 +92,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; // The type of the length of the edges. @@ -110,7 +110,7 @@ /// /// The type of the map that stores the last /// edges of the shortest paths. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; @@ -125,7 +125,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; @@ -146,7 +146,7 @@ /// \ingroup flowalgs /// This class provides an efficient implementation of \c Bellman-Ford /// algorithm. The edge lengths are passed to the algorithm using a - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any /// kind of length. /// /// The Bellman-Ford algorithm solves the shortest path from one node @@ -158,13 +158,13 @@ /// The maximal time complexity of the algorithm is \f$ O(ne) \f$. /// /// The type of the length is determined by the - /// \ref concept::ReadMap::Value "Value" of the length map. + /// \ref concepts::ReadMap::Value "Value" of the length map. /// /// \param _Graph The graph type the algorithm runs on. The default value /// is \ref ListGraph. The value of _Graph is not used directly by /// BellmanFord, it is only passed to \ref BellmanFordDefaultTraits. /// \param _LengthMap This read-only EdgeMap determines the lengths of the - /// edges. The default map type is \ref concept::Graph::EdgeMap + /// edges. The default map type is \ref concepts::Graph::EdgeMap /// "Graph::EdgeMap". The value of _LengthMap is not used directly /// by BellmanFord, it is only passed to \ref BellmanFordDefaultTraits. /// \param _Traits Traits class to set various data types used by the @@ -790,7 +790,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; /// \brief The value type of the length map. @@ -808,7 +808,7 @@ /// /// The type of the map that stores the last /// edges of the shortest paths. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. typedef NullMap PredMap; /// \brief Instantiates a PredMap. @@ -820,7 +820,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. typedef NullMap DistMap; /// \brief Instantiates a DistMap. /// diff -r da142c310d02 -r 4274224f8a7d lemon/bfs.h --- a/lemon/bfs.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bfs.h Tue Oct 24 17:19:16 2006 +0000 @@ -47,7 +47,7 @@ /// ///The type of the map that stores the last ///edges of the shortest paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; ///Instantiates a PredMap. @@ -62,7 +62,7 @@ ///The type of the map that indicates which nodes are processed. ///The type of the map that indicates which nodes are processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef NullMap ProcessedMap; ///Instantiates a ProcessedMap. @@ -81,7 +81,7 @@ ///The type of the map that indicates which nodes are reached. ///The type of the map that indicates which nodes are reached. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef typename Graph::template NodeMap ReachedMap; ///Instantiates a ReachedMap. @@ -96,7 +96,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; ///Instantiates a DistMap. @@ -705,7 +705,7 @@ /// ///The type of the map that stores the last ///edges of the shortest paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap PredMap; ///Instantiates a PredMap. @@ -725,7 +725,7 @@ ///The type of the map that indicates which nodes are processed. ///The type of the map that indicates which nodes are processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef NullMap ProcessedMap; ///Instantiates a ProcessedMap. @@ -744,7 +744,7 @@ ///The type of the map that indicates which nodes are reached. ///The type of the map that indicates which nodes are reached. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef typename Graph::template NodeMap ReachedMap; ///Instantiates a ReachedMap. @@ -759,7 +759,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap DistMap; ///Instantiates a DistMap. diff -r da142c310d02 -r 4274224f8a7d lemon/bits/array_map.h --- a/lemon/bits/array_map.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/array_map.h Tue Oct 24 17:19:16 2006 +0000 @@ -24,7 +24,7 @@ #include #include #include -#include +#include /// \ingroup graphbits /// \file @@ -141,7 +141,7 @@ /// is assigned by the value of the given ReadMap. template ArrayMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + checkConcept, CMap>(); const typename Parent::Notifier* notifier = Parent::getNotifier(); Item it; for (notifier->first(it); it != INVALID; notifier->next(it)) { diff -r da142c310d02 -r 4274224f8a7d lemon/bits/base_extender.h --- a/lemon/bits/base_extender.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/base_extender.h Tue Oct 24 17:19:16 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include ///\ingroup graphbits ///\file diff -r da142c310d02 -r 4274224f8a7d lemon/bits/debug_map.h --- a/lemon/bits/debug_map.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/debug_map.h Tue Oct 24 17:19:16 2006 +0000 @@ -29,7 +29,7 @@ #include #include -#include +#include ///\ingroup graphbits /// @@ -186,7 +186,7 @@ /// is assigned by the value of the given ReadMap. template DebugMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + checkConcept, CMap>(); const typename Parent::Notifier* notifier = Parent::getNotifier(); Item it; for (notifier->first(it); it != INVALID; notifier->next(it)) { diff -r da142c310d02 -r 4274224f8a7d lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/graph_extender.h Tue Oct 24 17:19:16 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include ///\ingroup graphbits ///\file @@ -1128,7 +1128,7 @@ template NodeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + checkConcept, CMap>(); aNodeMap = cmap; bNodeMap = cmap; return *this; diff -r da142c310d02 -r 4274224f8a7d lemon/bits/map_extender.h --- a/lemon/bits/map_extender.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/map_extender.h Tue Oct 24 17:19:16 2006 +0000 @@ -24,7 +24,7 @@ #include #include -#include +#include ///\file ///\brief Extenders for iterable maps. @@ -206,7 +206,7 @@ template SubMapExtender& operator=(const CMap& cmap) { - checkConcept, CMap>(); + checkConcept, CMap>(); Item it; for (graph.first(it); it != INVALID; graph.next(it)) { Parent::set(it, cmap[it]); diff -r da142c310d02 -r 4274224f8a7d lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/bits/vector_map.h Tue Oct 24 17:19:16 2006 +0000 @@ -28,7 +28,7 @@ #include #include -#include +#include ///\ingroup graphbits /// @@ -133,7 +133,7 @@ /// is assigned by the value of the given ReadMap. template VectorMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + checkConcept, CMap>(); const typename Parent::Notifier* notifier = Parent::getNotifier(); Item it; for (notifier->first(it); it != INVALID; notifier->next(it)) { diff -r da142c310d02 -r 4274224f8a7d lemon/color.h --- a/lemon/color.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/color.h Tue Oct 24 17:19:16 2006 +0000 @@ -100,7 +100,7 @@ ///to each int. It is possible to change the colors as well as their ///number. The integer range is cyclically mapped to the provided set of colors. /// -///This is a true \ref concept::ReferenceMap "reference map", so you can also +///This is a true \ref concepts::ReferenceMap "reference map", so you can also ///change the actual colors. class Palette : public MapBase diff -r da142c310d02 -r 4274224f8a7d lemon/concept/bpugraph.h --- a/lemon/concept/bpugraph.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1020 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -/// \ingroup graph_concepts -/// \file -/// \brief Undirected bipartite graphs and components of. - - -#ifndef LEMON_CONCEPT_BPUGRAPH_H -#define LEMON_CONCEPT_BPUGRAPH_H - -#include - -#include -#include - -#include - -namespace lemon { - namespace concept { - - /// \addtogroup graph_concepts - /// @{ - - - /// \brief Class describing the concept of Bipartite Undirected Graphs. - /// - /// This class describes the common interface of all - /// Undirected Bipartite Graphs. - /// - /// As all concept describing classes it provides only interface - /// without any sensible implementation. So any algorithm for - /// bipartite undirected graph should compile with this class, but it - /// will not run properly, of course. - /// - /// In LEMON bipartite undirected graphs also fulfill the concept of - /// the undirected graphs (\ref lemon::concept::UGraph "UGraph Concept"). - /// - /// You can assume that all undirected bipartite graph can be handled - /// as an undirected graph and consequently as a static graph. - /// - /// The bipartite graph stores two types of nodes which are named - /// ANode and BNode. The graph type contains two types ANode and - /// BNode which are inherited from Node type. Moreover they have - /// constructor which converts Node to either ANode or BNode when - /// it is possible. Therefor everywhere the Node type can be used - /// instead of ANode and BNode. So the usage of the ANode and - /// BNode is not suggested. - /// - /// The iteration on the partition can be done with the ANodeIt and - /// BNodeIt classes. The node map can be used to map values to the nodes - /// and similarly we can use to map values for just the ANodes and - /// BNodes the ANodeMap and BNodeMap template classes. - - class BpUGraph { - public: - /// \brief The undirected graph should be tagged by the - /// UndirectedTag. - /// - /// The undirected graph should be tagged by the UndirectedTag. This - /// tag helps the enable_if technics to make compile time - /// specializations for undirected graphs. - typedef True UndirectedTag; - - /// \brief The base type of node iterators, - /// or in other words, the trivial node iterator. - /// - /// This is the base type of each node iterator, - /// thus each kind of node iterator converts to this. - /// More precisely each kind of node iterator should be inherited - /// from the trivial node iterator. The Node class represents - /// both of two types of nodes. - class Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - Node(const Node&) { } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - Node(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Node) const { return true; } - - /// Inequality operator - - /// \sa operator==(Node n) - /// - bool operator!=(Node) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Node) const { return false; } - - }; - - /// \brief Helper class for ANodes. - /// - /// This class is just a helper class for ANodes, it is not - /// suggested to use it directly. It can be converted easily to - /// node and vice versa. The usage of this class is limited - /// to use just as template parameters for special map types. - class ANode : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - ANode() : Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - ANode(const ANode&) : Node() { } - - /// Construct the same node as ANode. - - /// Construct the same node as ANode. It may throws assertion - /// when the given node is from the BNode set. - ANode(const Node&) : Node() { } - - /// Assign node to A-node. - - /// Besides the core graph item functionality each node should - /// be convertible to the represented A-node if it is it possible. - ANode& operator=(const Node&) { return *this; } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - ANode(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(ANode) const { return true; } - - /// Inequality operator - - /// \sa operator==(ANode n) - /// - bool operator!=(ANode) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(ANode) const { return false; } - - }; - - /// \brief Helper class for BNodes. - /// - /// This class is just a helper class for BNodes, it is not - /// suggested to use it directly. It can be converted easily to - /// node and vice versa. The usage of this class is limited - /// to use just as template parameters for special map types. - class BNode : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - BNode() : Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - BNode(const BNode&) : Node() { } - - /// Construct the same node as BNode. - - /// Construct the same node as BNode. It may throws assertion - /// when the given node is from the ANode set. - BNode(const Node&) : Node() { } - - /// Assign node to B-node. - - /// Besides the core graph item functionality each node should - /// be convertible to the represented B-node if it is it possible. - BNode& operator=(const Node&) { return *this; } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - BNode(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(BNode) const { return true; } - - /// Inequality operator - - /// \sa operator==(BNode n) - /// - bool operator!=(BNode) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(BNode) const { return false; } - - }; - - /// This iterator goes through each node. - - /// This iterator goes through each node. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - ///\code - /// int count=0; - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; - ///\endcode - class NodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - NodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - NodeIt(const NodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - NodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - NodeIt(const BpUGraph&) { } - /// Node -> NodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - NodeIt(const BpUGraph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - NodeIt& operator++() { return *this; } - }; - - /// This iterator goes through each ANode. - - /// This iterator goes through each ANode. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - ///\code - /// int count=0; - /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count; - ///\endcode - class ANodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - ANodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - ANodeIt(const ANodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - ANodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - ANodeIt(const BpUGraph&) { } - /// Node -> ANodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - ANodeIt(const BpUGraph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - ANodeIt& operator++() { return *this; } - }; - - /// This iterator goes through each BNode. - - /// This iterator goes through each BNode. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - ///\code - /// int count=0; - /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count; - ///\endcode - class BNodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - BNodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - BNodeIt(const BNodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - BNodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - BNodeIt(const BpUGraph&) { } - /// Node -> BNodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - BNodeIt(const BpUGraph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - BNodeIt& operator++() { return *this; } - }; - - - /// The base type of the undirected edge iterators. - - /// The base type of the undirected edge iterators. - /// - class UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UEdge() { } - /// Copy constructor. - - /// Copy constructor. - /// - UEdge(const UEdge&) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UEdge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(UEdge) const { return true; } - /// Inequality operator - - /// \sa operator==(UEdge n) - /// - bool operator!=(UEdge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(UEdge) const { return false; } - }; - - /// This iterator goes through each undirected edge. - - /// This iterator goes through each undirected edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of undirected edges in a graph \c g of type \c Graph as follows: - ///\code - /// int count=0; - /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; - ///\endcode - class UEdgeIt : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - UEdgeIt(const UEdgeIt& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first undirected edge. - - /// This constructor sets the iterator to the first undirected edge. - UEdgeIt(const BpUGraph&) { } - /// UEdge -> UEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the undirected edge-set, the iteration order is the - /// same. - UEdgeIt(const BpUGraph&, const UEdge&) { } - /// Next undirected edge - - /// Assign the iterator to the next undirected edge. - UEdgeIt& operator++() { return *this; } - }; - - /// \brief This iterator goes trough the incident undirected - /// edges of a node. - /// - /// This iterator goes trough the incident undirected edges - /// of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can compute the - /// degree (i.e. count the number - /// of incident edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - class IncEdgeIt : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - IncEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - IncEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incident edge. - - /// This constructor set the iterator to the first incident edge of - /// the node. - IncEdgeIt(const BpUGraph&, const Node&) { } - /// UEdge -> IncEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - IncEdgeIt(const BpUGraph&, const UEdge&) { } - /// Next incident edge - - /// Assign the iterator to the next incident edge - /// of the corresponding node. - IncEdgeIt& operator++() { return *this; } - }; - - /// The directed edge type. - - /// The directed edge type. It can be converted to the - /// undirected edge. - class Edge : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Edge() { } - /// Copy constructor. - - /// Copy constructor. - /// - Edge(const Edge& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - Edge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Edge) const { return true; } - /// Inequality operator - - /// \sa operator==(Edge n) - /// - bool operator!=(Edge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Edge) const { return false; } - - }; - /// This iterator goes through each directed edge. - - /// This iterator goes through each edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of edges in a graph \c g of type \c Graph as follows: - ///\code - /// int count=0; - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; - ///\endcode - class EdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - EdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - EdgeIt(const EdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - EdgeIt(Invalid) { } - /// This constructor sets the iterator to the first edge. - - /// This constructor sets the iterator to the first edge of \c g. - ///@param g the graph - EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); } - /// Edge -> EdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - EdgeIt(const BpUGraph&, const Edge&) { } - ///Next edge - - /// Assign the iterator to the next edge. - EdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the outgoing directed edges of a node. - - /// This iterator goes trough the \e outgoing edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class OutEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - OutEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - OutEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first outgoing edge. - - /// This constructor sets the iterator to the first outgoing edge of - /// the node. - ///@param n the node - ///@param g the graph - OutEdgeIt(const BpUGraph& n, const Node& g) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> OutEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - OutEdgeIt(const BpUGraph&, const Edge&) { } - ///Next outgoing edge - - /// Assign the iterator to the next - /// outgoing edge of the corresponding node. - OutEdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the incoming directed edges of a node. - - /// This iterator goes trough the \e incoming edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class InEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - InEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - InEdgeIt(const InEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - InEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incoming edge. - - /// This constructor set the iterator to the first incoming edge of - /// the node. - ///@param n the node - ///@param g the graph - InEdgeIt(const BpUGraph& g, const Node& n) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> InEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - InEdgeIt(const BpUGraph&, const Edge&) { } - /// Next incoming edge - - /// Assign the iterator to the next inedge of the corresponding node. - /// - InEdgeIt& operator++() { return *this; } - }; - - /// \brief Read write map of the nodes to type \c T. - /// - /// ReadWrite map of the nodes to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (NodeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class NodeMap : public ReadWriteMap< Node, T > - { - public: - - ///\e - NodeMap(const BpUGraph&) { } - ///\e - NodeMap(const BpUGraph&, T) { } - - ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - NodeMap& operator=(const NodeMap&) { return *this; } - ///Assignment operator - template - NodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Read write map of the ANodes to type \c T. - /// - /// ReadWrite map of the ANodes to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (NodeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class ANodeMap : public ReadWriteMap< Node, T > - { - public: - - ///\e - ANodeMap(const BpUGraph&) { } - ///\e - ANodeMap(const BpUGraph&, T) { } - - ///Copy constructor - ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - ANodeMap& operator=(const ANodeMap&) { return *this; } - ///Assignment operator - template - ANodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Read write map of the BNodes to type \c T. - /// - /// ReadWrite map of the BNodes to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (NodeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class BNodeMap : public ReadWriteMap< Node, T > - { - public: - - ///\e - BNodeMap(const BpUGraph&) { } - ///\e - BNodeMap(const BpUGraph&, T) { } - - ///Copy constructor - BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - BNodeMap& operator=(const BNodeMap&) { return *this; } - ///Assignment operator - template - BNodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Read write map of the directed edges to type \c T. - /// - /// Reference map of the directed edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (EdgeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class EdgeMap : public ReadWriteMap - { - public: - - ///\e - EdgeMap(const BpUGraph&) { } - ///\e - EdgeMap(const BpUGraph&, T) { } - ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } - ///Assignment operator - EdgeMap& operator=(const EdgeMap&) { return *this; } - ///Assignment operator - template - EdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// Read write map of the undirected edges to type \c T. - - /// Reference map of the edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (UEdgeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class UEdgeMap : public ReadWriteMap - { - public: - - ///\e - UEdgeMap(const BpUGraph&) { } - ///\e - UEdgeMap(const BpUGraph&, T) { } - ///Copy constructor - UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} - ///Assignment operator - UEdgeMap &operator=(const UEdgeMap&) { return *this; } - ///Assignment operator - template - UEdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge source - /// will be the given node. - Edge direct(const UEdge&, const Node&) const { - return INVALID; - } - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge - /// represents the given undireted edge and the direction comes - /// from the given bool. The source of the undirected edge and - /// the directed edge is the same when the given bool is true. - Edge direct(const UEdge&, bool) const { - return INVALID; - } - - /// \brief Returns true when the given node is an ANode. - /// - /// Returns true when the given node is an ANode. - bool aNode(Node) const { return true;} - - /// \brief Returns true when the given node is an BNode. - /// - /// Returns true when the given node is an BNode. - bool bNode(Node) const { return true;} - - /// \brief Returns the edge's end node which is in the ANode set. - /// - /// Returns the edge's end node which is in the ANode set. - Node aNode(UEdge) const { return INVALID;} - - /// \brief Returns the edge's end node which is in the BNode set. - /// - /// Returns the edge's end node which is in the BNode set. - Node bNode(UEdge) const { return INVALID;} - - /// \brief Returns true if the edge has default orientation. - /// - /// Returns whether the given directed edge is same orientation as - /// the corresponding undirected edge's default orientation. - bool direction(Edge) const { return true; } - - /// \brief Returns the opposite directed edge. - /// - /// Returns the opposite directed edge. - Edge oppositeEdge(Edge) const { return INVALID; } - - /// \brief Opposite node on an edge - /// - /// \return the opposite of the given Node on the given UEdge - Node oppositeNode(Node, UEdge) const { return INVALID; } - - /// \brief First node of the undirected edge. - /// - /// \return the first node of the given UEdge. - /// - /// Naturally undirected edges don't have direction and thus - /// don't have source and target node. But we use these two methods - /// to query the two endnodes of the edge. The direction of the edge - /// which arises this way is called the inherent direction of the - /// undirected edge, and is used to define the "default" direction - /// of the directed versions of the edges. - /// \sa direction - Node source(UEdge) const { return INVALID; } - - /// \brief Second node of the undirected edge. - Node target(UEdge) const { return INVALID; } - - /// \brief Source node of the directed edge. - Node source(Edge) const { return INVALID; } - - /// \brief Target node of the directed edge. - Node target(Edge) const { return INVALID; } - - /// \brief Base node of the iterator - /// - /// Returns the base node (the source in this case) of the iterator - Node baseNode(OutEdgeIt e) const { - return source(e); - } - - /// \brief Running node of the iterator - /// - /// Returns the running node (the target in this case) of the - /// iterator - Node runningNode(OutEdgeIt e) const { - return target(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node (the target in this case) of the iterator - Node baseNode(InEdgeIt e) const { - return target(e); - } - /// \brief Running node of the iterator - /// - /// Returns the running node (the source in this case) of the - /// iterator - Node runningNode(InEdgeIt e) const { - return source(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node of the iterator - Node baseNode(IncEdgeIt) const { - return INVALID; - } - - /// \brief Running node of the iterator - /// - /// Returns the running node of the iterator - Node runningNode(IncEdgeIt) const { - return INVALID; - } - - void first(Node&) const {} - void next(Node&) const {} - - void first(Edge&) const {} - void next(Edge&) const {} - - void first(UEdge&) const {} - void next(UEdge&) const {} - - void firstANode(Node&) const {} - void nextANode(Node&) const {} - - void firstBNode(Node&) const {} - void nextBNode(Node&) const {} - - void firstIn(Edge&, const Node&) const {} - void nextIn(Edge&) const {} - - void firstOut(Edge&, const Node&) const {} - void nextOut(Edge&) const {} - - void firstInc(UEdge &, bool &, const Node &) const {} - void nextInc(UEdge &, bool &) const {} - - void firstFromANode(UEdge&, const Node&) const {} - void nextFromANode(UEdge&) const {} - - void firstFromBNode(UEdge&, const Node&) const {} - void nextFromBNode(UEdge&) const {} - - template - struct Constraints { - void constraints() { - checkConcept, Graph>(); - checkConcept, Graph>(); - } - }; - - }; - - - /// @} - - } - -} - -#endif diff -r da142c310d02 -r 4274224f8a7d lemon/concept/graph.h --- a/lemon/concept/graph.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,455 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_CONCEPT_GRAPH_H -#define LEMON_CONCEPT_GRAPH_H - -///\ingroup graph_concepts -///\file -///\brief Declaration of Graph. - -#include -#include -#include -#include -#include - -namespace lemon { - namespace concept { - - /// \addtogroup graph_concepts - /// @{ - - /// The directed graph concept - - /// This class describes the \ref concept "concept" of the - /// immutable directed graphs. - /// - /// Note that actual graph implementation like @ref ListGraph or - /// @ref SmartGraph may have several additional functionality. - /// - /// \sa concept - class Graph { - private: - ///Graphs are \e not copy constructible. Use GraphCopy() instead. - - ///Graphs are \e not copy constructible. Use GraphCopy() instead. - /// - Graph(const Graph &) {}; - ///\brief Assignment of \ref Graph "Graph"s to another ones are - ///\e not allowed. Use GraphCopy() instead. - - ///Assignment of \ref Graph "Graph"s to another ones are - ///\e not allowed. Use GraphCopy() instead. - - void operator=(const Graph &) {} - public: - ///\e - - /// Defalult constructor. - - /// Defalult constructor. - /// - Graph() { } - /// Class for identifying a node of the graph - - /// This class identifies a node of the graph. It also serves - /// as a base class of the node iterators, - /// thus they will convert to this type. - class Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - Node(const Node&) { } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - Node(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Node) const { return true; } - - /// Inequality operator - - /// \sa operator==(Node n) - /// - bool operator!=(Node) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Node) const { return false; } - - }; - - /// This iterator goes through each node. - - /// This iterator goes through each node. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - ///\code - /// int count=0; - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; - ///\endcode - class NodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - NodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - NodeIt(const NodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - NodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - NodeIt(const Graph&) { } - /// Node -> NodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - NodeIt(const Graph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - NodeIt& operator++() { return *this; } - }; - - - /// Class for identifying an edge of the graph - - /// This class identifies an edge of the graph. It also serves - /// as a base class of the edge iterators, - /// thus they will convert to this type. - class Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Edge() { } - /// Copy constructor. - - /// Copy constructor. - /// - Edge(const Edge&) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - Edge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Edge) const { return true; } - /// Inequality operator - - /// \sa operator==(Edge n) - /// - bool operator!=(Edge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Edge) const { return false; } - }; - - /// This iterator goes trough the outgoing edges of a node. - - /// This iterator goes trough the \e outgoing edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class OutEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - OutEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - OutEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first outgoing edge. - - /// This constructor sets the iterator to the first outgoing edge of - /// the node. - OutEdgeIt(const Graph&, const Node&) { } - /// Edge -> OutEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - OutEdgeIt(const Graph&, const Edge&) { } - ///Next outgoing edge - - /// Assign the iterator to the next - /// outgoing edge of the corresponding node. - OutEdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the incoming edges of a node. - - /// This iterator goes trough the \e incoming edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class InEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - InEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - InEdgeIt(const InEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - InEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incoming edge. - - /// This constructor set the iterator to the first incoming edge of - /// the node. - InEdgeIt(const Graph&, const Node&) { } - /// Edge -> InEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - InEdgeIt(const Graph&, const Edge&) { } - /// Next incoming edge - - /// Assign the iterator to the next inedge of the corresponding node. - /// - InEdgeIt& operator++() { return *this; } - }; - /// This iterator goes through each edge. - - /// This iterator goes through each edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of edges in a graph \c g of type \c Graph as follows: - ///\code - /// int count=0; - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; - ///\endcode - class EdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - EdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - EdgeIt(const EdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - EdgeIt(Invalid) { } - /// This constructor sets the iterator to the first edge. - - /// This constructor sets the iterator to the first edge of \c g. - ///@param g the graph - EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); } - /// Edge -> EdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - EdgeIt(const Graph&, const Edge&) { } - ///Next edge - - /// Assign the iterator to the next edge. - EdgeIt& operator++() { return *this; } - }; - ///Gives back the target node of an edge. - - ///Gives back the target node of an edge. - /// - Node target(Edge) const { return INVALID; } - ///Gives back the source node of an edge. - - ///Gives back the source node of an edge. - /// - Node source(Edge) const { return INVALID; } - - void first(Node&) const {} - void next(Node&) const {} - - void first(Edge&) const {} - void next(Edge&) const {} - - - void firstIn(Edge&, const Node&) const {} - void nextIn(Edge&) const {} - - void firstOut(Edge&, const Node&) const {} - void nextOut(Edge&) const {} - - /// \brief The base node of the iterator. - /// - /// Gives back the base node of the iterator. - /// It is always the target of the pointed edge. - Node baseNode(const InEdgeIt&) const { return INVALID; } - - /// \brief The running node of the iterator. - /// - /// Gives back the running node of the iterator. - /// It is always the source of the pointed edge. - Node runningNode(const InEdgeIt&) const { return INVALID; } - - /// \brief The base node of the iterator. - /// - /// Gives back the base node of the iterator. - /// It is always the source of the pointed edge. - Node baseNode(const OutEdgeIt&) const { return INVALID; } - - /// \brief The running node of the iterator. - /// - /// Gives back the running node of the iterator. - /// It is always the target of the pointed edge. - Node runningNode(const OutEdgeIt&) const { return INVALID; } - - /// \brief The opposite node on the given edge. - /// - /// Gives back the opposite node on the given edge. - Node oppositeNode(const Node&, const Edge&) const { return INVALID; } - - /// \brief Read write map of the nodes to type \c T. - /// - /// ReadWrite map of the nodes to type \c T. - /// \sa Reference - template - class NodeMap : public ReadWriteMap< Node, T > { - public: - - ///\e - NodeMap(const Graph&) { } - ///\e - NodeMap(const Graph&, T) { } - - ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - template - NodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Read write map of the edges to type \c T. - /// - /// Reference map of the edges to type \c T. - /// \sa Reference - template - class EdgeMap : public ReadWriteMap { - public: - - ///\e - EdgeMap(const Graph&) { } - ///\e - EdgeMap(const Graph&, T) { } - ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } - ///Assignment operator - template - EdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - template - struct Constraints { - void constraints() { - checkConcept, Graph>(); - checkConcept, Graph>(); - } - }; - - }; - - // @} - } //namespace concept -} //namespace lemon - - - -#endif // LEMON_CONCEPT_GRAPH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concept/graph_components.h --- a/lemon/concept/graph_components.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2103 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -///\ingroup graph_concepts -///\file -///\brief The concept of the graph components. - - -#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H -#define LEMON_CONCEPT_GRAPH_COMPONENTS_H - -#include -#include - -#include - -namespace lemon { - namespace concept { - - /// \brief Skeleton class for graph Node and Edge types - /// - /// This class describes the interface of Node and Edge (and UEdge - /// in undirected graphs) subtypes of graph types. - /// - /// \note This class is a template class so that we can use it to - /// create graph skeleton classes. The reason for this is than Node - /// and Edge types should \em not derive from the same base class. - /// For Node you should instantiate it with character 'n' and for Edge - /// with 'e'. - -#ifndef DOXYGEN - template -#endif - class GraphItem { - public: - /// \brief Default constructor. - /// - /// \warning The default constructor is not required to set - /// the item to some well-defined value. So you should consider it - /// as uninitialized. - GraphItem() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - GraphItem(const GraphItem &) {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - GraphItem(Invalid) {} - /// \brief Assign operator for nodes. - /// - /// The nodes are assignable. - /// - GraphItem& operator=(GraphItem const&) { return *this; } - /// \brief Equality operator. - /// - /// Two iterators are equal if and only if they represents the - /// same node in the graph or both are invalid. - bool operator==(GraphItem) const { return false; } - /// \brief Inequality operator. - /// - /// \sa operator==(const Node& n) - /// - bool operator!=(GraphItem) const { return false; } - - /// \brief Artificial ordering operator. - /// - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(GraphItem) const { return false; } - - template - struct Constraints { - void constraints() { - _GraphItem i1; - _GraphItem i2 = i1; - _GraphItem i3 = INVALID; - - i1 = i2 = i3; - - bool b; - // b = (ia == ib) && (ia != ib) && (ia < ib); - b = (ia == ib) && (ia != ib); - b = (ia == INVALID) && (ib != INVALID); - b = (ia < ib); - } - - const _GraphItem &ia; - const _GraphItem &ib; - }; - }; - - /// \brief An empty base graph class. - /// - /// This class provides the minimal set of features needed for a graph - /// structure. All graph concepts have to be conform to this base - /// graph. It just provides types for nodes and edges and functions to - /// get the source and the target of the edges. - class BaseGraphComponent { - public: - - typedef BaseGraphComponent Graph; - - /// \brief Node class of the graph. - /// - /// This class represents the Nodes of the graph. - /// - typedef GraphItem<'n'> Node; - - /// \brief Edge class of the graph. - /// - /// This class represents the Edges of the graph. - /// - typedef GraphItem<'e'> Edge; - - /// \brief Gives back the target node of an edge. - /// - /// Gives back the target node of an edge. - /// - Node target(const Edge&) const { return INVALID;} - - /// \brief Gives back the source node of an edge. - /// - /// Gives back the source node of an edge. - /// - Node source(const Edge&) const { return INVALID;} - - /// \brief Gives back the opposite node on the given edge. - /// - /// Gives back the opposite node on the given edge. - Node oppositeNode(const Node&, const Edge&) const { - return INVALID; - } - - template - struct Constraints { - typedef typename _Graph::Node Node; - typedef typename _Graph::Edge Edge; - - void constraints() { - checkConcept, Node>(); - checkConcept, Edge>(); - { - Node n; - Edge e(INVALID); - n = graph.source(e); - n = graph.target(e); - n = graph.oppositeNode(n, e); - } - } - - const _Graph& graph; - }; - }; - - /// \brief An empty base undirected graph class. - /// - /// This class provides the minimal set of features needed for an - /// undirected graph structure. All undirected graph concepts have - /// to be conform to this base graph. It just provides types for - /// nodes, edges and undirected edges and functions to get the - /// source and the target of the edges and undirected edges, - /// conversion from edges to undirected edges and function to get - /// both direction of the undirected edges. - class BaseUGraphComponent : public BaseGraphComponent { - public: - typedef BaseGraphComponent::Node Node; - typedef BaseGraphComponent::Edge Edge; - /// \brief Undirected edge class of the graph. - /// - /// This class represents the undirected edges of the graph. - /// The undirected graphs can be used as a directed graph which - /// for each edge contains the opposite edge too so the graph is - /// bidirected. The undirected edge represents two opposite - /// directed edges. - class UEdge : public GraphItem<'u'> { - public: - typedef GraphItem<'u'> Parent; - /// \brief Default constructor. - /// - /// \warning The default constructor is not required to set - /// the item to some well-defined value. So you should consider it - /// as uninitialized. - UEdge() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - UEdge(const UEdge &) : Parent() {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - UEdge(Invalid) {} - /// \brief Converter from edge to undirected edge. - /// - /// Besides the core graph item functionality each edge should - /// be convertible to the represented undirected edge. - UEdge(const Edge&) {} - /// \brief Assign edge to undirected edge. - /// - /// Besides the core graph item functionality each edge should - /// be convertible to the represented undirected edge. - UEdge& operator=(const Edge&) { return *this; } - }; - - /// \brief Returns the direction of the edge. - /// - /// Returns the direction of the edge. Each edge represents an - /// undirected edge with a direction. It gives back the - /// direction. - bool direction(const Edge&) const { return true; } - - /// \brief Returns the directed edge. - /// - /// Returns the directed edge from its direction and the - /// represented undirected edge. - Edge direct(const UEdge&, bool) const { return INVALID;} - - /// \brief Returns the directed edge. - /// - /// Returns the directed edge from its source and the - /// represented undirected edge. - Edge direct(const UEdge&, const Node&) const { return INVALID;} - - /// \brief Returns the opposite edge. - /// - /// Returns the opposite edge. It is the edge representing the - /// same undirected edge and has opposite direction. - Edge oppositeEdge(const Edge&) const { return INVALID;} - - /// \brief Gives back the target node of an undirected edge. - /// - /// Gives back the target node of an undirected edge. The name - /// target is a little confusing because the undirected edge - /// does not have target but it just means that one of the end - /// node. - Node target(const UEdge&) const { return INVALID;} - - /// \brief Gives back the source node of an undirected edge. - /// - /// Gives back the source node of an undirected edge. The name - /// source is a little confusing because the undirected edge - /// does not have source but it just means that one of the end - /// node. - Node source(const UEdge&) const { return INVALID;} - - template - struct Constraints { - typedef typename _Graph::Node Node; - typedef typename _Graph::Edge Edge; - typedef typename _Graph::UEdge UEdge; - - void constraints() { - checkConcept(); - checkConcept, UEdge>(); - { - Node n; - UEdge ue(INVALID); - Edge e; - n = graph.source(ue); - n = graph.target(ue); - e = graph.direct(ue, true); - e = graph.direct(ue, n); - e = graph.oppositeEdge(e); - ue = e; - bool d = graph.direction(e); - ignore_unused_variable_warning(d); - } - } - - const _Graph& graph; - }; - - }; - - /// \brief An empty base bipartite undirected graph class. - /// - /// This class provides the minimal set of features needed for an - /// bipartite undirected graph structure. All bipartite undirected - /// graph concepts have to be conform to this base graph. It just - /// provides types for nodes, A-nodes, B-nodes, edges and - /// undirected edges and functions to get the source and the - /// target of the edges and undirected edges, conversion from - /// edges to undirected edges and function to get both direction - /// of the undirected edges. - class BaseBpUGraphComponent : public BaseUGraphComponent { - public: - typedef BaseUGraphComponent::Node Node; - typedef BaseUGraphComponent::Edge Edge; - typedef BaseUGraphComponent::UEdge UEdge; - - /// \brief Helper class for A-nodes. - /// - /// This class is just a helper class for A-nodes, it is not - /// suggested to use it directly. It can be converted easily to - /// node and vice versa. The usage of this class is limited - /// to use just as template parameters for special map types. - class ANode : public Node { - public: - typedef Node Parent; - - /// \brief Default constructor. - /// - /// \warning The default constructor is not required to set - /// the item to some well-defined value. So you should consider it - /// as uninitialized. - ANode() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - ANode(const ANode &) : Parent() {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - ANode(Invalid) {} - /// \brief Converter from node to A-node. - /// - /// Besides the core graph item functionality each node should - /// be convertible to the represented A-node if it is it possible. - ANode(const Node&) {} - /// \brief Assign node to A-node. - /// - /// Besides the core graph item functionality each node should - /// be convertible to the represented A-node if it is it possible. - ANode& operator=(const Node&) { return *this; } - }; - - /// \brief Helper class for B-nodes. - /// - /// This class is just a helper class for B-nodes, it is not - /// suggested to use it directly. It can be converted easily to - /// node and vice versa. The usage of this class is limited - /// to use just as template parameters for special map types. - class BNode : public Node { - public: - typedef Node Parent; - - /// \brief Default constructor. - /// - /// \warning The default constructor is not required to set - /// the item to some well-defined value. So you should consider it - /// as uninitialized. - BNode() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - BNode(const BNode &) : Parent() {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - BNode(Invalid) {} - /// \brief Converter from node to B-node. - /// - /// Besides the core graph item functionality each node should - /// be convertible to the represented B-node if it is it possible. - BNode(const Node&) {} - /// \brief Assign node to B-node. - /// - /// Besides the core graph item functionality each node should - /// be convertible to the represented B-node if it is it possible. - BNode& operator=(const Node&) { return *this; } - }; - - /// \brief Gives back %true when the node is A-node. - /// - /// Gives back %true when the node is A-node. - bool aNode(const Node&) const { return false; } - - /// \brief Gives back %true when the node is B-node. - /// - /// Gives back %true when the node is B-node. - bool bNode(const Node&) const { return false; } - - /// \brief Gives back the A-node of the undirected edge. - /// - /// Gives back the A-node of the undirected edge. - Node aNode(const UEdge&) const { return INVALID; } - - /// \brief Gives back the B-node of the undirected edge. - /// - /// Gives back the B-node of the undirected edge. - Node bNode(const UEdge&) const { return INVALID; } - - template - struct Constraints { - typedef typename _Graph::Node Node; - typedef typename _Graph::ANode ANode; - typedef typename _Graph::BNode BNode; - typedef typename _Graph::Edge Edge; - typedef typename _Graph::UEdge UEdge; - - void constraints() { - checkConcept(); - checkConcept, ANode>(); - checkConcept, BNode>(); - { - Node n; - UEdge ue(INVALID); - bool b; - n = graph.aNode(ue); - n = graph.bNode(ue); - b = graph.aNode(n); - b = graph.bNode(n); - ANode an; - an = n; n = an; - BNode bn; - bn = n; n = bn; - ignore_unused_variable_warning(b); - } - } - - const _Graph& graph; - }; - - }; - - /// \brief An empty idable base graph class. - /// - /// This class provides beside the core graph features - /// core id functions for the graph structure. - /// The most of the base graphs should be conform to this concept. - /// The id's are unique and immutable. - template - class IDableGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - - /// \brief Gives back an unique integer id for the Node. - /// - /// Gives back an unique integer id for the Node. - /// - int id(const Node&) const { return -1;} - - /// \brief Gives back the node by the unique id. - /// - /// Gives back the node by the unique id. - /// If the graph does not contain node with the given id - /// then the result of the function is undetermined. - Node nodeFromId(int) const { return INVALID;} - - /// \brief Gives back an unique integer id for the Edge. - /// - /// Gives back an unique integer id for the Edge. - /// - int id(const Edge&) const { return -1;} - - /// \brief Gives back the edge by the unique id. - /// - /// Gives back the edge by the unique id. - /// If the graph does not contain edge with the given id - /// then the result of the function is undetermined. - Edge edgeFromId(int) const { return INVALID;} - - /// \brief Gives back an integer greater or equal to the maximum - /// Node id. - /// - /// Gives back an integer greater or equal to the maximum Node - /// id. - int maxNodeId() const { return -1;} - - /// \brief Gives back an integer greater or equal to the maximum - /// Edge id. - /// - /// Gives back an integer greater or equal to the maximum Edge - /// id. - int maxEdgeId() const { return -1;} - - template - struct Constraints { - - void constraints() { - checkConcept(); - typename _Graph::Node node; - int nid = graph.id(node); - nid = graph.id(node); - node = graph.nodeFromId(nid); - typename _Graph::Edge edge; - int eid = graph.id(edge); - eid = graph.id(edge); - edge = graph.edgeFromId(eid); - - nid = graph.maxNodeId(); - ignore_unused_variable_warning(nid); - eid = graph.maxEdgeId(); - ignore_unused_variable_warning(eid); - } - - const _Graph& graph; - }; - }; - - /// \brief An empty idable base undirected graph class. - /// - /// This class provides beside the core undirected graph features - /// core id functions for the undirected graph structure. The - /// most of the base undirected graphs should be conform to this - /// concept. The id's are unique and immutable. - template - class IDableUGraphComponent : public IDableGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::UEdge UEdge; - - using IDableGraphComponent<_Base>::id; - - /// \brief Gives back an unique integer id for the UEdge. - /// - /// Gives back an unique integer id for the UEdge. - /// - int id(const UEdge&) const { return -1;} - - /// \brief Gives back the undirected edge by the unique id. - /// - /// Gives back the undirected edge by the unique id. If the - /// graph does not contain edge with the given id then the - /// result of the function is undetermined. - UEdge uEdgeFromId(int) const { return INVALID;} - - /// \brief Gives back an integer greater or equal to the maximum - /// UEdge id. - /// - /// Gives back an integer greater or equal to the maximum UEdge - /// id. - int maxUEdgeId() const { return -1;} - - template - struct Constraints { - - void constraints() { - checkConcept(); - checkConcept, _Graph >(); - typename _Graph::UEdge uedge; - int ueid = graph.id(uedge); - ueid = graph.id(uedge); - uedge = graph.uEdgeFromId(ueid); - ueid = graph.maxUEdgeId(); - ignore_unused_variable_warning(ueid); - } - - const _Graph& graph; - }; - }; - - /// \brief An empty idable base bipartite undirected graph class. - /// - /// This class provides beside the core bipartite undirected graph - /// features core id functions for the bipartite undirected graph - /// structure. The most of the base undirected graphs should be - /// conform to this concept. - template - class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - - using IDableUGraphComponent<_Base>::id; - - /// \brief Gives back an unique integer id for the ANode. - /// - /// Gives back an unique integer id for the ANode. - /// - int aNodeId(const Node&) const { return -1;} - - /// \brief Gives back the undirected edge by the unique id. - /// - /// Gives back the undirected edge by the unique id. If the - /// graph does not contain edge with the given id then the - /// result of the function is undetermined. - Node nodeFromANodeId(int) const { return INVALID;} - - /// \brief Gives back an integer greater or equal to the maximum - /// ANode id. - /// - /// Gives back an integer greater or equal to the maximum ANode - /// id. - int maxANodeId() const { return -1;} - - /// \brief Gives back an unique integer id for the BNode. - /// - /// Gives back an unique integer id for the BNode. - /// - int bNodeId(const Node&) const { return -1;} - - /// \brief Gives back the undirected edge by the unique id. - /// - /// Gives back the undirected edge by the unique id. If the - /// graph does not contain edge with the given id then the - /// result of the function is undetermined. - Node nodeFromBNodeId(int) const { return INVALID;} - - /// \brief Gives back an integer greater or equal to the maximum - /// BNode id. - /// - /// Gives back an integer greater or equal to the maximum BNode - /// id. - int maxBNodeId() const { return -1;} - - template - struct Constraints { - - void constraints() { - checkConcept(); - checkConcept, _Graph >(); - typename _Graph::Node node(INVALID); - int id; - id = graph.aNodeId(node); - id = graph.bNodeId(node); - node = graph.nodeFromANodeId(id); - node = graph.nodeFromBNodeId(id); - id = graph.maxANodeId(); - id = graph.maxBNodeId(); - } - - const _Graph& graph; - }; - }; - - /// \brief Skeleton class for graph NodeIt and EdgeIt - /// - /// Skeleton class for graph NodeIt and EdgeIt. - /// - template - class GraphItemIt : public _Item { - public: - /// \brief Default constructor. - /// - /// @warning The default constructor sets the iterator - /// to an undefined value. - GraphItemIt() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - GraphItemIt(const GraphItemIt& ) {} - /// \brief Sets the iterator to the first item. - /// - /// Sets the iterator to the first item of \c the graph. - /// - explicit GraphItemIt(const _Graph&) {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - GraphItemIt(Invalid) {} - /// \brief Assign operator for items. - /// - /// The items are assignable. - /// - GraphItemIt& operator=(const GraphItemIt&) { return *this; } - /// \brief Next item. - /// - /// Assign the iterator to the next item. - /// - GraphItemIt& operator++() { return *this; } - /// \brief Equality operator - /// - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(const GraphItemIt&) const { return true;} - /// \brief Inequality operator - /// - /// \sa operator==(Node n) - /// - bool operator!=(const GraphItemIt&) const { return true;} - - template - struct Constraints { - void constraints() { - _GraphItemIt it1(g); - _GraphItemIt it2; - - it2 = ++it1; - ++it2 = it1; - ++(++it1); - - _Item bi = it1; - bi = it2; - } - _Graph& g; - }; - }; - - /// \brief Skeleton class for graph InEdgeIt and OutEdgeIt - /// - /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same - /// base class, the _selector is a additional template parameter. For - /// InEdgeIt you should instantiate it with character 'i' and for - /// OutEdgeIt with 'o'. - template - class GraphIncIt : public _Item { - public: - /// \brief Default constructor. - /// - /// @warning The default constructor sets the iterator - /// to an undefined value. - GraphIncIt() {} - /// \brief Copy constructor. - /// - /// Copy constructor. - /// - GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} - /// \brief Sets the iterator to the first edge incoming into or outgoing - /// from the node. - /// - /// Sets the iterator to the first edge incoming into or outgoing - /// from the node. - /// - explicit GraphIncIt(const _Graph&, const _Base&) {} - /// \brief Invalid constructor \& conversion. - /// - /// This constructor initializes the item to be invalid. - /// \sa Invalid for more details. - GraphIncIt(Invalid) {} - /// \brief Assign operator for iterators. - /// - /// The iterators are assignable. - /// - GraphIncIt& operator=(GraphIncIt const&) { return *this; } - /// \brief Next item. - /// - /// Assign the iterator to the next item. - /// - GraphIncIt& operator++() { return *this; } - - /// \brief Equality operator - /// - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(const GraphIncIt&) const { return true;} - - /// \brief Inequality operator - /// - /// \sa operator==(Node n) - /// - bool operator!=(const GraphIncIt&) const { return true;} - - template - struct Constraints { - void constraints() { - checkConcept, _GraphIncIt>(); - _GraphIncIt it1(graph, node); - _GraphIncIt it2; - - it2 = ++it1; - ++it2 = it1; - ++(++it1); - _Item e = it1; - e = it2; - - } - - _Item edge; - _Base node; - _Graph graph; - _GraphIncIt it; - }; - }; - - - /// \brief An empty iterable graph class. - /// - /// This class provides beside the core graph features - /// iterator based iterable interface for the graph structure. - /// This concept is part of the Graph concept. - template - class IterableGraphComponent : public _Base { - - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - - typedef IterableGraphComponent Graph; - - /// \name Base iteration - /// - /// This interface provides functions for iteration on graph items - /// - /// @{ - - /// \brief Gives back the first node in the iterating order. - /// - /// Gives back the first node in the iterating order. - /// - void first(Node&) const {} - - /// \brief Gives back the next node in the iterating order. - /// - /// Gives back the next node in the iterating order. - /// - void next(Node&) const {} - - /// \brief Gives back the first edge in the iterating order. - /// - /// Gives back the first edge in the iterating order. - /// - void first(Edge&) const {} - - /// \brief Gives back the next edge in the iterating order. - /// - /// Gives back the next edge in the iterating order. - /// - void next(Edge&) const {} - - - /// \brief Gives back the first of the edges point to the given - /// node. - /// - /// Gives back the first of the edges point to the given node. - /// - void firstIn(Edge&, const Node&) const {} - - /// \brief Gives back the next of the edges points to the given - /// node. - /// - /// Gives back the next of the edges points to the given node. - /// - void nextIn(Edge&) const {} - - /// \brief Gives back the first of the edges start from the - /// given node. - /// - /// Gives back the first of the edges start from the given node. - /// - void firstOut(Edge&, const Node&) const {} - - /// \brief Gives back the next of the edges start from the given - /// node. - /// - /// Gives back the next of the edges start from the given node. - /// - void nextOut(Edge&) const {} - - /// @} - - /// \name Class based iteration - /// - /// This interface provides functions for iteration on graph items - /// - /// @{ - - /// \brief This iterator goes through each node. - /// - /// This iterator goes through each node. - /// - typedef GraphItemIt NodeIt; - - /// \brief This iterator goes through each node. - /// - /// This iterator goes through each node. - /// - typedef GraphItemIt EdgeIt; - - /// \brief This iterator goes trough the incoming edges of a node. - /// - /// This iterator goes trough the \e inccoming edges of a certain node - /// of a graph. - typedef GraphIncIt InEdgeIt; - - /// \brief This iterator goes trough the outgoing edges of a node. - /// - /// This iterator goes trough the \e outgoing edges of a certain node - /// of a graph. - typedef GraphIncIt OutEdgeIt; - - /// \brief The base node of the iterator. - /// - /// Gives back the base node of the iterator. - /// It is always the target of the pointed edge. - Node baseNode(const InEdgeIt&) const { return INVALID; } - - /// \brief The running node of the iterator. - /// - /// Gives back the running node of the iterator. - /// It is always the source of the pointed edge. - Node runningNode(const InEdgeIt&) const { return INVALID; } - - /// \brief The base node of the iterator. - /// - /// Gives back the base node of the iterator. - /// It is always the source of the pointed edge. - Node baseNode(const OutEdgeIt&) const { return INVALID; } - - /// \brief The running node of the iterator. - /// - /// Gives back the running node of the iterator. - /// It is always the target of the pointed edge. - Node runningNode(const OutEdgeIt&) const { return INVALID; } - - /// @} - - template - struct Constraints { - void constraints() { - checkConcept(); - - { - typename _Graph::Node node(INVALID); - typename _Graph::Edge edge(INVALID); - { - graph.first(node); - graph.next(node); - } - { - graph.first(edge); - graph.next(edge); - } - { - graph.firstIn(edge, node); - graph.nextIn(edge); - } - { - graph.firstOut(edge, node); - graph.nextOut(edge); - } - } - - { - checkConcept, - typename _Graph::EdgeIt >(); - checkConcept, - typename _Graph::NodeIt >(); - checkConcept, typename _Graph::InEdgeIt>(); - checkConcept, typename _Graph::OutEdgeIt>(); - - typename _Graph::Node n; - typename _Graph::InEdgeIt ieit(INVALID); - typename _Graph::OutEdgeIt oeit(INVALID); - n = graph.baseNode(ieit); - n = graph.runningNode(ieit); - n = graph.baseNode(oeit); - n = graph.runningNode(oeit); - ignore_unused_variable_warning(n); - } - } - - const _Graph& graph; - - }; - }; - - /// \brief An empty iterable undirected graph class. - /// - /// This class provides beside the core graph features iterator - /// based iterable interface for the undirected graph structure. - /// This concept is part of the UGraph concept. - template - class IterableUGraphComponent : public IterableGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - typedef typename Base::UEdge UEdge; - - - typedef IterableUGraphComponent Graph; - - /// \name Base iteration - /// - /// This interface provides functions for iteration on graph items - /// @{ - - using IterableGraphComponent<_Base>::first; - using IterableGraphComponent<_Base>::next; - - /// \brief Gives back the first undirected edge in the iterating - /// order. - /// - /// Gives back the first undirected edge in the iterating order. - /// - void first(UEdge&) const {} - - /// \brief Gives back the next undirected edge in the iterating - /// order. - /// - /// Gives back the next undirected edge in the iterating order. - /// - void next(UEdge&) const {} - - - /// \brief Gives back the first of the undirected edges from the - /// given node. - /// - /// Gives back the first of the undirected edges from the given - /// node. The bool parameter gives back that direction which - /// gives a good direction of the uedge so the source of the - /// directed edge is the given node. - void firstInc(UEdge&, bool&, const Node&) const {} - - /// \brief Gives back the next of the undirected edges from the - /// given node. - /// - /// Gives back the next of the undirected edges from the given - /// node. The bool parameter should be used as the \c firstInc() - /// use it. - void nextInc(UEdge&, bool&) const {} - - using IterableGraphComponent<_Base>::baseNode; - using IterableGraphComponent<_Base>::runningNode; - - /// @} - - /// \name Class based iteration - /// - /// This interface provides functions for iteration on graph items - /// - /// @{ - - /// \brief This iterator goes through each node. - /// - /// This iterator goes through each node. - typedef GraphItemIt UEdgeIt; - /// \brief This iterator goes trough the incident edges of a - /// node. - /// - /// This iterator goes trough the incident edges of a certain - /// node of a graph. - typedef GraphIncIt IncEdgeIt; - /// \brief The base node of the iterator. - /// - /// Gives back the base node of the iterator. - Node baseNode(const IncEdgeIt&) const { return INVALID; } - - /// \brief The running node of the iterator. - /// - /// Gives back the running node of the iterator. - Node runningNode(const IncEdgeIt&) const { return INVALID; } - - /// @} - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - - { - typename _Graph::Node node(INVALID); - typename _Graph::UEdge uedge(INVALID); - bool dir; - { - graph.first(uedge); - graph.next(uedge); - } - { - graph.firstInc(uedge, dir, node); - graph.nextInc(uedge, dir); - } - - } - - { - checkConcept, - typename _Graph::UEdgeIt >(); - checkConcept, typename _Graph::IncEdgeIt>(); - - typename _Graph::Node n; - typename _Graph::IncEdgeIt ueit(INVALID); - n = graph.baseNode(ueit); - n = graph.runningNode(ueit); - } - } - - const _Graph& graph; - - }; - }; - - /// \brief An empty iterable bipartite undirected graph class. - /// - /// This class provides beside the core graph features iterator - /// based iterable interface for the bipartite undirected graph - /// structure. This concept is part of the BpUGraph concept. - template - class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::UEdge UEdge; - - typedef IterableBpUGraphComponent Graph; - - /// \name Base iteration - /// - /// This interface provides functions for iteration on graph items - /// @{ - - using IterableUGraphComponent<_Base>::first; - using IterableUGraphComponent<_Base>::next; - - /// \brief Gives back the first A-node in the iterating order. - /// - /// Gives back the first undirected A-node in the iterating - /// order. - /// - void firstANode(Node&) const {} - - /// \brief Gives back the next A-node in the iterating order. - /// - /// Gives back the next A-node in the iterating order. - /// - void nextANode(Node&) const {} - - /// \brief Gives back the first B-node in the iterating order. - /// - /// Gives back the first undirected B-node in the iterating - /// order. - /// - void firstBNode(Node&) const {} - - /// \brief Gives back the next B-node in the iterating order. - /// - /// Gives back the next B-node in the iterating order. - /// - void nextBNode(Node&) const {} - - - /// \brief Gives back the first of the undirected edges start - /// from the given A-node. - /// - /// Gives back the first of the undirected edges start from the - /// given A-node. - void firstFromANode(UEdge&, const Node&) const {} - - /// \brief Gives back the next of the undirected edges start - /// from the given A-node. - /// - /// Gives back the next of the undirected edges start from the - /// given A-node. - void nextFromANode(UEdge&) const {} - - /// \brief Gives back the first of the undirected edges start - /// from the given B-node. - /// - /// Gives back the first of the undirected edges start from the - /// given B-node. - void firstFromBNode(UEdge&, const Node&) const {} - - /// \brief Gives back the next of the undirected edges start - /// from the given B-node. - /// - /// Gives back the next of the undirected edges start from the - /// given B-node. - void nextFromBNode(UEdge&) const {} - - - /// @} - - /// \name Class based iteration - /// - /// This interface provides functions for iteration on graph items - /// - /// @{ - - /// \brief This iterator goes through each A-node. - /// - /// This iterator goes through each A-node. - typedef GraphItemIt ANodeIt; - - /// \brief This iterator goes through each B-node. - /// - /// This iterator goes through each B-node. - typedef GraphItemIt BNodeIt; - - /// @} - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - - { - typename _Graph::Node node(INVALID); - typename _Graph::UEdge uedge(INVALID); - graph.firstANode(node); - graph.nextANode(node); - graph.firstBNode(node); - graph.nextBNode(node); - - graph.firstFromANode(uedge, node); - graph.nextFromANode(uedge); - graph.firstFromBNode(uedge, node); - graph.nextFromBNode(uedge); - } - { - checkConcept, - typename _Graph::ANodeIt >(); - checkConcept, - typename _Graph::BNodeIt >(); - } - - } - - const _Graph& graph; - - }; - }; - - /// \brief An empty alteration notifier graph class. - /// - /// This class provides beside the core graph features alteration - /// notifier interface for the graph structure. This implements - /// an observer-notifier pattern for each graph item. More - /// obsevers can be registered into the notifier and whenever an - /// alteration occured in the graph all the observers will - /// notified about it. - template - class AlterableGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - - - /// The node observer registry. - typedef AlterationNotifier - NodeNotifier; - /// The edge observer registry. - typedef AlterationNotifier - EdgeNotifier; - - /// \brief Gives back the node alteration notifier. - /// - /// Gives back the node alteration notifier. - NodeNotifier& getNotifier(Node) const { - return NodeNotifier(); - } - - /// \brief Gives back the edge alteration notifier. - /// - /// Gives back the edge alteration notifier. - EdgeNotifier& getNotifier(Edge) const { - return EdgeNotifier(); - } - - template - struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::NodeNotifier& nn - = graph.getNotifier(typename _Graph::Node()); - - typename _Graph::EdgeNotifier& en - = graph.getNotifier(typename _Graph::Edge()); - - ignore_unused_variable_warning(nn); - ignore_unused_variable_warning(en); - } - - const _Graph& graph; - - }; - - }; - - /// \brief An empty alteration notifier undirected graph class. - /// - /// This class provides beside the core graph features alteration - /// notifier interface for the graph structure. This implements - /// an observer-notifier pattern for each graph item. More - /// obsevers can be registered into the notifier and whenever an - /// alteration occured in the graph all the observers will - /// notified about it. - template - class AlterableUGraphComponent : public AlterableGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::UEdge UEdge; - - - /// The edge observer registry. - typedef AlterationNotifier - UEdgeNotifier; - - /// \brief Gives back the edge alteration notifier. - /// - /// Gives back the edge alteration notifier. - UEdgeNotifier& getNotifier(UEdge) const { - return UEdgeNotifier(); - } - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - typename _Graph::UEdgeNotifier& uen - = graph.getNotifier(typename _Graph::UEdge()); - ignore_unused_variable_warning(uen); - } - - const _Graph& graph; - - }; - - }; - - /// \brief An empty alteration notifier bipartite undirected graph - /// class. - /// - /// This class provides beside the core graph features alteration - /// notifier interface for the graph structure. This implements - /// an observer-notifier pattern for each graph item. More - /// obsevers can be registered into the notifier and whenever an - /// alteration occured in the graph all the observers will - /// notified about it. - template - class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::ANode ANode; - typedef typename Base::BNode BNode; - - - /// The A-node observer registry. - typedef AlterationNotifier - ANodeNotifier; - - /// The B-node observer registry. - typedef AlterationNotifier - BNodeNotifier; - - /// \brief Gives back the A-node alteration notifier. - /// - /// Gives back the A-node alteration notifier. - ANodeNotifier& getNotifier(ANode) const { - return ANodeNotifier(); - } - - /// \brief Gives back the B-node alteration notifier. - /// - /// Gives back the B-node alteration notifier. - BNodeNotifier& getNotifier(BNode) const { - return BNodeNotifier(); - } - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - typename _Graph::ANodeNotifier& ann - = graph.getNotifier(typename _Graph::ANode()); - typename _Graph::BNodeNotifier& bnn - = graph.getNotifier(typename _Graph::BNode()); - ignore_unused_variable_warning(ann); - ignore_unused_variable_warning(bnn); - } - - const _Graph& graph; - - }; - - }; - - - /// \brief Class describing the concept of graph maps - /// - /// This class describes the common interface of the graph maps - /// (NodeMap, EdgeMap), that is \ref maps-page "maps" which can be used to - /// associate data to graph descriptors (nodes or edges). - template - class GraphMap : public ReadWriteMap<_Item, _Value> { - public: - - typedef ReadWriteMap<_Item, _Value> Parent; - - /// The graph type of the map. - typedef _Graph Graph; - /// The key type of the map. - typedef _Item Key; - /// The value type of the map. - typedef _Value Value; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - explicit GraphMap(const Graph&) {} - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - GraphMap(const Graph&, const Value&) {} - /// \brief Copy constructor. - /// - /// Copy Constructor. - GraphMap(const GraphMap&) : Parent() {} - - /// \brief Assign operator. - /// - /// Assign operator. It does not mofify the underlying graph, - /// it just iterates on the current item set and set the map - /// with the value returned by the assigned map. - template - GraphMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - template - struct Constraints { - void constraints() { - checkConcept, _Map >(); - // Construction with a graph parameter - _Map a(g); - // Constructor with a graph and a default value parameter - _Map a2(g,t); - // Copy constructor. - _Map b(c); - - ReadMap cmap; - b = cmap; - - ignore_unused_variable_warning(a2); - ignore_unused_variable_warning(b); - } - - const _Map &c; - const Graph &g; - const typename GraphMap::Value &t; - }; - - }; - - /// \brief An empty mappable graph class. - /// - /// This class provides beside the core graph features - /// map interface for the graph structure. - /// This concept is part of the Graph concept. - template - class MappableGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - - typedef MappableGraphComponent Graph; - - /// \brief ReadWrite map of the nodes. - /// - /// ReadWrite map of the nodes. - /// - template - class NodeMap : public GraphMap { - private: - NodeMap(); - public: - typedef GraphMap Parent; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - /// \todo call the right parent class constructor - explicit NodeMap(const MappableGraphComponent& graph) - : Parent(graph) {} - - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - NodeMap(const MappableGraphComponent& graph, const _Value& value) - : Parent(graph, value) {} - - /// \brief Copy constructor. - /// - /// Copy Constructor. - NodeMap(const NodeMap& nm) : Parent(nm) {} - - /// \brief Assign operator. - /// - /// Assign operator. - template - NodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - }; - - /// \brief ReadWrite map of the edges. - /// - /// ReadWrite map of the edges. - /// - template - class EdgeMap : public GraphMap { - private: - EdgeMap(); - public: - typedef GraphMap Parent; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - /// \todo call the right parent class constructor - explicit EdgeMap(const MappableGraphComponent& graph) - : Parent(graph) {} - - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - EdgeMap(const MappableGraphComponent& graph, const _Value& value) - : Parent(graph, value) {} - - /// \brief Copy constructor. - /// - /// Copy Constructor. - EdgeMap(const EdgeMap& nm) : Parent(nm) {} - - /// \brief Assign operator. - /// - /// Assign operator. - template - EdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - }; - - - template - struct Constraints { - - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; - - void constraints() { - checkConcept(); - { // int map test - typedef typename _Graph::template NodeMap IntNodeMap; - checkConcept, - IntNodeMap >(); - } { // bool map test - typedef typename _Graph::template NodeMap BoolNodeMap; - checkConcept, - BoolNodeMap >(); - } { // Dummy map test - typedef typename _Graph::template NodeMap DummyNodeMap; - checkConcept, - DummyNodeMap >(); - } - - { // int map test - typedef typename _Graph::template EdgeMap IntEdgeMap; - checkConcept, - IntEdgeMap >(); - } { // bool map test - typedef typename _Graph::template EdgeMap BoolEdgeMap; - checkConcept, - BoolEdgeMap >(); - } { // Dummy map test - typedef typename _Graph::template EdgeMap DummyEdgeMap; - checkConcept, - DummyEdgeMap >(); - } - } - - _Graph& graph; - }; - }; - - /// \brief An empty mappable base bipartite undirected graph class. - /// - /// This class provides beside the core graph features - /// map interface for the graph structure. - /// This concept is part of the UGraph concept. - template - class MappableUGraphComponent : public MappableGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::UEdge UEdge; - - typedef MappableUGraphComponent Graph; - - /// \brief ReadWrite map of the uedges. - /// - /// ReadWrite map of the uedges. - /// - template - class UEdgeMap : public GraphMap { - public: - typedef GraphMap Parent; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - /// \todo call the right parent class constructor - explicit UEdgeMap(const MappableUGraphComponent& graph) - : Parent(graph) {} - - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - UEdgeMap(const MappableUGraphComponent& graph, const _Value& value) - : Parent(graph, value) {} - - /// \brief Copy constructor. - /// - /// Copy Constructor. - UEdgeMap(const UEdgeMap& nm) : Parent(nm) {} - - /// \brief Assign operator. - /// - /// Assign operator. - template - UEdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - }; - - - template - struct Constraints { - - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; - - void constraints() { - checkConcept, _Graph>(); - - { // int map test - typedef typename _Graph::template UEdgeMap IntUEdgeMap; - checkConcept, - IntUEdgeMap >(); - } { // bool map test - typedef typename _Graph::template UEdgeMap BoolUEdgeMap; - checkConcept, - BoolUEdgeMap >(); - } { // Dummy map test - typedef typename _Graph::template UEdgeMap DummyUEdgeMap; - checkConcept, - DummyUEdgeMap >(); - } - } - - _Graph& graph; - }; - }; - - /// \brief An empty mappable base bipartite undirected graph - /// class. - /// - /// This class provides beside the core graph features - /// map interface for the graph structure. - /// This concept is part of the BpUGraph concept. - template - class MappableBpUGraphComponent : public MappableUGraphComponent<_Base> { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - - typedef MappableBpUGraphComponent Graph; - - /// \brief ReadWrite map of the A-nodes. - /// - /// ReadWrite map of the A-nodes. - /// - template - class ANodeMap : public GraphMap { - public: - typedef GraphMap Parent; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - /// \todo call the right parent class constructor - explicit ANodeMap(const MappableBpUGraphComponent& graph) - : Parent(graph) {} - - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value) - : Parent(graph, value) {} - - /// \brief Copy constructor. - /// - /// Copy Constructor. - ANodeMap(const ANodeMap& nm) : Parent(nm) {} - - /// \brief Assign operator. - /// - /// Assign operator. - template - ANodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - }; - - /// \brief ReadWrite map of the B-nodes. - /// - /// ReadWrite map of the A-nodes. - /// - template - class BNodeMap : public GraphMap { - public: - typedef GraphMap Parent; - - /// \brief Construct a new map. - /// - /// Construct a new map for the graph. - /// \todo call the right parent class constructor - explicit BNodeMap(const MappableBpUGraphComponent& graph) - : Parent(graph) {} - - /// \brief Construct a new map with default value. - /// - /// Construct a new map for the graph and initalise the values. - BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value) - : Parent(graph, value) {} - - /// \brief Copy constructor. - /// - /// Copy Constructor. - BNodeMap(const BNodeMap& nm) : Parent(nm) {} - - /// \brief Assign operator. - /// - /// Assign operator. - template - BNodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - - }; - - - template - struct Constraints { - - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; - - void constraints() { - checkConcept, _Graph>(); - - { // int map test - typedef typename _Graph::template ANodeMap IntANodeMap; - checkConcept, - IntANodeMap >(); - } { // bool map test - typedef typename _Graph::template ANodeMap BoolANodeMap; - checkConcept, - BoolANodeMap >(); - } { // Dummy map test - typedef typename _Graph::template ANodeMap DummyANodeMap; - checkConcept, - DummyANodeMap >(); - } - } - - _Graph& graph; - }; - }; - - - /// \brief An empty extendable graph class. - /// - /// This class provides beside the core graph features graph - /// extendable interface for the graph structure. The main - /// difference between the base and this interface is that the - /// graph alterations should handled already on this level. - template - class ExtendableGraphComponent : public _Base { - public: - typedef _Base Base; - - typedef typename _Base::Node Node; - typedef typename _Base::Edge Edge; - - /// \brief Adds a new node to the graph. - /// - /// Adds a new node to the graph. - /// - Node addNode() { - return INVALID; - } - - /// \brief Adds a new edge connects the given two nodes. - /// - /// Adds a new edge connects the the given two nodes. - Edge addEdge(const Node&, const Node&) { - return INVALID; - } - - template - struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::Node node_a, node_b; - node_a = graph.addNode(); - node_b = graph.addNode(); - typename _Graph::Edge edge; - edge = graph.addEdge(node_a, node_b); - } - - _Graph& graph; - }; - }; - - /// \brief An empty extendable base undirected graph class. - /// - /// This class provides beside the core undirected graph features - /// core undircted graph extend interface for the graph structure. - /// The main difference between the base and this interface is - /// that the graph alterations should handled already on this - /// level. - template - class ExtendableUGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename _Base::Node Node; - typedef typename _Base::UEdge UEdge; - - /// \brief Adds a new node to the graph. - /// - /// Adds a new node to the graph. - /// - Node addNode() { - return INVALID; - } - - /// \brief Adds a new edge connects the given two nodes. - /// - /// Adds a new edge connects the the given two nodes. - UEdge addEdge(const Node&, const Node&) { - return INVALID; - } - - template - struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::Node node_a, node_b; - node_a = graph.addNode(); - node_b = graph.addNode(); - typename _Graph::UEdge uedge; - uedge = graph.addUEdge(node_a, node_b); - } - - _Graph& graph; - }; - }; - - /// \brief An empty extendable base undirected graph class. - /// - /// This class provides beside the core bipartite undirected graph - /// features core undircted graph extend interface for the graph - /// structure. The main difference between the base and this - /// interface is that the graph alterations should handled already - /// on this level. - template - class ExtendableBpUGraphComponent - : public ExtendableUGraphComponent<_Base> { - - typedef _Base Base; - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - } - }; - }; - - /// \brief An empty erasable graph class. - /// - /// This class provides beside the core graph features core erase - /// functions for the graph structure. The main difference between - /// the base and this interface is that the graph alterations - /// should handled already on this level. - template - class ErasableGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::Edge Edge; - - /// \brief Erase a node from the graph. - /// - /// Erase a node from the graph. This function should - /// erase all edges connecting to the node. - void erase(const Node&) {} - - /// \brief Erase an edge from the graph. - /// - /// Erase an edge from the graph. - /// - void erase(const Edge&) {} - - template - struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::Node node; - graph.erase(node); - typename _Graph::Edge edge; - graph.erase(edge); - } - - _Graph& graph; - }; - }; - - /// \brief An empty erasable base undirected graph class. - /// - /// This class provides beside the core undirected graph features - /// core erase functions for the undirceted graph structure. The - /// main difference between the base and this interface is that - /// the graph alterations should handled already on this level. - template - class ErasableUGraphComponent : public _Base { - public: - - typedef _Base Base; - typedef typename Base::Node Node; - typedef typename Base::UEdge UEdge; - - /// \brief Erase a node from the graph. - /// - /// Erase a node from the graph. This function should erase - /// edges connecting to the node. - void erase(const Node&) {} - - /// \brief Erase an edge from the graph. - /// - /// Erase an edge from the graph. - /// - void erase(const UEdge&) {} - - template - struct Constraints { - void constraints() { - checkConcept(); - typename _Graph::Node node; - graph.erase(node); - typename _Graph::Edge edge; - graph.erase(edge); - } - - _Graph& graph; - }; - }; - - /// \brief An empty erasable base bipartite undirected graph class. - /// - /// This class provides beside the core bipartite undirected graph - /// features core erase functions for the undirceted graph - /// structure. The main difference between the base and this - /// interface is that the graph alterations should handled already - /// on this level. - template - class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> { - public: - - typedef _Base Base; - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - } - }; - }; - - /// \brief An empty clearable base graph class. - /// - /// This class provides beside the core graph features core clear - /// functions for the graph structure. The main difference between - /// the base and this interface is that the graph alterations - /// should handled already on this level. - template - class ClearableGraphComponent : public _Base { - public: - - typedef _Base Base; - - /// \brief Erase all nodes and edges from the graph. - /// - /// Erase all nodes and edges from the graph. - /// - void clear() {} - - template - struct Constraints { - void constraints() { - checkConcept(); - graph.clear(); - } - - _Graph graph; - }; - }; - - /// \brief An empty clearable base undirected graph class. - /// - /// This class provides beside the core undirected graph features - /// core clear functions for the undirected graph structure. The - /// main difference between the base and this interface is that - /// the graph alterations should handled already on this level. - template - class ClearableUGraphComponent : public ClearableUGraphComponent<_Base> { - public: - - typedef _Base Base; - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - } - - _Graph graph; - }; - }; - - /// \brief An empty clearable base bipartite undirected graph - /// class. - /// - /// This class provides beside the core bipartite undirected graph - /// features core clear functions for the undirected graph - /// structure. The main difference between the base and this - /// interface is that the graph alterations should handled already - /// on this level. - template - class ClearableBpUGraphComponent - : public ClearableBpUGraphComponent<_Base> { - public: - - typedef _Base Base; - - template - struct Constraints { - void constraints() { - checkConcept, _Graph>(); - } - - }; - - }; - - } - -} - -#endif diff -r da142c310d02 -r 4274224f8a7d lemon/concept/heap.h --- a/lemon/concept/heap.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -///\ingroup concept -///\file -///\brief Classes for representing heaps. -/// - -#ifndef LEMON_CONCEPT_HEAP_H -#define LEMON_CONCEPT_HEAP_H - -#include - -namespace lemon { - namespace concept { - /// \addtogroup concept - /// @{ - - - /// \brief A concept structure describes the main interface of heaps. - /// - /// A concept structure describes the main interface of heaps. - /// - template - class Heap { - public: - - - /// \brief Type to represent the items states. - /// - /// Each Item element have a state associated to it. It may be "in heap", - /// "pre heap" or "post heap". The later two are indifferent from the - /// heap's point of view, but may be useful to the user. - /// - /// The ItemIntMap _should_ be initialized in such way, that it maps - /// PRE_HEAP (-1) to any element to be put in the heap... - enum state_enum { - IN_HEAP = 0, - PRE_HEAP = -1, - POST_HEAP = -2 - }; - - /// \brief The constructor. - /// - /// The constructor. - /// \param _iim should be given to the constructor, since it is used - /// internally to handle the cross references. The value of the map - /// should be PRE_HEAP (-1) for each element. - explicit Heap(ItemIntMap &_iim) {} - - /// \brief The number of items stored in the heap. - /// - /// Returns the number of items stored in the heap. - int size() const { return 0; } - - /// \brief Checks if the heap stores no items. - /// - /// Returns \c true if and only if the heap stores no items. - bool empty() const { return false; } - - /// \brief Makes empty this heap. - /// - /// Makes this heap empty. - void clear(); - - /// \brief Insert an item into the heap with the given heap. - /// - /// Adds \c i to the heap with priority \c p. - /// \param i The item to insert. - /// \param p The priority of the item. - void push(const Item &i, const Prio &p) {} - - /// \brief Returns the item with minimum priority. - /// - /// This method returns the item with minimum priority. - /// \pre The heap must be nonempty. - Item top() const {} - - /// \brief Returns the minimum priority. - /// - /// It returns the minimum priority. - /// \pre The heap must be nonempty. - Prio prio() const {} - - /// \brief Deletes the item with minimum priority. - /// - /// This method deletes the item with minimum priority. - /// \pre The heap must be non-empty. - void pop() {} - - /// \brief Deletes \c i from the heap. - /// - /// This method deletes item \c i from the heap, if \c i was - /// already stored in the heap. - /// \param i The item to erase. - void erase(const Item &i) {} - - /// \brief Returns the priority of \c i. - /// - /// This function returns the priority of item \c i. - /// \pre \c i must be in the heap. - /// \param i The item. - Prio operator[](const Item &i) const {} - - /// \brief \c i gets to the heap with priority \c p independently - /// if \c i was already there. - /// - /// This method calls \ref push(\c i, \c p) if \c i is not stored - /// in the heap and sets the priority of \c i to \c p otherwise. - /// It may throw an \e UnderFlowPriorityException. - /// \param i The item. - /// \param p The priority. - void set(const Item &i, const Prio &p) {} - - /// \brief Decreases the priority of \c i to \c p. - /// - /// This method decreases the priority of item \c i to \c p. - /// \pre \c i must be stored in the heap with priority at least \c p. - /// \param i The item. - /// \param p The priority. - void decrease(const Item &i, const Prio &p) {} - - /// \brief Increases the priority of \c i to \c p. - /// - /// This method sets the priority of item \c i to \c p. - /// \pre \c i must be stored in the heap with priority at most \c - /// p relative to \c Compare. - /// \param i The item. - /// \param p The priority. - void increase(const Item &i, const Prio &p) {} - - /// \brief Returns if \c item is in, has already been in, or has - /// never been in the heap. - /// - /// This method returns PRE_HEAP if \c item has never been in the - /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP - /// otherwise. In the latter case it is possible that \c item will - /// get back to the heap again. - /// \param i The item. - state_enum state(const Item &i) const {} - - /// \brief Sets the state of the \c item in the heap. - /// - /// Sets the state of the \c item in the heap. It can be used to - /// manually clear the heap when it is important to achive the - /// better time complexity. - /// \param i The item. - /// \param st The state. It should not be \c IN_HEAP. - void state(const Item& i, state_enum st) {} - - - template - struct Constraints { - public: - - void constraints() { - Item item; - Prio prio; - - item=Item(); - prio=Prio(); - - ignore_unused_variable_warning(item); - ignore_unused_variable_warning(prio); - - typedef typename _Heap::state_enum state_enum; - state_enum state; - - ignore_unused_variable_warning(state); - - _Heap heap1 = _Heap(map); - - ignore_unused_variable_warning(heap1); - - heap.push(item, prio); - - prio = heap.prio(); - item = heap.top(); - - heap.pop(); - - heap.set(item, prio); - heap.decrease(item, prio); - heap.increase(item, prio); - prio = heap[item]; - - heap.erase(item); - - state = heap.state(item); - - state = _Heap::PRE_HEAP; - state = _Heap::IN_HEAP; - state = _Heap::POST_HEAP; - - heap.clear(); - } - - _Heap& heap; - ItemIntMap& map; - - Constraints() : heap(0), map(0) {} - }; - }; - - /// @} - } // namespace lemon -} -#endif // LEMON_CONCEPT_PATH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concept/maps.h --- a/lemon/concept/maps.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_CONCEPT_MAPS_H -#define LEMON_CONCEPT_MAPS_H - -#include -#include - -///\ingroup concept -///\file -///\brief Map concepts checking classes for testing and documenting. - -namespace lemon { - - namespace concept { - - /// \addtogroup concept - /// @{ - - /// Readable map concept - template - class ReadMap - { - public: - /// Map's key type. - typedef K Key; - /// Map's value type. (The type of objects associated with the keys). - typedef T Value; - - // \bug Value don't need to be default constructible. - /// Returns the value associated with a key. - Value operator[](const Key &) const {return Value();} - - template - struct Constraints { - - void constraints() { - Value val = m[key]; - val = m[key]; - typename _ReadMap::Value own_val = m[own_key]; - own_val = m[own_key]; - - ignore_unused_variable_warning(val); - ignore_unused_variable_warning(own_val); - ignore_unused_variable_warning(key); - } - Key& key; - typename _ReadMap::Key& own_key; - _ReadMap& m; - }; - - }; - - - /// Writable map concept - template - class WriteMap - { - public: - /// Map's key type. - typedef K Key; - /// Map's value type. (The type of objects associated with the keys). - typedef T Value; - - /// Sets the value associated with a key. - void set(const Key &,const Value &) {} - - ///Default constructor - WriteMap() {} - - template - struct Constraints { - void constraints() { - // No constraints for constructor. - m.set(key, val); - m.set(own_key, own_val); - ignore_unused_variable_warning(key); - ignore_unused_variable_warning(val); - ignore_unused_variable_warning(own_key); - ignore_unused_variable_warning(own_val); - } - - Value& val; - typename _WriteMap::Value own_val; - Key& key; - typename _WriteMap::Key& own_key; - _WriteMap& m; - - }; - }; - - ///Read/Writable map concept - template - class ReadWriteMap : public ReadMap, - public WriteMap - { - public: - /// Map's key type. - typedef K Key; - /// Map's value type. (The type of objects associated with the keys). - typedef T Value; - - /// Returns the value associated with a key. - Value operator[](const Key &) const {return Value();} - /// Sets the value associated with a key. - void set(const Key & ,const Value &) {} - - template - struct Constraints { - void constraints() { - checkConcept, _ReadWriteMap >(); - checkConcept, _ReadWriteMap >(); - } - }; - }; - - - ///Dereferable map concept - template - class ReferenceMap : public ReadWriteMap - { - public: - /// Tag for reference maps. - typedef True ReferenceMapTag; - /// Map's key type. - typedef K Key; - /// Map's value type. (The type of objects associated with the keys). - typedef T Value; - /// Map's reference type. - typedef R Reference; - /// Map's const reference type. - typedef CR ConstReference; - - protected: - Value tmp; - public: - - ///Returns a reference to the value associated to a key. - Reference operator[](const Key &) { return tmp; } - ///Returns a const reference to the value associated to a key. - ConstReference operator[](const Key &) const - { return tmp; } - /// Sets the value associated with a key. - void set(const Key &k,const Value &t) { operator[](k)=t; } - - // \todo rethink this concept - template - struct ReferenceMapConcept { - - void constraints() { - checkConcept(); - m[key] = val; - val = m[key]; - m[key] = ref; - ref = m[key]; - m[own_key] = own_val; - own_val = m[own_key]; - m[own_key] = own_ref; - own_ref = m[own_key]; - } - - typename _ReferenceMap::Key& own_key; - typename _ReferenceMap::Value& own_val; - typename _ReferenceMap::Reference& own_ref; - Key& key; - Value& val; - Reference& ref; - _ReferenceMap& m; - }; - }; - - // @} - - } //namespace concept -} //namespace lemon -#endif // LEMON_CONCEPT_MAPS_H diff -r da142c310d02 -r 4274224f8a7d lemon/concept/matrix_maps.h --- a/lemon/concept/matrix_maps.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_CONCEPT_MATRIX_MAPS_H -#define LEMON_CONCEPT_MATRIX_MAPS_H - -#include -#include - -///\ingroup concept -///\file -///\brief MatrixMap concepts checking classes for testing and documenting. - -namespace lemon { - - namespace concept { - - /// \addtogroup concept - /// @{ - - /// Readable matrix map concept - template - class ReadMatrixMap - { - public: - /// Map's first key type. - typedef K1 FirstKey; - /// Map's second key type. - typedef K2 SecondKey; - /// \brief Map's value type. - /// (The type of objects associated with the pairs of keys). - typedef V Value; - - // \bug Value don't need to be default constructible. - /// Returns the value associated with a key. - Value operator()(const FirstKey&, const SecondKey&) const { - return Value(); - } - - template - struct Constraints { - - void constraints() { - Value val = m(first_key, second_key); - val = m(first_key, second_key); - typename _ReadMatrixMap::Value own_val = - m(own_first_key, own_second_key); - own_val = m(own_first_key, own_second_key); - ignore_unused_variable_warning(val); - ignore_unused_variable_warning(own_val); - } - - FirstKey& first_key; - SecondKey& second_key; - typename _ReadMatrixMap::FirstKey& own_first_key; - typename _ReadMatrixMap::SecondKey& own_second_key; - _ReadMatrixMap& m; - }; - - }; - - - /// Writable map concept - template - class WriteMatrixMap { - public: - /// Map's first key type. - typedef K1 FirstKey; - /// Map's second key type. - typedef K2 SecondKey; - /// \brief Map's value type. - /// (The type of objects associated with the pairs of keys). - typedef V Value; - - /// Sets the value associated with the pair of keys. - void set(const FirstKey&, const SecondKey& ,const Value&) {} - - template - struct Constraints { - void constraints() { - // No constraints for constructor. - m.set(first_key, second_key, val); - m.set(own_first_key, own_second_key, own_val); - } - - Value& val; - typename _WriteMatrixMap::Value own_val; - FirstKey& first_key; - SecondKey& second_key; - typename _WriteMatrixMap::FirstKey& own_first_key; - typename _WriteMatrixMap::SecondKey& own_second_key; - _WriteMatrixMap& m; - - }; - }; - - ///Read/Writable map concept - template - class ReadWriteMatrixMap - : public ReadMatrixMap, public WriteMatrixMap { - public: - /// Map's first key type. - typedef K1 FirstKey; - /// Map's second key type. - typedef K2 SecondKey; - /// \brief Map's value type. - /// (The type of objects associated with the pairs of keys). - typedef V Value; - - /// Returns the value associated with a pair of keys. - Value operator()(const FirstKey&, const SecondKey&) const { - return Value(); - } - /// Sets the value associated with the pair of keys. - void set(const FirstKey&, const SecondKey& ,const Value&) {} - - template - struct Constraints { - void constraints() { - checkConcept, _ReadWriteMatrixMap >(); - checkConcept, _ReadWriteMatrixMap >(); - } - }; - }; - - - ///Dereferable matrix map concept - template - class ReferenceMatrixMap : public ReadWriteMatrixMap - { - public: - /// Tag for reference maps. - typedef True ReferenceMapTag; - /// Map's first key type. - typedef K1 FirstKey; - /// Map's second key type. - typedef K1 SecondKey; - /// Map's value type. (The type of objects associated with the keys). - typedef V Value; - /// Map's reference type. - typedef R Reference; - /// Map's const reference type. - typedef CR ConstReference; - - protected: - Value tmp; - public: - - ///Returns a reference to the value associated to a pair of keys. - Reference operator()(const FirstKey&, const SecondKey&) { - return tmp; - } - ///Returns a const reference to the value associated to a pair of keys. - ConstReference operator()(const FirstKey&, const SecondKey&) const { - return tmp; - } - /// Sets the value associated with the pair of keys. - void set(const FirstKey&, const SecondKey& ,const Value&) {} - - // \todo rethink this concept - template - struct ReferenceMapConcept { - - void constraints() { - checkConcept(); - m(first_key, second_key) = val; - val = m(first_key, second_key); - m(first_key, second_key) = ref; - ref = m(first_key, second_key); - m(own_first_key, own_second_key) = own_val; - own_val = m(own_first_key, own_second_key); - m(own_first_key, own_second_key) = own_ref; - own_ref = m(own_first_key, own_second_key); - } - - typename _ReferenceMatrixMap::Key& own_first_key; - typename _ReferenceMatrixMap::Key& own_second_key; - typename _ReferenceMatrixMap::Value& own_val; - typename _ReferenceMatrixMap::Reference& own_ref; - FirstKey& first_key; - SecondKey& second_key; - Value& val; - Reference& ref; - _ReferenceMatrixMap& m; - }; - }; - - // @} - - } //namespace concept -} //namespace lemon -#endif // LEMON_CONCEPT_MATRIX_MAPS_H diff -r da142c310d02 -r 4274224f8a7d lemon/concept/path.h --- a/lemon/concept/path.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -///\ingroup concept -///\file -///\brief Classes for representing paths in graphs. -/// -///\todo Iterators have obsolete style - -#ifndef LEMON_CONCEPT_PATH_H -#define LEMON_CONCEPT_PATH_H - -#include -#include - -namespace lemon { - namespace concept { - /// \addtogroup concept - /// @{ - - - //! \brief A skeleton structure for representing directed paths in a graph. - //! - //! A skeleton structure for representing directed paths in a graph. - //! \param _Graph The graph type in which the path is. - //! - //! In a sense, the path can be treated as a graph, for it has \c NodeIt - //! and \c EdgeIt with the same usage. These types converts to the \c Node - //! and \c Edge of the original graph. - template - class Path { - public: - - /// Type of the underlying graph. - typedef _Graph Graph; - /// Edge type of the underlying graph. - typedef typename Graph::Edge Edge; - /// Node type of the underlying graph. - typedef typename Graph::Node Node; - - class NodeIt; - class EdgeIt; - - /// \param _g The graph in which the path is. - /// - Path(const Graph &_g) { - ignore_unused_variable_warning(_g); - } - - /// Length of the path ie. the number of edges in the path. - int length() const {return 0;} - - /// Returns whether the path is empty. - bool empty() const { return true;} - - /// Resets the path to an empty path. - void clear() {} - - /// \brief Starting point of the path. - /// - /// Starting point of the path. - /// Returns INVALID if the path is empty. - Node target() const {return INVALID;} - /// \brief End point of the path. - /// - /// End point of the path. - /// Returns INVALID if the path is empty. - Node source() const {return INVALID;} - - /// \brief The target of an edge. - /// - /// Returns node iterator pointing to the target node of the - /// given edge iterator. - NodeIt target(const EdgeIt&) const {return INVALID;} - - /// \brief The source of an edge. - /// - /// Returns node iterator pointing to the source node of the - /// given edge iterator. - NodeIt source(const EdgeIt&) const {return INVALID;} - - /// \brief Iterator class to iterate on the nodes of the paths - /// - /// This class is used to iterate on the nodes of the paths - /// - /// Of course it converts to Graph::Node. - class NodeIt { - public: - /// Default constructor - NodeIt() {} - /// Invalid constructor - NodeIt(Invalid) {} - /// Constructor with starting point - NodeIt(const Path &) {} - - ///Conversion to Graph::Node - operator Node() const { return INVALID; } - /// Next node - NodeIt& operator++() {return *this;} - - /// Comparison operator - bool operator==(const NodeIt&) const {return true;} - /// Comparison operator - bool operator!=(const NodeIt&) const {return true;} - /// Comparison operator - bool operator<(const NodeIt&) const {return false;} - - }; - - /// \brief Iterator class to iterate on the edges of the paths - /// - /// This class is used to iterate on the edges of the paths - /// - /// Of course it converts to Graph::Edge - class EdgeIt { - public: - /// Default constructor - EdgeIt() {} - /// Invalid constructor - EdgeIt(Invalid) {} - /// Constructor with starting point - EdgeIt(const Path &) {} - - operator Edge() const { return INVALID; } - - /// Next edge - EdgeIt& operator++() {return *this;} - - /// Comparison operator - bool operator==(const EdgeIt&) const {return true;} - /// Comparison operator - bool operator!=(const EdgeIt&) const {return true;} - /// Comparison operator - bool operator<(const EdgeIt&) const {return false;} - - }; - - - friend class Builder; - - /// \brief Class to build paths - /// - /// This class is used to fill a path with edges. - /// - /// You can push new edges to the front and to the back of the path in - /// arbitrary order then you should commit these changes to the graph. - /// - /// While the builder is active (after the first modifying - /// operation and until the call of \ref commit()) the - /// underlining Path is in a "transitional" state (operations on - /// it have undefined result). - class Builder { - public: - - /// Constructor - - /// Constructor - /// \param _path the path you want to fill in. - /// - - Builder(Path &_path) { ignore_unused_variable_warning(_path); } - - /// Sets the starting node of the path. - - /// Sets the starting node of the path. Edge added to the path - /// afterwards have to be incident to this node. - /// You \em must start building an empty path with these functions. - /// (And you \em must \em not use it later). - /// \sa pushFront() - /// \sa pushBack() - void setStartNode(const Node &) {} - - ///Push a new edge to the front of the path - - ///Push a new edge to the front of the path. - ///If the path is empty, you \em must call \ref setStartNode() before - ///the first use of \ref pushFront(). - void pushFront(const Edge&) {} - - ///Push a new edge to the back of the path - - ///Push a new edge to the back of the path. - ///If the path is empty, you \em must call \ref setStartNode() before - ///the first use of \ref pushBack(). - void pushBack(const Edge&) {} - - ///Commit the changes to the path. - - ///Commit the changes to the path. - /// - void commit() {} - - ///Reserve (front) storage for the builder in advance. - - ///If you know a reasonable upper bound on the number of the edges - ///to add to the front of the path, - ///using this function you may speed up the building. - void reserveFront(size_t) {} - ///Reserve (back) storage for the builder in advance. - - ///If you know a reasonable upper bound on the number of the edges - ///to add to the back of the path, - ///using this function you may speed up the building. - void reserveBack(size_t) {} - }; - - template - struct Constraints { - void constraints() { - typedef typename _Path::Node Node; - typedef typename _Path::NodeIt NodeIt; - typedef typename Graph::Node GraphNode; - - typedef typename _Path::Edge Edge; - typedef typename _Path::EdgeIt EdgeIt; - typedef typename Graph::Edge GraphEdge; - - typedef typename _Path::Builder Builder; - - path = _Path(graph); - - bool b = cpath.empty(); - int l = cpath.length(); - - Node gn; - Edge ge; - gn = cpath.source(); - gn = cpath.target(); - - NodeIt nit; - EdgeIt eit(INVALID); - nit = path.source(eit); - nit = path.target(eit); - - nit = NodeIt(); - nit = NodeIt(cpath); - nit = INVALID; - gn = nit; - ++nit; - b = nit == nit; - b = nit != nit; - b = nit < nit; - - eit = EdgeIt(); - eit = EdgeIt(cpath); - eit = INVALID; - ge = eit; - ++eit; - b = eit == eit; - b = eit != eit; - b = eit < eit; - - size_t st = 0; - - Builder builder(path); - builder.setStartNode(gn); - builder.pushFront(ge); - builder.pushBack(ge); - builder.commit(); - builder.reserveFront(st); - builder.reserveBack(st); - - ignore_unused_variable_warning(l); - ignore_unused_variable_warning(b); - } - - const Graph& graph; - const _Path& cpath; - _Path& path; - }; - - }; - - ///@} - } - -} // namespace lemon - -#endif // LEMON_CONCEPT_PATH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concept/ugraph.h --- a/lemon/concept/ugraph.h Tue Oct 24 16:49:41 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,713 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -///\ingroup graph_concepts -///\file -///\brief The concept of the undirected graphs. - - -#ifndef LEMON_CONCEPT_UGRAPH_H -#define LEMON_CONCEPT_UGRAPH_H - -#include -#include -#include - -namespace lemon { - namespace concept { - - /// \addtogroup graph_concepts - /// @{ - - - /// \brief Class describing the concept of Undirected Graphs. - /// - /// This class describes the common interface of all Undirected - /// Graphs. - /// - /// As all concept describing classes it provides only interface - /// without any sensible implementation. So any algorithm for - /// undirected graph should compile with this class, but it will not - /// run properly, of course. - /// - /// The LEMON undirected graphs also fulfill the concept of - /// directed graphs (\ref lemon::concept::Graph "Graph - /// Concept"). Each undirected edges can be seen as two opposite - /// directed edge and consequently the undirected graph can be - /// seen as the direceted graph of these directed edges. The - /// UGraph has the UEdge inner class for the undirected edges and - /// the Edge type for the directed edges. The Edge type is - /// convertible to UEdge or inherited from it so from a directed - /// edge we can get the represented undirected edge. - /// - /// In the sense of the LEMON each undirected edge has a default - /// direction (it should be in every computer implementation, - /// because the order of undirected edge's nodes defines an - /// orientation). With the default orientation we can define that - /// the directed edge is forward or backward directed. With the \c - /// direction() and \c direct() function we can get the direction - /// of the directed edge and we can direct an undirected edge. - /// - /// The UEdgeIt is an iterator for the undirected edges. We can use - /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and - /// OutEdgeIt iterates on the same undirected edges but with opposite - /// direction. The IncEdgeIt iterates also on the same undirected edges - /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just - /// to UEdge. - class UGraph { - public: - /// \brief The undirected graph should be tagged by the - /// UndirectedTag. - /// - /// The undirected graph should be tagged by the UndirectedTag. This - /// tag helps the enable_if technics to make compile time - /// specializations for undirected graphs. - typedef True UndirectedTag; - - /// \brief The base type of node iterators, - /// or in other words, the trivial node iterator. - /// - /// This is the base type of each node iterator, - /// thus each kind of node iterator converts to this. - /// More precisely each kind of node iterator should be inherited - /// from the trivial node iterator. - class Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - Node(const Node&) { } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - Node(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Node) const { return true; } - - /// Inequality operator - - /// \sa operator==(Node n) - /// - bool operator!=(Node) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Node) const { return false; } - - }; - - /// This iterator goes through each node. - - /// This iterator goes through each node. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - ///\code - /// int count=0; - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; - ///\endcode - class NodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - NodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - NodeIt(const NodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - NodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - NodeIt(const UGraph&) { } - /// Node -> NodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - NodeIt(const UGraph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - NodeIt& operator++() { return *this; } - }; - - - /// The base type of the undirected edge iterators. - - /// The base type of the undirected edge iterators. - /// - class UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UEdge() { } - /// Copy constructor. - - /// Copy constructor. - /// - UEdge(const UEdge&) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UEdge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(UEdge) const { return true; } - /// Inequality operator - - /// \sa operator==(UEdge n) - /// - bool operator!=(UEdge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(UEdge) const { return false; } - }; - - /// This iterator goes through each undirected edge. - - /// This iterator goes through each undirected edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of undirected edges in a graph \c g of type \c Graph as follows: - ///\code - /// int count=0; - /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; - ///\endcode - class UEdgeIt : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - UEdgeIt(const UEdgeIt& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first undirected edge. - - /// This constructor sets the iterator to the first undirected edge. - UEdgeIt(const UGraph&) { } - /// UEdge -> UEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the undirected edge-set, the iteration order is the - /// same. - UEdgeIt(const UGraph&, const UEdge&) { } - /// Next undirected edge - - /// Assign the iterator to the next undirected edge. - UEdgeIt& operator++() { return *this; } - }; - - /// \brief This iterator goes trough the incident undirected - /// edges of a node. - /// - /// This iterator goes trough the incident undirected edges - /// of a certain node of a graph. You should assume that the - /// loop edges will be iterated twice. - /// - /// Its usage is quite simple, for example you can compute the - /// degree (i.e. count the number of incident edges of a node \c n - /// in graph \c g of type \c Graph as follows. - /// - ///\code - /// int count=0; - /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - class IncEdgeIt : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - IncEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - IncEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incident edge. - - /// This constructor set the iterator to the first incident edge of - /// the node. - IncEdgeIt(const UGraph&, const Node&) { } - /// UEdge -> IncEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - IncEdgeIt(const UGraph&, const UEdge&) { } - /// Next incident edge - - /// Assign the iterator to the next incident edge - /// of the corresponding node. - IncEdgeIt& operator++() { return *this; } - }; - - /// The directed edge type. - - /// The directed edge type. It can be converted to the - /// undirected edge or it should be inherited from the undirected - /// edge. - class Edge : public UEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Edge() { } - /// Copy constructor. - - /// Copy constructor. - /// - Edge(const Edge& e) : UEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - Edge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Edge) const { return true; } - /// Inequality operator - - /// \sa operator==(Edge n) - /// - bool operator!=(Edge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - bool operator<(Edge) const { return false; } - - }; - /// This iterator goes through each directed edge. - - /// This iterator goes through each edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of edges in a graph \c g of type \c Graph as follows: - ///\code - /// int count=0; - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; - ///\endcode - class EdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - EdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - EdgeIt(const EdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - EdgeIt(Invalid) { } - /// This constructor sets the iterator to the first edge. - - /// This constructor sets the iterator to the first edge of \c g. - ///@param g the graph - EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); } - /// Edge -> EdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - EdgeIt(const UGraph&, const Edge&) { } - ///Next edge - - /// Assign the iterator to the next edge. - EdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the outgoing directed edges of a node. - - /// This iterator goes trough the \e outgoing edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class OutEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - OutEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - OutEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first outgoing edge. - - /// This constructor sets the iterator to the first outgoing edge of - /// the node. - ///@param n the node - ///@param g the graph - OutEdgeIt(const UGraph& n, const Node& g) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> OutEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - OutEdgeIt(const UGraph&, const Edge&) { } - ///Next outgoing edge - - /// Assign the iterator to the next - /// outgoing edge of the corresponding node. - OutEdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the incoming directed edges of a node. - - /// This iterator goes trough the \e incoming edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - ///\code - /// int count=0; - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; - ///\endcode - - class InEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - InEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - InEdgeIt(const InEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - InEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incoming edge. - - /// This constructor set the iterator to the first incoming edge of - /// the node. - ///@param n the node - ///@param g the graph - InEdgeIt(const UGraph& g, const Node& n) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> InEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - InEdgeIt(const UGraph&, const Edge&) { } - /// Next incoming edge - - /// Assign the iterator to the next inedge of the corresponding node. - /// - InEdgeIt& operator++() { return *this; } - }; - - /// \brief Read write map of the nodes to type \c T. - /// - /// ReadWrite map of the nodes to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (NodeMap) - /// needs some extra attention! - template - class NodeMap : public ReadWriteMap< Node, T > - { - public: - - ///\e - NodeMap(const UGraph&) { } - ///\e - NodeMap(const UGraph&, T) { } - - ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - template - NodeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Read write map of the directed edges to type \c T. - /// - /// Reference map of the directed edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (EdgeMap) - /// needs some extra attention! - template - class EdgeMap : public ReadWriteMap - { - public: - - ///\e - EdgeMap(const UGraph&) { } - ///\e - EdgeMap(const UGraph&, T) { } - ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } - ///Assignment operator - template - EdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// Read write map of the undirected edges to type \c T. - - /// Reference map of the edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (UEdgeMap) - /// needs some extra attention! - template - class UEdgeMap : public ReadWriteMap - { - public: - - ///\e - UEdgeMap(const UGraph&) { } - ///\e - UEdgeMap(const UGraph&, T) { } - ///Copy constructor - UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} - ///Assignment operator - template - UEdgeMap& operator=(const CMap&) { - checkConcept, CMap>(); - return *this; - } - }; - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge source - /// will be the given node. - Edge direct(const UEdge&, const Node&) const { - return INVALID; - } - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge - /// represents the given undireted edge and the direction comes - /// from the given bool. The source of the undirected edge and - /// the directed edge is the same when the given bool is true. - Edge direct(const UEdge&, bool) const { - return INVALID; - } - - /// \brief Returns true if the edge has default orientation. - /// - /// Returns whether the given directed edge is same orientation as - /// the corresponding undirected edge's default orientation. - bool direction(Edge) const { return true; } - - /// \brief Returns the opposite directed edge. - /// - /// Returns the opposite directed edge. - Edge oppositeEdge(Edge) const { return INVALID; } - - /// \brief Opposite node on an edge - /// - /// \return the opposite of the given Node on the given UEdge - Node oppositeNode(Node, UEdge) const { return INVALID; } - - /// \brief First node of the undirected edge. - /// - /// \return the first node of the given UEdge. - /// - /// Naturally undirected edges don't have direction and thus - /// don't have source and target node. But we use these two methods - /// to query the two nodes of the edge. The direction of the edge - /// which arises this way is called the inherent direction of the - /// undirected edge, and is used to define the "default" direction - /// of the directed versions of the edges. - /// \sa direction - Node source(UEdge) const { return INVALID; } - - /// \brief Second node of the undirected edge. - Node target(UEdge) const { return INVALID; } - - /// \brief Source node of the directed edge. - Node source(Edge) const { return INVALID; } - - /// \brief Target node of the directed edge. - Node target(Edge) const { return INVALID; } - - void first(Node&) const {} - void next(Node&) const {} - - void first(UEdge&) const {} - void next(UEdge&) const {} - - void first(Edge&) const {} - void next(Edge&) const {} - - void firstOut(Edge&, Node) const {} - void nextOut(Edge&) const {} - - void firstIn(Edge&, Node) const {} - void nextIn(Edge&) const {} - - - void firstInc(UEdge &, bool &, const Node &) const {} - void nextInc(UEdge &, bool &) const {} - - /// \brief Base node of the iterator - /// - /// Returns the base node (the source in this case) of the iterator - Node baseNode(OutEdgeIt e) const { - return source(e); - } - /// \brief Running node of the iterator - /// - /// Returns the running node (the target in this case) of the - /// iterator - Node runningNode(OutEdgeIt e) const { - return target(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node (the target in this case) of the iterator - Node baseNode(InEdgeIt e) const { - return target(e); - } - /// \brief Running node of the iterator - /// - /// Returns the running node (the source in this case) of the - /// iterator - Node runningNode(InEdgeIt e) const { - return source(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node of the iterator - Node baseNode(IncEdgeIt) const { - return INVALID; - } - - /// \brief Running node of the iterator - /// - /// Returns the running node of the iterator - Node runningNode(IncEdgeIt) const { - return INVALID; - } - - template - struct Constraints { - void constraints() { - checkConcept, Graph>(); - checkConcept, Graph>(); - } - }; - - }; - - /// @} - - } - -} - -#endif diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/bpugraph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/bpugraph.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,1020 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +/// \ingroup graph_concepts +/// \file +/// \brief Undirected bipartite graphs and components of. + + +#ifndef LEMON_CONCEPT_BPUGRAPH_H +#define LEMON_CONCEPT_BPUGRAPH_H + +#include + +#include +#include + +#include + +namespace lemon { + namespace concepts { + + /// \addtogroup graph_concepts + /// @{ + + + /// \brief Class describing the concept of Bipartite Undirected Graphs. + /// + /// This class describes the common interface of all + /// Undirected Bipartite Graphs. + /// + /// As all concept describing classes it provides only interface + /// without any sensible implementation. So any algorithm for + /// bipartite undirected graph should compile with this class, but it + /// will not run properly, of course. + /// + /// In LEMON bipartite undirected graphs also fulfill the concept of + /// the undirected graphs (\ref lemon::concepts::UGraph "UGraph Concept"). + /// + /// You can assume that all undirected bipartite graph can be handled + /// as an undirected graph and consequently as a static graph. + /// + /// The bipartite graph stores two types of nodes which are named + /// ANode and BNode. The graph type contains two types ANode and + /// BNode which are inherited from Node type. Moreover they have + /// constructor which converts Node to either ANode or BNode when + /// it is possible. Therefor everywhere the Node type can be used + /// instead of ANode and BNode. So the usage of the ANode and + /// BNode is not suggested. + /// + /// The iteration on the partition can be done with the ANodeIt and + /// BNodeIt classes. The node map can be used to map values to the nodes + /// and similarly we can use to map values for just the ANodes and + /// BNodes the ANodeMap and BNodeMap template classes. + + class BpUGraph { + public: + /// \brief The undirected graph should be tagged by the + /// UndirectedTag. + /// + /// The undirected graph should be tagged by the UndirectedTag. This + /// tag helps the enable_if technics to make compile time + /// specializations for undirected graphs. + typedef True UndirectedTag; + + /// \brief The base type of node iterators, + /// or in other words, the trivial node iterator. + /// + /// This is the base type of each node iterator, + /// thus each kind of node iterator converts to this. + /// More precisely each kind of node iterator should be inherited + /// from the trivial node iterator. The Node class represents + /// both of two types of nodes. + class Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + Node(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + Node(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Node) const { return true; } + + /// Inequality operator + + /// \sa operator==(Node n) + /// + bool operator!=(Node) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Node) const { return false; } + + }; + + /// \brief Helper class for ANodes. + /// + /// This class is just a helper class for ANodes, it is not + /// suggested to use it directly. It can be converted easily to + /// node and vice versa. The usage of this class is limited + /// to use just as template parameters for special map types. + class ANode : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + ANode() : Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + ANode(const ANode&) : Node() { } + + /// Construct the same node as ANode. + + /// Construct the same node as ANode. It may throws assertion + /// when the given node is from the BNode set. + ANode(const Node&) : Node() { } + + /// Assign node to A-node. + + /// Besides the core graph item functionality each node should + /// be convertible to the represented A-node if it is it possible. + ANode& operator=(const Node&) { return *this; } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + ANode(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(ANode) const { return true; } + + /// Inequality operator + + /// \sa operator==(ANode n) + /// + bool operator!=(ANode) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(ANode) const { return false; } + + }; + + /// \brief Helper class for BNodes. + /// + /// This class is just a helper class for BNodes, it is not + /// suggested to use it directly. It can be converted easily to + /// node and vice versa. The usage of this class is limited + /// to use just as template parameters for special map types. + class BNode : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + BNode() : Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + BNode(const BNode&) : Node() { } + + /// Construct the same node as BNode. + + /// Construct the same node as BNode. It may throws assertion + /// when the given node is from the ANode set. + BNode(const Node&) : Node() { } + + /// Assign node to B-node. + + /// Besides the core graph item functionality each node should + /// be convertible to the represented B-node if it is it possible. + BNode& operator=(const Node&) { return *this; } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + BNode(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(BNode) const { return true; } + + /// Inequality operator + + /// \sa operator==(BNode n) + /// + bool operator!=(BNode) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(BNode) const { return false; } + + }; + + /// This iterator goes through each node. + + /// This iterator goes through each node. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + ///\code + /// int count=0; + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; + ///\endcode + class NodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + NodeIt(const NodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + NodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + NodeIt(const BpUGraph&) { } + /// Node -> NodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + NodeIt(const BpUGraph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + NodeIt& operator++() { return *this; } + }; + + /// This iterator goes through each ANode. + + /// This iterator goes through each ANode. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + ///\code + /// int count=0; + /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count; + ///\endcode + class ANodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + ANodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + ANodeIt(const ANodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + ANodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + ANodeIt(const BpUGraph&) { } + /// Node -> ANodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + ANodeIt(const BpUGraph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + ANodeIt& operator++() { return *this; } + }; + + /// This iterator goes through each BNode. + + /// This iterator goes through each BNode. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + ///\code + /// int count=0; + /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count; + ///\endcode + class BNodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + BNodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + BNodeIt(const BNodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + BNodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + BNodeIt(const BpUGraph&) { } + /// Node -> BNodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + BNodeIt(const BpUGraph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + BNodeIt& operator++() { return *this; } + }; + + + /// The base type of the undirected edge iterators. + + /// The base type of the undirected edge iterators. + /// + class UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdge() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdge(const UEdge&) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(UEdge) const { return true; } + /// Inequality operator + + /// \sa operator==(UEdge n) + /// + bool operator!=(UEdge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(UEdge) const { return false; } + }; + + /// This iterator goes through each undirected edge. + + /// This iterator goes through each undirected edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of undirected edges in a graph \c g of type \c Graph as follows: + ///\code + /// int count=0; + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; + ///\endcode + class UEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdgeIt(const UEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first undirected edge. + + /// This constructor sets the iterator to the first undirected edge. + UEdgeIt(const BpUGraph&) { } + /// UEdge -> UEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the undirected edge-set, the iteration order is the + /// same. + UEdgeIt(const BpUGraph&, const UEdge&) { } + /// Next undirected edge + + /// Assign the iterator to the next undirected edge. + UEdgeIt& operator++() { return *this; } + }; + + /// \brief This iterator goes trough the incident undirected + /// edges of a node. + /// + /// This iterator goes trough the incident undirected edges + /// of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can compute the + /// degree (i.e. count the number + /// of incident edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + class IncEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + IncEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + IncEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incident edge. + + /// This constructor set the iterator to the first incident edge of + /// the node. + IncEdgeIt(const BpUGraph&, const Node&) { } + /// UEdge -> IncEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + IncEdgeIt(const BpUGraph&, const UEdge&) { } + /// Next incident edge + + /// Assign the iterator to the next incident edge + /// of the corresponding node. + IncEdgeIt& operator++() { return *this; } + }; + + /// The directed edge type. + + /// The directed edge type. It can be converted to the + /// undirected edge. + class Edge : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() { } + /// Copy constructor. + + /// Copy constructor. + /// + Edge(const Edge& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + Edge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Edge) const { return true; } + /// Inequality operator + + /// \sa operator==(Edge n) + /// + bool operator!=(Edge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Edge) const { return false; } + + }; + /// This iterator goes through each directed edge. + + /// This iterator goes through each edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of edges in a graph \c g of type \c Graph as follows: + ///\code + /// int count=0; + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; + ///\endcode + class EdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + EdgeIt(const EdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + EdgeIt(Invalid) { } + /// This constructor sets the iterator to the first edge. + + /// This constructor sets the iterator to the first edge of \c g. + ///@param g the graph + EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); } + /// Edge -> EdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + EdgeIt(const BpUGraph&, const Edge&) { } + ///Next edge + + /// Assign the iterator to the next edge. + EdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the outgoing directed edges of a node. + + /// This iterator goes trough the \e outgoing edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class OutEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + OutEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first outgoing edge. + + /// This constructor sets the iterator to the first outgoing edge of + /// the node. + ///@param n the node + ///@param g the graph + OutEdgeIt(const BpUGraph& n, const Node& g) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> OutEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + OutEdgeIt(const BpUGraph&, const Edge&) { } + ///Next outgoing edge + + /// Assign the iterator to the next + /// outgoing edge of the corresponding node. + OutEdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the incoming directed edges of a node. + + /// This iterator goes trough the \e incoming edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class InEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + InEdgeIt(const InEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + InEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incoming edge. + + /// This constructor set the iterator to the first incoming edge of + /// the node. + ///@param n the node + ///@param g the graph + InEdgeIt(const BpUGraph& g, const Node& n) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> InEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + InEdgeIt(const BpUGraph&, const Edge&) { } + /// Next incoming edge + + /// Assign the iterator to the next inedge of the corresponding node. + /// + InEdgeIt& operator++() { return *this; } + }; + + /// \brief Read write map of the nodes to type \c T. + /// + /// ReadWrite map of the nodes to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (NodeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class NodeMap : public ReadWriteMap< Node, T > + { + public: + + ///\e + NodeMap(const BpUGraph&) { } + ///\e + NodeMap(const BpUGraph&, T) { } + + ///Copy constructor + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + NodeMap& operator=(const NodeMap&) { return *this; } + ///Assignment operator + template + NodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Read write map of the ANodes to type \c T. + /// + /// ReadWrite map of the ANodes to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (NodeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class ANodeMap : public ReadWriteMap< Node, T > + { + public: + + ///\e + ANodeMap(const BpUGraph&) { } + ///\e + ANodeMap(const BpUGraph&, T) { } + + ///Copy constructor + ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + ANodeMap& operator=(const ANodeMap&) { return *this; } + ///Assignment operator + template + ANodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Read write map of the BNodes to type \c T. + /// + /// ReadWrite map of the BNodes to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (NodeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class BNodeMap : public ReadWriteMap< Node, T > + { + public: + + ///\e + BNodeMap(const BpUGraph&) { } + ///\e + BNodeMap(const BpUGraph&, T) { } + + ///Copy constructor + BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + BNodeMap& operator=(const BNodeMap&) { return *this; } + ///Assignment operator + template + BNodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Read write map of the directed edges to type \c T. + /// + /// Reference map of the directed edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (EdgeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class EdgeMap : public ReadWriteMap + { + public: + + ///\e + EdgeMap(const BpUGraph&) { } + ///\e + EdgeMap(const BpUGraph&, T) { } + ///Copy constructor + EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } + ///Assignment operator + EdgeMap& operator=(const EdgeMap&) { return *this; } + ///Assignment operator + template + EdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// Read write map of the undirected edges to type \c T. + + /// Reference map of the edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (UEdgeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class UEdgeMap : public ReadWriteMap + { + public: + + ///\e + UEdgeMap(const BpUGraph&) { } + ///\e + UEdgeMap(const BpUGraph&, T) { } + ///Copy constructor + UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} + ///Assignment operator + UEdgeMap &operator=(const UEdgeMap&) { return *this; } + ///Assignment operator + template + UEdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge source + /// will be the given node. + Edge direct(const UEdge&, const Node&) const { + return INVALID; + } + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge + /// represents the given undireted edge and the direction comes + /// from the given bool. The source of the undirected edge and + /// the directed edge is the same when the given bool is true. + Edge direct(const UEdge&, bool) const { + return INVALID; + } + + /// \brief Returns true when the given node is an ANode. + /// + /// Returns true when the given node is an ANode. + bool aNode(Node) const { return true;} + + /// \brief Returns true when the given node is an BNode. + /// + /// Returns true when the given node is an BNode. + bool bNode(Node) const { return true;} + + /// \brief Returns the edge's end node which is in the ANode set. + /// + /// Returns the edge's end node which is in the ANode set. + Node aNode(UEdge) const { return INVALID;} + + /// \brief Returns the edge's end node which is in the BNode set. + /// + /// Returns the edge's end node which is in the BNode set. + Node bNode(UEdge) const { return INVALID;} + + /// \brief Returns true if the edge has default orientation. + /// + /// Returns whether the given directed edge is same orientation as + /// the corresponding undirected edge's default orientation. + bool direction(Edge) const { return true; } + + /// \brief Returns the opposite directed edge. + /// + /// Returns the opposite directed edge. + Edge oppositeEdge(Edge) const { return INVALID; } + + /// \brief Opposite node on an edge + /// + /// \return the opposite of the given Node on the given UEdge + Node oppositeNode(Node, UEdge) const { return INVALID; } + + /// \brief First node of the undirected edge. + /// + /// \return the first node of the given UEdge. + /// + /// Naturally undirected edges don't have direction and thus + /// don't have source and target node. But we use these two methods + /// to query the two endnodes of the edge. The direction of the edge + /// which arises this way is called the inherent direction of the + /// undirected edge, and is used to define the "default" direction + /// of the directed versions of the edges. + /// \sa direction + Node source(UEdge) const { return INVALID; } + + /// \brief Second node of the undirected edge. + Node target(UEdge) const { return INVALID; } + + /// \brief Source node of the directed edge. + Node source(Edge) const { return INVALID; } + + /// \brief Target node of the directed edge. + Node target(Edge) const { return INVALID; } + + /// \brief Base node of the iterator + /// + /// Returns the base node (the source in this case) of the iterator + Node baseNode(OutEdgeIt e) const { + return source(e); + } + + /// \brief Running node of the iterator + /// + /// Returns the running node (the target in this case) of the + /// iterator + Node runningNode(OutEdgeIt e) const { + return target(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node (the target in this case) of the iterator + Node baseNode(InEdgeIt e) const { + return target(e); + } + /// \brief Running node of the iterator + /// + /// Returns the running node (the source in this case) of the + /// iterator + Node runningNode(InEdgeIt e) const { + return source(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node of the iterator + Node baseNode(IncEdgeIt) const { + return INVALID; + } + + /// \brief Running node of the iterator + /// + /// Returns the running node of the iterator + Node runningNode(IncEdgeIt) const { + return INVALID; + } + + void first(Node&) const {} + void next(Node&) const {} + + void first(Edge&) const {} + void next(Edge&) const {} + + void first(UEdge&) const {} + void next(UEdge&) const {} + + void firstANode(Node&) const {} + void nextANode(Node&) const {} + + void firstBNode(Node&) const {} + void nextBNode(Node&) const {} + + void firstIn(Edge&, const Node&) const {} + void nextIn(Edge&) const {} + + void firstOut(Edge&, const Node&) const {} + void nextOut(Edge&) const {} + + void firstInc(UEdge &, bool &, const Node &) const {} + void nextInc(UEdge &, bool &) const {} + + void firstFromANode(UEdge&, const Node&) const {} + void nextFromANode(UEdge&) const {} + + void firstFromBNode(UEdge&, const Node&) const {} + void nextFromBNode(UEdge&) const {} + + template + struct Constraints { + void constraints() { + checkConcept, Graph>(); + checkConcept, Graph>(); + } + }; + + }; + + + /// @} + + } + +} + +#endif diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/graph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/graph.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,455 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_CONCEPT_GRAPH_H +#define LEMON_CONCEPT_GRAPH_H + +///\ingroup graph_concepts +///\file +///\brief Declaration of Graph. + +#include +#include +#include +#include +#include + +namespace lemon { + namespace concepts { + + /// \addtogroup graph_concepts + /// @{ + + /// The directed graph concept + + /// This class describes the \ref concept "concept" of the + /// immutable directed graphs. + /// + /// Note that actual graph implementation like @ref ListGraph or + /// @ref SmartGraph may have several additional functionality. + /// + /// \sa concept + class Graph { + private: + ///Graphs are \e not copy constructible. Use GraphCopy() instead. + + ///Graphs are \e not copy constructible. Use GraphCopy() instead. + /// + Graph(const Graph &) {}; + ///\brief Assignment of \ref Graph "Graph"s to another ones are + ///\e not allowed. Use GraphCopy() instead. + + ///Assignment of \ref Graph "Graph"s to another ones are + ///\e not allowed. Use GraphCopy() instead. + + void operator=(const Graph &) {} + public: + ///\e + + /// Defalult constructor. + + /// Defalult constructor. + /// + Graph() { } + /// Class for identifying a node of the graph + + /// This class identifies a node of the graph. It also serves + /// as a base class of the node iterators, + /// thus they will convert to this type. + class Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + Node(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + Node(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Node) const { return true; } + + /// Inequality operator + + /// \sa operator==(Node n) + /// + bool operator!=(Node) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Node) const { return false; } + + }; + + /// This iterator goes through each node. + + /// This iterator goes through each node. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + ///\code + /// int count=0; + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; + ///\endcode + class NodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + NodeIt(const NodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + NodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + NodeIt(const Graph&) { } + /// Node -> NodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + NodeIt(const Graph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + NodeIt& operator++() { return *this; } + }; + + + /// Class for identifying an edge of the graph + + /// This class identifies an edge of the graph. It also serves + /// as a base class of the edge iterators, + /// thus they will convert to this type. + class Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() { } + /// Copy constructor. + + /// Copy constructor. + /// + Edge(const Edge&) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + Edge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Edge) const { return true; } + /// Inequality operator + + /// \sa operator==(Edge n) + /// + bool operator!=(Edge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Edge) const { return false; } + }; + + /// This iterator goes trough the outgoing edges of a node. + + /// This iterator goes trough the \e outgoing edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class OutEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + OutEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first outgoing edge. + + /// This constructor sets the iterator to the first outgoing edge of + /// the node. + OutEdgeIt(const Graph&, const Node&) { } + /// Edge -> OutEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + OutEdgeIt(const Graph&, const Edge&) { } + ///Next outgoing edge + + /// Assign the iterator to the next + /// outgoing edge of the corresponding node. + OutEdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the incoming edges of a node. + + /// This iterator goes trough the \e incoming edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class InEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + InEdgeIt(const InEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + InEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incoming edge. + + /// This constructor set the iterator to the first incoming edge of + /// the node. + InEdgeIt(const Graph&, const Node&) { } + /// Edge -> InEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + InEdgeIt(const Graph&, const Edge&) { } + /// Next incoming edge + + /// Assign the iterator to the next inedge of the corresponding node. + /// + InEdgeIt& operator++() { return *this; } + }; + /// This iterator goes through each edge. + + /// This iterator goes through each edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of edges in a graph \c g of type \c Graph as follows: + ///\code + /// int count=0; + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; + ///\endcode + class EdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + EdgeIt(const EdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + EdgeIt(Invalid) { } + /// This constructor sets the iterator to the first edge. + + /// This constructor sets the iterator to the first edge of \c g. + ///@param g the graph + EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); } + /// Edge -> EdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + EdgeIt(const Graph&, const Edge&) { } + ///Next edge + + /// Assign the iterator to the next edge. + EdgeIt& operator++() { return *this; } + }; + ///Gives back the target node of an edge. + + ///Gives back the target node of an edge. + /// + Node target(Edge) const { return INVALID; } + ///Gives back the source node of an edge. + + ///Gives back the source node of an edge. + /// + Node source(Edge) const { return INVALID; } + + void first(Node&) const {} + void next(Node&) const {} + + void first(Edge&) const {} + void next(Edge&) const {} + + + void firstIn(Edge&, const Node&) const {} + void nextIn(Edge&) const {} + + void firstOut(Edge&, const Node&) const {} + void nextOut(Edge&) const {} + + /// \brief The base node of the iterator. + /// + /// Gives back the base node of the iterator. + /// It is always the target of the pointed edge. + Node baseNode(const InEdgeIt&) const { return INVALID; } + + /// \brief The running node of the iterator. + /// + /// Gives back the running node of the iterator. + /// It is always the source of the pointed edge. + Node runningNode(const InEdgeIt&) const { return INVALID; } + + /// \brief The base node of the iterator. + /// + /// Gives back the base node of the iterator. + /// It is always the source of the pointed edge. + Node baseNode(const OutEdgeIt&) const { return INVALID; } + + /// \brief The running node of the iterator. + /// + /// Gives back the running node of the iterator. + /// It is always the target of the pointed edge. + Node runningNode(const OutEdgeIt&) const { return INVALID; } + + /// \brief The opposite node on the given edge. + /// + /// Gives back the opposite node on the given edge. + Node oppositeNode(const Node&, const Edge&) const { return INVALID; } + + /// \brief Read write map of the nodes to type \c T. + /// + /// ReadWrite map of the nodes to type \c T. + /// \sa Reference + template + class NodeMap : public ReadWriteMap< Node, T > { + public: + + ///\e + NodeMap(const Graph&) { } + ///\e + NodeMap(const Graph&, T) { } + + ///Copy constructor + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + template + NodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Read write map of the edges to type \c T. + /// + /// Reference map of the edges to type \c T. + /// \sa Reference + template + class EdgeMap : public ReadWriteMap { + public: + + ///\e + EdgeMap(const Graph&) { } + ///\e + EdgeMap(const Graph&, T) { } + ///Copy constructor + EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } + ///Assignment operator + template + EdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + template + struct Constraints { + void constraints() { + checkConcept, Graph>(); + checkConcept, Graph>(); + } + }; + + }; + + // @} + } //namespace concepts +} //namespace lemon + + + +#endif // LEMON_CONCEPT_GRAPH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/graph_components.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/graph_components.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,2103 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +///\ingroup graph_concepts +///\file +///\brief The concept of the graph components. + + +#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H +#define LEMON_CONCEPT_GRAPH_COMPONENTS_H + +#include +#include + +#include + +namespace lemon { + namespace concepts { + + /// \brief Skeleton class for graph Node and Edge types + /// + /// This class describes the interface of Node and Edge (and UEdge + /// in undirected graphs) subtypes of graph types. + /// + /// \note This class is a template class so that we can use it to + /// create graph skeleton classes. The reason for this is than Node + /// and Edge types should \em not derive from the same base class. + /// For Node you should instantiate it with character 'n' and for Edge + /// with 'e'. + +#ifndef DOXYGEN + template +#endif + class GraphItem { + public: + /// \brief Default constructor. + /// + /// \warning The default constructor is not required to set + /// the item to some well-defined value. So you should consider it + /// as uninitialized. + GraphItem() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + GraphItem(const GraphItem &) {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + GraphItem(Invalid) {} + /// \brief Assign operator for nodes. + /// + /// The nodes are assignable. + /// + GraphItem& operator=(GraphItem const&) { return *this; } + /// \brief Equality operator. + /// + /// Two iterators are equal if and only if they represents the + /// same node in the graph or both are invalid. + bool operator==(GraphItem) const { return false; } + /// \brief Inequality operator. + /// + /// \sa operator==(const Node& n) + /// + bool operator!=(GraphItem) const { return false; } + + /// \brief Artificial ordering operator. + /// + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(GraphItem) const { return false; } + + template + struct Constraints { + void constraints() { + _GraphItem i1; + _GraphItem i2 = i1; + _GraphItem i3 = INVALID; + + i1 = i2 = i3; + + bool b; + // b = (ia == ib) && (ia != ib) && (ia < ib); + b = (ia == ib) && (ia != ib); + b = (ia == INVALID) && (ib != INVALID); + b = (ia < ib); + } + + const _GraphItem &ia; + const _GraphItem &ib; + }; + }; + + /// \brief An empty base graph class. + /// + /// This class provides the minimal set of features needed for a graph + /// structure. All graph concepts have to be conform to this base + /// graph. It just provides types for nodes and edges and functions to + /// get the source and the target of the edges. + class BaseGraphComponent { + public: + + typedef BaseGraphComponent Graph; + + /// \brief Node class of the graph. + /// + /// This class represents the Nodes of the graph. + /// + typedef GraphItem<'n'> Node; + + /// \brief Edge class of the graph. + /// + /// This class represents the Edges of the graph. + /// + typedef GraphItem<'e'> Edge; + + /// \brief Gives back the target node of an edge. + /// + /// Gives back the target node of an edge. + /// + Node target(const Edge&) const { return INVALID;} + + /// \brief Gives back the source node of an edge. + /// + /// Gives back the source node of an edge. + /// + Node source(const Edge&) const { return INVALID;} + + /// \brief Gives back the opposite node on the given edge. + /// + /// Gives back the opposite node on the given edge. + Node oppositeNode(const Node&, const Edge&) const { + return INVALID; + } + + template + struct Constraints { + typedef typename _Graph::Node Node; + typedef typename _Graph::Edge Edge; + + void constraints() { + checkConcept, Node>(); + checkConcept, Edge>(); + { + Node n; + Edge e(INVALID); + n = graph.source(e); + n = graph.target(e); + n = graph.oppositeNode(n, e); + } + } + + const _Graph& graph; + }; + }; + + /// \brief An empty base undirected graph class. + /// + /// This class provides the minimal set of features needed for an + /// undirected graph structure. All undirected graph concepts have + /// to be conform to this base graph. It just provides types for + /// nodes, edges and undirected edges and functions to get the + /// source and the target of the edges and undirected edges, + /// conversion from edges to undirected edges and function to get + /// both direction of the undirected edges. + class BaseUGraphComponent : public BaseGraphComponent { + public: + typedef BaseGraphComponent::Node Node; + typedef BaseGraphComponent::Edge Edge; + /// \brief Undirected edge class of the graph. + /// + /// This class represents the undirected edges of the graph. + /// The undirected graphs can be used as a directed graph which + /// for each edge contains the opposite edge too so the graph is + /// bidirected. The undirected edge represents two opposite + /// directed edges. + class UEdge : public GraphItem<'u'> { + public: + typedef GraphItem<'u'> Parent; + /// \brief Default constructor. + /// + /// \warning The default constructor is not required to set + /// the item to some well-defined value. So you should consider it + /// as uninitialized. + UEdge() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + UEdge(const UEdge &) : Parent() {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + UEdge(Invalid) {} + /// \brief Converter from edge to undirected edge. + /// + /// Besides the core graph item functionality each edge should + /// be convertible to the represented undirected edge. + UEdge(const Edge&) {} + /// \brief Assign edge to undirected edge. + /// + /// Besides the core graph item functionality each edge should + /// be convertible to the represented undirected edge. + UEdge& operator=(const Edge&) { return *this; } + }; + + /// \brief Returns the direction of the edge. + /// + /// Returns the direction of the edge. Each edge represents an + /// undirected edge with a direction. It gives back the + /// direction. + bool direction(const Edge&) const { return true; } + + /// \brief Returns the directed edge. + /// + /// Returns the directed edge from its direction and the + /// represented undirected edge. + Edge direct(const UEdge&, bool) const { return INVALID;} + + /// \brief Returns the directed edge. + /// + /// Returns the directed edge from its source and the + /// represented undirected edge. + Edge direct(const UEdge&, const Node&) const { return INVALID;} + + /// \brief Returns the opposite edge. + /// + /// Returns the opposite edge. It is the edge representing the + /// same undirected edge and has opposite direction. + Edge oppositeEdge(const Edge&) const { return INVALID;} + + /// \brief Gives back the target node of an undirected edge. + /// + /// Gives back the target node of an undirected edge. The name + /// target is a little confusing because the undirected edge + /// does not have target but it just means that one of the end + /// node. + Node target(const UEdge&) const { return INVALID;} + + /// \brief Gives back the source node of an undirected edge. + /// + /// Gives back the source node of an undirected edge. The name + /// source is a little confusing because the undirected edge + /// does not have source but it just means that one of the end + /// node. + Node source(const UEdge&) const { return INVALID;} + + template + struct Constraints { + typedef typename _Graph::Node Node; + typedef typename _Graph::Edge Edge; + typedef typename _Graph::UEdge UEdge; + + void constraints() { + checkConcept(); + checkConcept, UEdge>(); + { + Node n; + UEdge ue(INVALID); + Edge e; + n = graph.source(ue); + n = graph.target(ue); + e = graph.direct(ue, true); + e = graph.direct(ue, n); + e = graph.oppositeEdge(e); + ue = e; + bool d = graph.direction(e); + ignore_unused_variable_warning(d); + } + } + + const _Graph& graph; + }; + + }; + + /// \brief An empty base bipartite undirected graph class. + /// + /// This class provides the minimal set of features needed for an + /// bipartite undirected graph structure. All bipartite undirected + /// graph concepts have to be conform to this base graph. It just + /// provides types for nodes, A-nodes, B-nodes, edges and + /// undirected edges and functions to get the source and the + /// target of the edges and undirected edges, conversion from + /// edges to undirected edges and function to get both direction + /// of the undirected edges. + class BaseBpUGraphComponent : public BaseUGraphComponent { + public: + typedef BaseUGraphComponent::Node Node; + typedef BaseUGraphComponent::Edge Edge; + typedef BaseUGraphComponent::UEdge UEdge; + + /// \brief Helper class for A-nodes. + /// + /// This class is just a helper class for A-nodes, it is not + /// suggested to use it directly. It can be converted easily to + /// node and vice versa. The usage of this class is limited + /// to use just as template parameters for special map types. + class ANode : public Node { + public: + typedef Node Parent; + + /// \brief Default constructor. + /// + /// \warning The default constructor is not required to set + /// the item to some well-defined value. So you should consider it + /// as uninitialized. + ANode() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + ANode(const ANode &) : Parent() {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + ANode(Invalid) {} + /// \brief Converter from node to A-node. + /// + /// Besides the core graph item functionality each node should + /// be convertible to the represented A-node if it is it possible. + ANode(const Node&) {} + /// \brief Assign node to A-node. + /// + /// Besides the core graph item functionality each node should + /// be convertible to the represented A-node if it is it possible. + ANode& operator=(const Node&) { return *this; } + }; + + /// \brief Helper class for B-nodes. + /// + /// This class is just a helper class for B-nodes, it is not + /// suggested to use it directly. It can be converted easily to + /// node and vice versa. The usage of this class is limited + /// to use just as template parameters for special map types. + class BNode : public Node { + public: + typedef Node Parent; + + /// \brief Default constructor. + /// + /// \warning The default constructor is not required to set + /// the item to some well-defined value. So you should consider it + /// as uninitialized. + BNode() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + BNode(const BNode &) : Parent() {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + BNode(Invalid) {} + /// \brief Converter from node to B-node. + /// + /// Besides the core graph item functionality each node should + /// be convertible to the represented B-node if it is it possible. + BNode(const Node&) {} + /// \brief Assign node to B-node. + /// + /// Besides the core graph item functionality each node should + /// be convertible to the represented B-node if it is it possible. + BNode& operator=(const Node&) { return *this; } + }; + + /// \brief Gives back %true when the node is A-node. + /// + /// Gives back %true when the node is A-node. + bool aNode(const Node&) const { return false; } + + /// \brief Gives back %true when the node is B-node. + /// + /// Gives back %true when the node is B-node. + bool bNode(const Node&) const { return false; } + + /// \brief Gives back the A-node of the undirected edge. + /// + /// Gives back the A-node of the undirected edge. + Node aNode(const UEdge&) const { return INVALID; } + + /// \brief Gives back the B-node of the undirected edge. + /// + /// Gives back the B-node of the undirected edge. + Node bNode(const UEdge&) const { return INVALID; } + + template + struct Constraints { + typedef typename _Graph::Node Node; + typedef typename _Graph::ANode ANode; + typedef typename _Graph::BNode BNode; + typedef typename _Graph::Edge Edge; + typedef typename _Graph::UEdge UEdge; + + void constraints() { + checkConcept(); + checkConcept, ANode>(); + checkConcept, BNode>(); + { + Node n; + UEdge ue(INVALID); + bool b; + n = graph.aNode(ue); + n = graph.bNode(ue); + b = graph.aNode(n); + b = graph.bNode(n); + ANode an; + an = n; n = an; + BNode bn; + bn = n; n = bn; + ignore_unused_variable_warning(b); + } + } + + const _Graph& graph; + }; + + }; + + /// \brief An empty idable base graph class. + /// + /// This class provides beside the core graph features + /// core id functions for the graph structure. + /// The most of the base graphs should be conform to this concept. + /// The id's are unique and immutable. + template + class IDableGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + + /// \brief Gives back an unique integer id for the Node. + /// + /// Gives back an unique integer id for the Node. + /// + int id(const Node&) const { return -1;} + + /// \brief Gives back the node by the unique id. + /// + /// Gives back the node by the unique id. + /// If the graph does not contain node with the given id + /// then the result of the function is undetermined. + Node nodeFromId(int) const { return INVALID;} + + /// \brief Gives back an unique integer id for the Edge. + /// + /// Gives back an unique integer id for the Edge. + /// + int id(const Edge&) const { return -1;} + + /// \brief Gives back the edge by the unique id. + /// + /// Gives back the edge by the unique id. + /// If the graph does not contain edge with the given id + /// then the result of the function is undetermined. + Edge edgeFromId(int) const { return INVALID;} + + /// \brief Gives back an integer greater or equal to the maximum + /// Node id. + /// + /// Gives back an integer greater or equal to the maximum Node + /// id. + int maxNodeId() const { return -1;} + + /// \brief Gives back an integer greater or equal to the maximum + /// Edge id. + /// + /// Gives back an integer greater or equal to the maximum Edge + /// id. + int maxEdgeId() const { return -1;} + + template + struct Constraints { + + void constraints() { + checkConcept(); + typename _Graph::Node node; + int nid = graph.id(node); + nid = graph.id(node); + node = graph.nodeFromId(nid); + typename _Graph::Edge edge; + int eid = graph.id(edge); + eid = graph.id(edge); + edge = graph.edgeFromId(eid); + + nid = graph.maxNodeId(); + ignore_unused_variable_warning(nid); + eid = graph.maxEdgeId(); + ignore_unused_variable_warning(eid); + } + + const _Graph& graph; + }; + }; + + /// \brief An empty idable base undirected graph class. + /// + /// This class provides beside the core undirected graph features + /// core id functions for the undirected graph structure. The + /// most of the base undirected graphs should be conform to this + /// concept. The id's are unique and immutable. + template + class IDableUGraphComponent : public IDableGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::UEdge UEdge; + + using IDableGraphComponent<_Base>::id; + + /// \brief Gives back an unique integer id for the UEdge. + /// + /// Gives back an unique integer id for the UEdge. + /// + int id(const UEdge&) const { return -1;} + + /// \brief Gives back the undirected edge by the unique id. + /// + /// Gives back the undirected edge by the unique id. If the + /// graph does not contain edge with the given id then the + /// result of the function is undetermined. + UEdge uEdgeFromId(int) const { return INVALID;} + + /// \brief Gives back an integer greater or equal to the maximum + /// UEdge id. + /// + /// Gives back an integer greater or equal to the maximum UEdge + /// id. + int maxUEdgeId() const { return -1;} + + template + struct Constraints { + + void constraints() { + checkConcept(); + checkConcept, _Graph >(); + typename _Graph::UEdge uedge; + int ueid = graph.id(uedge); + ueid = graph.id(uedge); + uedge = graph.uEdgeFromId(ueid); + ueid = graph.maxUEdgeId(); + ignore_unused_variable_warning(ueid); + } + + const _Graph& graph; + }; + }; + + /// \brief An empty idable base bipartite undirected graph class. + /// + /// This class provides beside the core bipartite undirected graph + /// features core id functions for the bipartite undirected graph + /// structure. The most of the base undirected graphs should be + /// conform to this concept. + template + class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + + using IDableUGraphComponent<_Base>::id; + + /// \brief Gives back an unique integer id for the ANode. + /// + /// Gives back an unique integer id for the ANode. + /// + int aNodeId(const Node&) const { return -1;} + + /// \brief Gives back the undirected edge by the unique id. + /// + /// Gives back the undirected edge by the unique id. If the + /// graph does not contain edge with the given id then the + /// result of the function is undetermined. + Node nodeFromANodeId(int) const { return INVALID;} + + /// \brief Gives back an integer greater or equal to the maximum + /// ANode id. + /// + /// Gives back an integer greater or equal to the maximum ANode + /// id. + int maxANodeId() const { return -1;} + + /// \brief Gives back an unique integer id for the BNode. + /// + /// Gives back an unique integer id for the BNode. + /// + int bNodeId(const Node&) const { return -1;} + + /// \brief Gives back the undirected edge by the unique id. + /// + /// Gives back the undirected edge by the unique id. If the + /// graph does not contain edge with the given id then the + /// result of the function is undetermined. + Node nodeFromBNodeId(int) const { return INVALID;} + + /// \brief Gives back an integer greater or equal to the maximum + /// BNode id. + /// + /// Gives back an integer greater or equal to the maximum BNode + /// id. + int maxBNodeId() const { return -1;} + + template + struct Constraints { + + void constraints() { + checkConcept(); + checkConcept, _Graph >(); + typename _Graph::Node node(INVALID); + int id; + id = graph.aNodeId(node); + id = graph.bNodeId(node); + node = graph.nodeFromANodeId(id); + node = graph.nodeFromBNodeId(id); + id = graph.maxANodeId(); + id = graph.maxBNodeId(); + } + + const _Graph& graph; + }; + }; + + /// \brief Skeleton class for graph NodeIt and EdgeIt + /// + /// Skeleton class for graph NodeIt and EdgeIt. + /// + template + class GraphItemIt : public _Item { + public: + /// \brief Default constructor. + /// + /// @warning The default constructor sets the iterator + /// to an undefined value. + GraphItemIt() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + GraphItemIt(const GraphItemIt& ) {} + /// \brief Sets the iterator to the first item. + /// + /// Sets the iterator to the first item of \c the graph. + /// + explicit GraphItemIt(const _Graph&) {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + GraphItemIt(Invalid) {} + /// \brief Assign operator for items. + /// + /// The items are assignable. + /// + GraphItemIt& operator=(const GraphItemIt&) { return *this; } + /// \brief Next item. + /// + /// Assign the iterator to the next item. + /// + GraphItemIt& operator++() { return *this; } + /// \brief Equality operator + /// + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(const GraphItemIt&) const { return true;} + /// \brief Inequality operator + /// + /// \sa operator==(Node n) + /// + bool operator!=(const GraphItemIt&) const { return true;} + + template + struct Constraints { + void constraints() { + _GraphItemIt it1(g); + _GraphItemIt it2; + + it2 = ++it1; + ++it2 = it1; + ++(++it1); + + _Item bi = it1; + bi = it2; + } + _Graph& g; + }; + }; + + /// \brief Skeleton class for graph InEdgeIt and OutEdgeIt + /// + /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same + /// base class, the _selector is a additional template parameter. For + /// InEdgeIt you should instantiate it with character 'i' and for + /// OutEdgeIt with 'o'. + template + class GraphIncIt : public _Item { + public: + /// \brief Default constructor. + /// + /// @warning The default constructor sets the iterator + /// to an undefined value. + GraphIncIt() {} + /// \brief Copy constructor. + /// + /// Copy constructor. + /// + GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} + /// \brief Sets the iterator to the first edge incoming into or outgoing + /// from the node. + /// + /// Sets the iterator to the first edge incoming into or outgoing + /// from the node. + /// + explicit GraphIncIt(const _Graph&, const _Base&) {} + /// \brief Invalid constructor \& conversion. + /// + /// This constructor initializes the item to be invalid. + /// \sa Invalid for more details. + GraphIncIt(Invalid) {} + /// \brief Assign operator for iterators. + /// + /// The iterators are assignable. + /// + GraphIncIt& operator=(GraphIncIt const&) { return *this; } + /// \brief Next item. + /// + /// Assign the iterator to the next item. + /// + GraphIncIt& operator++() { return *this; } + + /// \brief Equality operator + /// + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(const GraphIncIt&) const { return true;} + + /// \brief Inequality operator + /// + /// \sa operator==(Node n) + /// + bool operator!=(const GraphIncIt&) const { return true;} + + template + struct Constraints { + void constraints() { + checkConcept, _GraphIncIt>(); + _GraphIncIt it1(graph, node); + _GraphIncIt it2; + + it2 = ++it1; + ++it2 = it1; + ++(++it1); + _Item e = it1; + e = it2; + + } + + _Item edge; + _Base node; + _Graph graph; + _GraphIncIt it; + }; + }; + + + /// \brief An empty iterable graph class. + /// + /// This class provides beside the core graph features + /// iterator based iterable interface for the graph structure. + /// This concept is part of the Graph concept. + template + class IterableGraphComponent : public _Base { + + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + + typedef IterableGraphComponent Graph; + + /// \name Base iteration + /// + /// This interface provides functions for iteration on graph items + /// + /// @{ + + /// \brief Gives back the first node in the iterating order. + /// + /// Gives back the first node in the iterating order. + /// + void first(Node&) const {} + + /// \brief Gives back the next node in the iterating order. + /// + /// Gives back the next node in the iterating order. + /// + void next(Node&) const {} + + /// \brief Gives back the first edge in the iterating order. + /// + /// Gives back the first edge in the iterating order. + /// + void first(Edge&) const {} + + /// \brief Gives back the next edge in the iterating order. + /// + /// Gives back the next edge in the iterating order. + /// + void next(Edge&) const {} + + + /// \brief Gives back the first of the edges point to the given + /// node. + /// + /// Gives back the first of the edges point to the given node. + /// + void firstIn(Edge&, const Node&) const {} + + /// \brief Gives back the next of the edges points to the given + /// node. + /// + /// Gives back the next of the edges points to the given node. + /// + void nextIn(Edge&) const {} + + /// \brief Gives back the first of the edges start from the + /// given node. + /// + /// Gives back the first of the edges start from the given node. + /// + void firstOut(Edge&, const Node&) const {} + + /// \brief Gives back the next of the edges start from the given + /// node. + /// + /// Gives back the next of the edges start from the given node. + /// + void nextOut(Edge&) const {} + + /// @} + + /// \name Class based iteration + /// + /// This interface provides functions for iteration on graph items + /// + /// @{ + + /// \brief This iterator goes through each node. + /// + /// This iterator goes through each node. + /// + typedef GraphItemIt NodeIt; + + /// \brief This iterator goes through each node. + /// + /// This iterator goes through each node. + /// + typedef GraphItemIt EdgeIt; + + /// \brief This iterator goes trough the incoming edges of a node. + /// + /// This iterator goes trough the \e inccoming edges of a certain node + /// of a graph. + typedef GraphIncIt InEdgeIt; + + /// \brief This iterator goes trough the outgoing edges of a node. + /// + /// This iterator goes trough the \e outgoing edges of a certain node + /// of a graph. + typedef GraphIncIt OutEdgeIt; + + /// \brief The base node of the iterator. + /// + /// Gives back the base node of the iterator. + /// It is always the target of the pointed edge. + Node baseNode(const InEdgeIt&) const { return INVALID; } + + /// \brief The running node of the iterator. + /// + /// Gives back the running node of the iterator. + /// It is always the source of the pointed edge. + Node runningNode(const InEdgeIt&) const { return INVALID; } + + /// \brief The base node of the iterator. + /// + /// Gives back the base node of the iterator. + /// It is always the source of the pointed edge. + Node baseNode(const OutEdgeIt&) const { return INVALID; } + + /// \brief The running node of the iterator. + /// + /// Gives back the running node of the iterator. + /// It is always the target of the pointed edge. + Node runningNode(const OutEdgeIt&) const { return INVALID; } + + /// @} + + template + struct Constraints { + void constraints() { + checkConcept(); + + { + typename _Graph::Node node(INVALID); + typename _Graph::Edge edge(INVALID); + { + graph.first(node); + graph.next(node); + } + { + graph.first(edge); + graph.next(edge); + } + { + graph.firstIn(edge, node); + graph.nextIn(edge); + } + { + graph.firstOut(edge, node); + graph.nextOut(edge); + } + } + + { + checkConcept, + typename _Graph::EdgeIt >(); + checkConcept, + typename _Graph::NodeIt >(); + checkConcept, typename _Graph::InEdgeIt>(); + checkConcept, typename _Graph::OutEdgeIt>(); + + typename _Graph::Node n; + typename _Graph::InEdgeIt ieit(INVALID); + typename _Graph::OutEdgeIt oeit(INVALID); + n = graph.baseNode(ieit); + n = graph.runningNode(ieit); + n = graph.baseNode(oeit); + n = graph.runningNode(oeit); + ignore_unused_variable_warning(n); + } + } + + const _Graph& graph; + + }; + }; + + /// \brief An empty iterable undirected graph class. + /// + /// This class provides beside the core graph features iterator + /// based iterable interface for the undirected graph structure. + /// This concept is part of the UGraph concept. + template + class IterableUGraphComponent : public IterableGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + typedef typename Base::UEdge UEdge; + + + typedef IterableUGraphComponent Graph; + + /// \name Base iteration + /// + /// This interface provides functions for iteration on graph items + /// @{ + + using IterableGraphComponent<_Base>::first; + using IterableGraphComponent<_Base>::next; + + /// \brief Gives back the first undirected edge in the iterating + /// order. + /// + /// Gives back the first undirected edge in the iterating order. + /// + void first(UEdge&) const {} + + /// \brief Gives back the next undirected edge in the iterating + /// order. + /// + /// Gives back the next undirected edge in the iterating order. + /// + void next(UEdge&) const {} + + + /// \brief Gives back the first of the undirected edges from the + /// given node. + /// + /// Gives back the first of the undirected edges from the given + /// node. The bool parameter gives back that direction which + /// gives a good direction of the uedge so the source of the + /// directed edge is the given node. + void firstInc(UEdge&, bool&, const Node&) const {} + + /// \brief Gives back the next of the undirected edges from the + /// given node. + /// + /// Gives back the next of the undirected edges from the given + /// node. The bool parameter should be used as the \c firstInc() + /// use it. + void nextInc(UEdge&, bool&) const {} + + using IterableGraphComponent<_Base>::baseNode; + using IterableGraphComponent<_Base>::runningNode; + + /// @} + + /// \name Class based iteration + /// + /// This interface provides functions for iteration on graph items + /// + /// @{ + + /// \brief This iterator goes through each node. + /// + /// This iterator goes through each node. + typedef GraphItemIt UEdgeIt; + /// \brief This iterator goes trough the incident edges of a + /// node. + /// + /// This iterator goes trough the incident edges of a certain + /// node of a graph. + typedef GraphIncIt IncEdgeIt; + /// \brief The base node of the iterator. + /// + /// Gives back the base node of the iterator. + Node baseNode(const IncEdgeIt&) const { return INVALID; } + + /// \brief The running node of the iterator. + /// + /// Gives back the running node of the iterator. + Node runningNode(const IncEdgeIt&) const { return INVALID; } + + /// @} + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + + { + typename _Graph::Node node(INVALID); + typename _Graph::UEdge uedge(INVALID); + bool dir; + { + graph.first(uedge); + graph.next(uedge); + } + { + graph.firstInc(uedge, dir, node); + graph.nextInc(uedge, dir); + } + + } + + { + checkConcept, + typename _Graph::UEdgeIt >(); + checkConcept, typename _Graph::IncEdgeIt>(); + + typename _Graph::Node n; + typename _Graph::IncEdgeIt ueit(INVALID); + n = graph.baseNode(ueit); + n = graph.runningNode(ueit); + } + } + + const _Graph& graph; + + }; + }; + + /// \brief An empty iterable bipartite undirected graph class. + /// + /// This class provides beside the core graph features iterator + /// based iterable interface for the bipartite undirected graph + /// structure. This concept is part of the BpUGraph concept. + template + class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::UEdge UEdge; + + typedef IterableBpUGraphComponent Graph; + + /// \name Base iteration + /// + /// This interface provides functions for iteration on graph items + /// @{ + + using IterableUGraphComponent<_Base>::first; + using IterableUGraphComponent<_Base>::next; + + /// \brief Gives back the first A-node in the iterating order. + /// + /// Gives back the first undirected A-node in the iterating + /// order. + /// + void firstANode(Node&) const {} + + /// \brief Gives back the next A-node in the iterating order. + /// + /// Gives back the next A-node in the iterating order. + /// + void nextANode(Node&) const {} + + /// \brief Gives back the first B-node in the iterating order. + /// + /// Gives back the first undirected B-node in the iterating + /// order. + /// + void firstBNode(Node&) const {} + + /// \brief Gives back the next B-node in the iterating order. + /// + /// Gives back the next B-node in the iterating order. + /// + void nextBNode(Node&) const {} + + + /// \brief Gives back the first of the undirected edges start + /// from the given A-node. + /// + /// Gives back the first of the undirected edges start from the + /// given A-node. + void firstFromANode(UEdge&, const Node&) const {} + + /// \brief Gives back the next of the undirected edges start + /// from the given A-node. + /// + /// Gives back the next of the undirected edges start from the + /// given A-node. + void nextFromANode(UEdge&) const {} + + /// \brief Gives back the first of the undirected edges start + /// from the given B-node. + /// + /// Gives back the first of the undirected edges start from the + /// given B-node. + void firstFromBNode(UEdge&, const Node&) const {} + + /// \brief Gives back the next of the undirected edges start + /// from the given B-node. + /// + /// Gives back the next of the undirected edges start from the + /// given B-node. + void nextFromBNode(UEdge&) const {} + + + /// @} + + /// \name Class based iteration + /// + /// This interface provides functions for iteration on graph items + /// + /// @{ + + /// \brief This iterator goes through each A-node. + /// + /// This iterator goes through each A-node. + typedef GraphItemIt ANodeIt; + + /// \brief This iterator goes through each B-node. + /// + /// This iterator goes through each B-node. + typedef GraphItemIt BNodeIt; + + /// @} + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + + { + typename _Graph::Node node(INVALID); + typename _Graph::UEdge uedge(INVALID); + graph.firstANode(node); + graph.nextANode(node); + graph.firstBNode(node); + graph.nextBNode(node); + + graph.firstFromANode(uedge, node); + graph.nextFromANode(uedge); + graph.firstFromBNode(uedge, node); + graph.nextFromBNode(uedge); + } + { + checkConcept, + typename _Graph::ANodeIt >(); + checkConcept, + typename _Graph::BNodeIt >(); + } + + } + + const _Graph& graph; + + }; + }; + + /// \brief An empty alteration notifier graph class. + /// + /// This class provides beside the core graph features alteration + /// notifier interface for the graph structure. This implements + /// an observer-notifier pattern for each graph item. More + /// obsevers can be registered into the notifier and whenever an + /// alteration occured in the graph all the observers will + /// notified about it. + template + class AlterableGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + + + /// The node observer registry. + typedef AlterationNotifier + NodeNotifier; + /// The edge observer registry. + typedef AlterationNotifier + EdgeNotifier; + + /// \brief Gives back the node alteration notifier. + /// + /// Gives back the node alteration notifier. + NodeNotifier& getNotifier(Node) const { + return NodeNotifier(); + } + + /// \brief Gives back the edge alteration notifier. + /// + /// Gives back the edge alteration notifier. + EdgeNotifier& getNotifier(Edge) const { + return EdgeNotifier(); + } + + template + struct Constraints { + void constraints() { + checkConcept(); + typename _Graph::NodeNotifier& nn + = graph.getNotifier(typename _Graph::Node()); + + typename _Graph::EdgeNotifier& en + = graph.getNotifier(typename _Graph::Edge()); + + ignore_unused_variable_warning(nn); + ignore_unused_variable_warning(en); + } + + const _Graph& graph; + + }; + + }; + + /// \brief An empty alteration notifier undirected graph class. + /// + /// This class provides beside the core graph features alteration + /// notifier interface for the graph structure. This implements + /// an observer-notifier pattern for each graph item. More + /// obsevers can be registered into the notifier and whenever an + /// alteration occured in the graph all the observers will + /// notified about it. + template + class AlterableUGraphComponent : public AlterableGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::UEdge UEdge; + + + /// The edge observer registry. + typedef AlterationNotifier + UEdgeNotifier; + + /// \brief Gives back the edge alteration notifier. + /// + /// Gives back the edge alteration notifier. + UEdgeNotifier& getNotifier(UEdge) const { + return UEdgeNotifier(); + } + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + typename _Graph::UEdgeNotifier& uen + = graph.getNotifier(typename _Graph::UEdge()); + ignore_unused_variable_warning(uen); + } + + const _Graph& graph; + + }; + + }; + + /// \brief An empty alteration notifier bipartite undirected graph + /// class. + /// + /// This class provides beside the core graph features alteration + /// notifier interface for the graph structure. This implements + /// an observer-notifier pattern for each graph item. More + /// obsevers can be registered into the notifier and whenever an + /// alteration occured in the graph all the observers will + /// notified about it. + template + class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::ANode ANode; + typedef typename Base::BNode BNode; + + + /// The A-node observer registry. + typedef AlterationNotifier + ANodeNotifier; + + /// The B-node observer registry. + typedef AlterationNotifier + BNodeNotifier; + + /// \brief Gives back the A-node alteration notifier. + /// + /// Gives back the A-node alteration notifier. + ANodeNotifier& getNotifier(ANode) const { + return ANodeNotifier(); + } + + /// \brief Gives back the B-node alteration notifier. + /// + /// Gives back the B-node alteration notifier. + BNodeNotifier& getNotifier(BNode) const { + return BNodeNotifier(); + } + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + typename _Graph::ANodeNotifier& ann + = graph.getNotifier(typename _Graph::ANode()); + typename _Graph::BNodeNotifier& bnn + = graph.getNotifier(typename _Graph::BNode()); + ignore_unused_variable_warning(ann); + ignore_unused_variable_warning(bnn); + } + + const _Graph& graph; + + }; + + }; + + + /// \brief Class describing the concept of graph maps + /// + /// This class describes the common interface of the graph maps + /// (NodeMap, EdgeMap), that is \ref maps-page "maps" which can be used to + /// associate data to graph descriptors (nodes or edges). + template + class GraphMap : public ReadWriteMap<_Item, _Value> { + public: + + typedef ReadWriteMap<_Item, _Value> Parent; + + /// The graph type of the map. + typedef _Graph Graph; + /// The key type of the map. + typedef _Item Key; + /// The value type of the map. + typedef _Value Value; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + explicit GraphMap(const Graph&) {} + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + GraphMap(const Graph&, const Value&) {} + /// \brief Copy constructor. + /// + /// Copy Constructor. + GraphMap(const GraphMap&) : Parent() {} + + /// \brief Assign operator. + /// + /// Assign operator. It does not mofify the underlying graph, + /// it just iterates on the current item set and set the map + /// with the value returned by the assigned map. + template + GraphMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + template + struct Constraints { + void constraints() { + checkConcept, _Map >(); + // Construction with a graph parameter + _Map a(g); + // Constructor with a graph and a default value parameter + _Map a2(g,t); + // Copy constructor. + _Map b(c); + + ReadMap cmap; + b = cmap; + + ignore_unused_variable_warning(a2); + ignore_unused_variable_warning(b); + } + + const _Map &c; + const Graph &g; + const typename GraphMap::Value &t; + }; + + }; + + /// \brief An empty mappable graph class. + /// + /// This class provides beside the core graph features + /// map interface for the graph structure. + /// This concept is part of the Graph concept. + template + class MappableGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + + typedef MappableGraphComponent Graph; + + /// \brief ReadWrite map of the nodes. + /// + /// ReadWrite map of the nodes. + /// + template + class NodeMap : public GraphMap { + private: + NodeMap(); + public: + typedef GraphMap Parent; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor + explicit NodeMap(const MappableGraphComponent& graph) + : Parent(graph) {} + + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + NodeMap(const MappableGraphComponent& graph, const _Value& value) + : Parent(graph, value) {} + + /// \brief Copy constructor. + /// + /// Copy Constructor. + NodeMap(const NodeMap& nm) : Parent(nm) {} + + /// \brief Assign operator. + /// + /// Assign operator. + template + NodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + }; + + /// \brief ReadWrite map of the edges. + /// + /// ReadWrite map of the edges. + /// + template + class EdgeMap : public GraphMap { + private: + EdgeMap(); + public: + typedef GraphMap Parent; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor + explicit EdgeMap(const MappableGraphComponent& graph) + : Parent(graph) {} + + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + EdgeMap(const MappableGraphComponent& graph, const _Value& value) + : Parent(graph, value) {} + + /// \brief Copy constructor. + /// + /// Copy Constructor. + EdgeMap(const EdgeMap& nm) : Parent(nm) {} + + /// \brief Assign operator. + /// + /// Assign operator. + template + EdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + }; + + + template + struct Constraints { + + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; + + void constraints() { + checkConcept(); + { // int map test + typedef typename _Graph::template NodeMap IntNodeMap; + checkConcept, + IntNodeMap >(); + } { // bool map test + typedef typename _Graph::template NodeMap BoolNodeMap; + checkConcept, + BoolNodeMap >(); + } { // Dummy map test + typedef typename _Graph::template NodeMap DummyNodeMap; + checkConcept, + DummyNodeMap >(); + } + + { // int map test + typedef typename _Graph::template EdgeMap IntEdgeMap; + checkConcept, + IntEdgeMap >(); + } { // bool map test + typedef typename _Graph::template EdgeMap BoolEdgeMap; + checkConcept, + BoolEdgeMap >(); + } { // Dummy map test + typedef typename _Graph::template EdgeMap DummyEdgeMap; + checkConcept, + DummyEdgeMap >(); + } + } + + _Graph& graph; + }; + }; + + /// \brief An empty mappable base bipartite undirected graph class. + /// + /// This class provides beside the core graph features + /// map interface for the graph structure. + /// This concept is part of the UGraph concept. + template + class MappableUGraphComponent : public MappableGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::UEdge UEdge; + + typedef MappableUGraphComponent Graph; + + /// \brief ReadWrite map of the uedges. + /// + /// ReadWrite map of the uedges. + /// + template + class UEdgeMap : public GraphMap { + public: + typedef GraphMap Parent; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor + explicit UEdgeMap(const MappableUGraphComponent& graph) + : Parent(graph) {} + + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + UEdgeMap(const MappableUGraphComponent& graph, const _Value& value) + : Parent(graph, value) {} + + /// \brief Copy constructor. + /// + /// Copy Constructor. + UEdgeMap(const UEdgeMap& nm) : Parent(nm) {} + + /// \brief Assign operator. + /// + /// Assign operator. + template + UEdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + }; + + + template + struct Constraints { + + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; + + void constraints() { + checkConcept, _Graph>(); + + { // int map test + typedef typename _Graph::template UEdgeMap IntUEdgeMap; + checkConcept, + IntUEdgeMap >(); + } { // bool map test + typedef typename _Graph::template UEdgeMap BoolUEdgeMap; + checkConcept, + BoolUEdgeMap >(); + } { // Dummy map test + typedef typename _Graph::template UEdgeMap DummyUEdgeMap; + checkConcept, + DummyUEdgeMap >(); + } + } + + _Graph& graph; + }; + }; + + /// \brief An empty mappable base bipartite undirected graph + /// class. + /// + /// This class provides beside the core graph features + /// map interface for the graph structure. + /// This concept is part of the BpUGraph concept. + template + class MappableBpUGraphComponent : public MappableUGraphComponent<_Base> { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + + typedef MappableBpUGraphComponent Graph; + + /// \brief ReadWrite map of the A-nodes. + /// + /// ReadWrite map of the A-nodes. + /// + template + class ANodeMap : public GraphMap { + public: + typedef GraphMap Parent; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor + explicit ANodeMap(const MappableBpUGraphComponent& graph) + : Parent(graph) {} + + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value) + : Parent(graph, value) {} + + /// \brief Copy constructor. + /// + /// Copy Constructor. + ANodeMap(const ANodeMap& nm) : Parent(nm) {} + + /// \brief Assign operator. + /// + /// Assign operator. + template + ANodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + }; + + /// \brief ReadWrite map of the B-nodes. + /// + /// ReadWrite map of the A-nodes. + /// + template + class BNodeMap : public GraphMap { + public: + typedef GraphMap Parent; + + /// \brief Construct a new map. + /// + /// Construct a new map for the graph. + /// \todo call the right parent class constructor + explicit BNodeMap(const MappableBpUGraphComponent& graph) + : Parent(graph) {} + + /// \brief Construct a new map with default value. + /// + /// Construct a new map for the graph and initalise the values. + BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value) + : Parent(graph, value) {} + + /// \brief Copy constructor. + /// + /// Copy Constructor. + BNodeMap(const BNodeMap& nm) : Parent(nm) {} + + /// \brief Assign operator. + /// + /// Assign operator. + template + BNodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + + }; + + + template + struct Constraints { + + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; + + void constraints() { + checkConcept, _Graph>(); + + { // int map test + typedef typename _Graph::template ANodeMap IntANodeMap; + checkConcept, + IntANodeMap >(); + } { // bool map test + typedef typename _Graph::template ANodeMap BoolANodeMap; + checkConcept, + BoolANodeMap >(); + } { // Dummy map test + typedef typename _Graph::template ANodeMap DummyANodeMap; + checkConcept, + DummyANodeMap >(); + } + } + + _Graph& graph; + }; + }; + + + /// \brief An empty extendable graph class. + /// + /// This class provides beside the core graph features graph + /// extendable interface for the graph structure. The main + /// difference between the base and this interface is that the + /// graph alterations should handled already on this level. + template + class ExtendableGraphComponent : public _Base { + public: + typedef _Base Base; + + typedef typename _Base::Node Node; + typedef typename _Base::Edge Edge; + + /// \brief Adds a new node to the graph. + /// + /// Adds a new node to the graph. + /// + Node addNode() { + return INVALID; + } + + /// \brief Adds a new edge connects the given two nodes. + /// + /// Adds a new edge connects the the given two nodes. + Edge addEdge(const Node&, const Node&) { + return INVALID; + } + + template + struct Constraints { + void constraints() { + checkConcept(); + typename _Graph::Node node_a, node_b; + node_a = graph.addNode(); + node_b = graph.addNode(); + typename _Graph::Edge edge; + edge = graph.addEdge(node_a, node_b); + } + + _Graph& graph; + }; + }; + + /// \brief An empty extendable base undirected graph class. + /// + /// This class provides beside the core undirected graph features + /// core undircted graph extend interface for the graph structure. + /// The main difference between the base and this interface is + /// that the graph alterations should handled already on this + /// level. + template + class ExtendableUGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename _Base::Node Node; + typedef typename _Base::UEdge UEdge; + + /// \brief Adds a new node to the graph. + /// + /// Adds a new node to the graph. + /// + Node addNode() { + return INVALID; + } + + /// \brief Adds a new edge connects the given two nodes. + /// + /// Adds a new edge connects the the given two nodes. + UEdge addEdge(const Node&, const Node&) { + return INVALID; + } + + template + struct Constraints { + void constraints() { + checkConcept(); + typename _Graph::Node node_a, node_b; + node_a = graph.addNode(); + node_b = graph.addNode(); + typename _Graph::UEdge uedge; + uedge = graph.addUEdge(node_a, node_b); + } + + _Graph& graph; + }; + }; + + /// \brief An empty extendable base undirected graph class. + /// + /// This class provides beside the core bipartite undirected graph + /// features core undircted graph extend interface for the graph + /// structure. The main difference between the base and this + /// interface is that the graph alterations should handled already + /// on this level. + template + class ExtendableBpUGraphComponent + : public ExtendableUGraphComponent<_Base> { + + typedef _Base Base; + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + } + }; + }; + + /// \brief An empty erasable graph class. + /// + /// This class provides beside the core graph features core erase + /// functions for the graph structure. The main difference between + /// the base and this interface is that the graph alterations + /// should handled already on this level. + template + class ErasableGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::Edge Edge; + + /// \brief Erase a node from the graph. + /// + /// Erase a node from the graph. This function should + /// erase all edges connecting to the node. + void erase(const Node&) {} + + /// \brief Erase an edge from the graph. + /// + /// Erase an edge from the graph. + /// + void erase(const Edge&) {} + + template + struct Constraints { + void constraints() { + checkConcept(); + typename _Graph::Node node; + graph.erase(node); + typename _Graph::Edge edge; + graph.erase(edge); + } + + _Graph& graph; + }; + }; + + /// \brief An empty erasable base undirected graph class. + /// + /// This class provides beside the core undirected graph features + /// core erase functions for the undirceted graph structure. The + /// main difference between the base and this interface is that + /// the graph alterations should handled already on this level. + template + class ErasableUGraphComponent : public _Base { + public: + + typedef _Base Base; + typedef typename Base::Node Node; + typedef typename Base::UEdge UEdge; + + /// \brief Erase a node from the graph. + /// + /// Erase a node from the graph. This function should erase + /// edges connecting to the node. + void erase(const Node&) {} + + /// \brief Erase an edge from the graph. + /// + /// Erase an edge from the graph. + /// + void erase(const UEdge&) {} + + template + struct Constraints { + void constraints() { + checkConcept(); + typename _Graph::Node node; + graph.erase(node); + typename _Graph::Edge edge; + graph.erase(edge); + } + + _Graph& graph; + }; + }; + + /// \brief An empty erasable base bipartite undirected graph class. + /// + /// This class provides beside the core bipartite undirected graph + /// features core erase functions for the undirceted graph + /// structure. The main difference between the base and this + /// interface is that the graph alterations should handled already + /// on this level. + template + class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> { + public: + + typedef _Base Base; + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + } + }; + }; + + /// \brief An empty clearable base graph class. + /// + /// This class provides beside the core graph features core clear + /// functions for the graph structure. The main difference between + /// the base and this interface is that the graph alterations + /// should handled already on this level. + template + class ClearableGraphComponent : public _Base { + public: + + typedef _Base Base; + + /// \brief Erase all nodes and edges from the graph. + /// + /// Erase all nodes and edges from the graph. + /// + void clear() {} + + template + struct Constraints { + void constraints() { + checkConcept(); + graph.clear(); + } + + _Graph graph; + }; + }; + + /// \brief An empty clearable base undirected graph class. + /// + /// This class provides beside the core undirected graph features + /// core clear functions for the undirected graph structure. The + /// main difference between the base and this interface is that + /// the graph alterations should handled already on this level. + template + class ClearableUGraphComponent : public ClearableUGraphComponent<_Base> { + public: + + typedef _Base Base; + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + } + + _Graph graph; + }; + }; + + /// \brief An empty clearable base bipartite undirected graph + /// class. + /// + /// This class provides beside the core bipartite undirected graph + /// features core clear functions for the undirected graph + /// structure. The main difference between the base and this + /// interface is that the graph alterations should handled already + /// on this level. + template + class ClearableBpUGraphComponent + : public ClearableBpUGraphComponent<_Base> { + public: + + typedef _Base Base; + + template + struct Constraints { + void constraints() { + checkConcept, _Graph>(); + } + + }; + + }; + + } + +} + +#endif diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/heap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/heap.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,223 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +///\ingroup concept +///\file +///\brief Classes for representing heaps. +/// + +#ifndef LEMON_CONCEPT_HEAP_H +#define LEMON_CONCEPT_HEAP_H + +#include + +namespace lemon { + namespace concepts { + /// \addtogroup concept + /// @{ + + + /// \brief A concept structure describes the main interface of heaps. + /// + /// A concept structure describes the main interface of heaps. + /// + template + class Heap { + public: + + + /// \brief Type to represent the items states. + /// + /// Each Item element have a state associated to it. It may be "in heap", + /// "pre heap" or "post heap". The later two are indifferent from the + /// heap's point of view, but may be useful to the user. + /// + /// The ItemIntMap _should_ be initialized in such way, that it maps + /// PRE_HEAP (-1) to any element to be put in the heap... + enum state_enum { + IN_HEAP = 0, + PRE_HEAP = -1, + POST_HEAP = -2 + }; + + /// \brief The constructor. + /// + /// The constructor. + /// \param _iim should be given to the constructor, since it is used + /// internally to handle the cross references. The value of the map + /// should be PRE_HEAP (-1) for each element. + explicit Heap(ItemIntMap &_iim) {} + + /// \brief The number of items stored in the heap. + /// + /// Returns the number of items stored in the heap. + int size() const { return 0; } + + /// \brief Checks if the heap stores no items. + /// + /// Returns \c true if and only if the heap stores no items. + bool empty() const { return false; } + + /// \brief Makes empty this heap. + /// + /// Makes this heap empty. + void clear(); + + /// \brief Insert an item into the heap with the given heap. + /// + /// Adds \c i to the heap with priority \c p. + /// \param i The item to insert. + /// \param p The priority of the item. + void push(const Item &i, const Prio &p) {} + + /// \brief Returns the item with minimum priority. + /// + /// This method returns the item with minimum priority. + /// \pre The heap must be nonempty. + Item top() const {} + + /// \brief Returns the minimum priority. + /// + /// It returns the minimum priority. + /// \pre The heap must be nonempty. + Prio prio() const {} + + /// \brief Deletes the item with minimum priority. + /// + /// This method deletes the item with minimum priority. + /// \pre The heap must be non-empty. + void pop() {} + + /// \brief Deletes \c i from the heap. + /// + /// This method deletes item \c i from the heap, if \c i was + /// already stored in the heap. + /// \param i The item to erase. + void erase(const Item &i) {} + + /// \brief Returns the priority of \c i. + /// + /// This function returns the priority of item \c i. + /// \pre \c i must be in the heap. + /// \param i The item. + Prio operator[](const Item &i) const {} + + /// \brief \c i gets to the heap with priority \c p independently + /// if \c i was already there. + /// + /// This method calls \ref push(\c i, \c p) if \c i is not stored + /// in the heap and sets the priority of \c i to \c p otherwise. + /// It may throw an \e UnderFlowPriorityException. + /// \param i The item. + /// \param p The priority. + void set(const Item &i, const Prio &p) {} + + /// \brief Decreases the priority of \c i to \c p. + /// + /// This method decreases the priority of item \c i to \c p. + /// \pre \c i must be stored in the heap with priority at least \c p. + /// \param i The item. + /// \param p The priority. + void decrease(const Item &i, const Prio &p) {} + + /// \brief Increases the priority of \c i to \c p. + /// + /// This method sets the priority of item \c i to \c p. + /// \pre \c i must be stored in the heap with priority at most \c + /// p relative to \c Compare. + /// \param i The item. + /// \param p The priority. + void increase(const Item &i, const Prio &p) {} + + /// \brief Returns if \c item is in, has already been in, or has + /// never been in the heap. + /// + /// This method returns PRE_HEAP if \c item has never been in the + /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP + /// otherwise. In the latter case it is possible that \c item will + /// get back to the heap again. + /// \param i The item. + state_enum state(const Item &i) const {} + + /// \brief Sets the state of the \c item in the heap. + /// + /// Sets the state of the \c item in the heap. It can be used to + /// manually clear the heap when it is important to achive the + /// better time complexity. + /// \param i The item. + /// \param st The state. It should not be \c IN_HEAP. + void state(const Item& i, state_enum st) {} + + + template + struct Constraints { + public: + + void constraints() { + Item item; + Prio prio; + + item=Item(); + prio=Prio(); + + ignore_unused_variable_warning(item); + ignore_unused_variable_warning(prio); + + typedef typename _Heap::state_enum state_enum; + state_enum state; + + ignore_unused_variable_warning(state); + + _Heap heap1 = _Heap(map); + + ignore_unused_variable_warning(heap1); + + heap.push(item, prio); + + prio = heap.prio(); + item = heap.top(); + + heap.pop(); + + heap.set(item, prio); + heap.decrease(item, prio); + heap.increase(item, prio); + prio = heap[item]; + + heap.erase(item); + + state = heap.state(item); + + state = _Heap::PRE_HEAP; + state = _Heap::IN_HEAP; + state = _Heap::POST_HEAP; + + heap.clear(); + } + + _Heap& heap; + ItemIntMap& map; + + Constraints() : heap(0), map(0) {} + }; + }; + + /// @} + } // namespace lemon +} +#endif // LEMON_CONCEPT_PATH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/maps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/maps.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,192 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_CONCEPT_MAPS_H +#define LEMON_CONCEPT_MAPS_H + +#include +#include + +///\ingroup concept +///\file +///\brief Map concepts checking classes for testing and documenting. + +namespace lemon { + + namespace concepts { + + /// \addtogroup concept + /// @{ + + /// Readable map concept + template + class ReadMap + { + public: + /// Map's key type. + typedef K Key; + /// Map's value type. (The type of objects associated with the keys). + typedef T Value; + + // \bug Value don't need to be default constructible. + /// Returns the value associated with a key. + Value operator[](const Key &) const {return Value();} + + template + struct Constraints { + + void constraints() { + Value val = m[key]; + val = m[key]; + typename _ReadMap::Value own_val = m[own_key]; + own_val = m[own_key]; + + ignore_unused_variable_warning(val); + ignore_unused_variable_warning(own_val); + ignore_unused_variable_warning(key); + } + Key& key; + typename _ReadMap::Key& own_key; + _ReadMap& m; + }; + + }; + + + /// Writable map concept + template + class WriteMap + { + public: + /// Map's key type. + typedef K Key; + /// Map's value type. (The type of objects associated with the keys). + typedef T Value; + + /// Sets the value associated with a key. + void set(const Key &,const Value &) {} + + ///Default constructor + WriteMap() {} + + template + struct Constraints { + void constraints() { + // No constraints for constructor. + m.set(key, val); + m.set(own_key, own_val); + ignore_unused_variable_warning(key); + ignore_unused_variable_warning(val); + ignore_unused_variable_warning(own_key); + ignore_unused_variable_warning(own_val); + } + + Value& val; + typename _WriteMap::Value own_val; + Key& key; + typename _WriteMap::Key& own_key; + _WriteMap& m; + + }; + }; + + ///Read/Writable map concept + template + class ReadWriteMap : public ReadMap, + public WriteMap + { + public: + /// Map's key type. + typedef K Key; + /// Map's value type. (The type of objects associated with the keys). + typedef T Value; + + /// Returns the value associated with a key. + Value operator[](const Key &) const {return Value();} + /// Sets the value associated with a key. + void set(const Key & ,const Value &) {} + + template + struct Constraints { + void constraints() { + checkConcept, _ReadWriteMap >(); + checkConcept, _ReadWriteMap >(); + } + }; + }; + + + ///Dereferable map concept + template + class ReferenceMap : public ReadWriteMap + { + public: + /// Tag for reference maps. + typedef True ReferenceMapTag; + /// Map's key type. + typedef K Key; + /// Map's value type. (The type of objects associated with the keys). + typedef T Value; + /// Map's reference type. + typedef R Reference; + /// Map's const reference type. + typedef CR ConstReference; + + protected: + Value tmp; + public: + + ///Returns a reference to the value associated to a key. + Reference operator[](const Key &) { return tmp; } + ///Returns a const reference to the value associated to a key. + ConstReference operator[](const Key &) const + { return tmp; } + /// Sets the value associated with a key. + void set(const Key &k,const Value &t) { operator[](k)=t; } + + // \todo rethink this concept + template + struct ReferenceMapConcept { + + void constraints() { + checkConcept(); + m[key] = val; + val = m[key]; + m[key] = ref; + ref = m[key]; + m[own_key] = own_val; + own_val = m[own_key]; + m[own_key] = own_ref; + own_ref = m[own_key]; + } + + typename _ReferenceMap::Key& own_key; + typename _ReferenceMap::Value& own_val; + typename _ReferenceMap::Reference& own_ref; + Key& key; + Value& val; + Reference& ref; + _ReferenceMap& m; + }; + }; + + // @} + + } //namespace concepts +} //namespace lemon +#endif // LEMON_CONCEPT_MAPS_H diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/matrix_maps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/matrix_maps.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,207 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_CONCEPT_MATRIX_MAPS_H +#define LEMON_CONCEPT_MATRIX_MAPS_H + +#include +#include + +///\ingroup concept +///\file +///\brief MatrixMap concepts checking classes for testing and documenting. + +namespace lemon { + + namespace concepts { + + /// \addtogroup concept + /// @{ + + /// Readable matrix map concept + template + class ReadMatrixMap + { + public: + /// Map's first key type. + typedef K1 FirstKey; + /// Map's second key type. + typedef K2 SecondKey; + /// \brief Map's value type. + /// (The type of objects associated with the pairs of keys). + typedef V Value; + + // \bug Value don't need to be default constructible. + /// Returns the value associated with a key. + Value operator()(const FirstKey&, const SecondKey&) const { + return Value(); + } + + template + struct Constraints { + + void constraints() { + Value val = m(first_key, second_key); + val = m(first_key, second_key); + typename _ReadMatrixMap::Value own_val = + m(own_first_key, own_second_key); + own_val = m(own_first_key, own_second_key); + ignore_unused_variable_warning(val); + ignore_unused_variable_warning(own_val); + } + + FirstKey& first_key; + SecondKey& second_key; + typename _ReadMatrixMap::FirstKey& own_first_key; + typename _ReadMatrixMap::SecondKey& own_second_key; + _ReadMatrixMap& m; + }; + + }; + + + /// Writable map concept + template + class WriteMatrixMap { + public: + /// Map's first key type. + typedef K1 FirstKey; + /// Map's second key type. + typedef K2 SecondKey; + /// \brief Map's value type. + /// (The type of objects associated with the pairs of keys). + typedef V Value; + + /// Sets the value associated with the pair of keys. + void set(const FirstKey&, const SecondKey& ,const Value&) {} + + template + struct Constraints { + void constraints() { + // No constraints for constructor. + m.set(first_key, second_key, val); + m.set(own_first_key, own_second_key, own_val); + } + + Value& val; + typename _WriteMatrixMap::Value own_val; + FirstKey& first_key; + SecondKey& second_key; + typename _WriteMatrixMap::FirstKey& own_first_key; + typename _WriteMatrixMap::SecondKey& own_second_key; + _WriteMatrixMap& m; + + }; + }; + + ///Read/Writable map concept + template + class ReadWriteMatrixMap + : public ReadMatrixMap, public WriteMatrixMap { + public: + /// Map's first key type. + typedef K1 FirstKey; + /// Map's second key type. + typedef K2 SecondKey; + /// \brief Map's value type. + /// (The type of objects associated with the pairs of keys). + typedef V Value; + + /// Returns the value associated with a pair of keys. + Value operator()(const FirstKey&, const SecondKey&) const { + return Value(); + } + /// Sets the value associated with the pair of keys. + void set(const FirstKey&, const SecondKey& ,const Value&) {} + + template + struct Constraints { + void constraints() { + checkConcept, _ReadWriteMatrixMap >(); + checkConcept, _ReadWriteMatrixMap >(); + } + }; + }; + + + ///Dereferable matrix map concept + template + class ReferenceMatrixMap : public ReadWriteMatrixMap + { + public: + /// Tag for reference maps. + typedef True ReferenceMapTag; + /// Map's first key type. + typedef K1 FirstKey; + /// Map's second key type. + typedef K1 SecondKey; + /// Map's value type. (The type of objects associated with the keys). + typedef V Value; + /// Map's reference type. + typedef R Reference; + /// Map's const reference type. + typedef CR ConstReference; + + protected: + Value tmp; + public: + + ///Returns a reference to the value associated to a pair of keys. + Reference operator()(const FirstKey&, const SecondKey&) { + return tmp; + } + ///Returns a const reference to the value associated to a pair of keys. + ConstReference operator()(const FirstKey&, const SecondKey&) const { + return tmp; + } + /// Sets the value associated with the pair of keys. + void set(const FirstKey&, const SecondKey& ,const Value&) {} + + // \todo rethink this concept + template + struct ReferenceMapConcept { + + void constraints() { + checkConcept(); + m(first_key, second_key) = val; + val = m(first_key, second_key); + m(first_key, second_key) = ref; + ref = m(first_key, second_key); + m(own_first_key, own_second_key) = own_val; + own_val = m(own_first_key, own_second_key); + m(own_first_key, own_second_key) = own_ref; + own_ref = m(own_first_key, own_second_key); + } + + typename _ReferenceMatrixMap::Key& own_first_key; + typename _ReferenceMatrixMap::Key& own_second_key; + typename _ReferenceMatrixMap::Value& own_val; + typename _ReferenceMatrixMap::Reference& own_ref; + FirstKey& first_key; + SecondKey& second_key; + Value& val; + Reference& ref; + _ReferenceMatrixMap& m; + }; + }; + + // @} + + } //namespace concepts +} //namespace lemon +#endif // LEMON_CONCEPT_MATRIX_MAPS_H diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/path.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/path.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,294 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +///\ingroup concept +///\file +///\brief Classes for representing paths in graphs. +/// +///\todo Iterators have obsolete style + +#ifndef LEMON_CONCEPT_PATH_H +#define LEMON_CONCEPT_PATH_H + +#include +#include + +namespace lemon { + namespace concepts { + /// \addtogroup concept + /// @{ + + + //! \brief A skeleton structure for representing directed paths in a graph. + //! + //! A skeleton structure for representing directed paths in a graph. + //! \param _Graph The graph type in which the path is. + //! + //! In a sense, the path can be treated as a graph, for it has \c NodeIt + //! and \c EdgeIt with the same usage. These types converts to the \c Node + //! and \c Edge of the original graph. + template + class Path { + public: + + /// Type of the underlying graph. + typedef _Graph Graph; + /// Edge type of the underlying graph. + typedef typename Graph::Edge Edge; + /// Node type of the underlying graph. + typedef typename Graph::Node Node; + + class NodeIt; + class EdgeIt; + + /// \param _g The graph in which the path is. + /// + Path(const Graph &_g) { + ignore_unused_variable_warning(_g); + } + + /// Length of the path ie. the number of edges in the path. + int length() const {return 0;} + + /// Returns whether the path is empty. + bool empty() const { return true;} + + /// Resets the path to an empty path. + void clear() {} + + /// \brief Starting point of the path. + /// + /// Starting point of the path. + /// Returns INVALID if the path is empty. + Node target() const {return INVALID;} + /// \brief End point of the path. + /// + /// End point of the path. + /// Returns INVALID if the path is empty. + Node source() const {return INVALID;} + + /// \brief The target of an edge. + /// + /// Returns node iterator pointing to the target node of the + /// given edge iterator. + NodeIt target(const EdgeIt&) const {return INVALID;} + + /// \brief The source of an edge. + /// + /// Returns node iterator pointing to the source node of the + /// given edge iterator. + NodeIt source(const EdgeIt&) const {return INVALID;} + + /// \brief Iterator class to iterate on the nodes of the paths + /// + /// This class is used to iterate on the nodes of the paths + /// + /// Of course it converts to Graph::Node. + class NodeIt { + public: + /// Default constructor + NodeIt() {} + /// Invalid constructor + NodeIt(Invalid) {} + /// Constructor with starting point + NodeIt(const Path &) {} + + ///Conversion to Graph::Node + operator Node() const { return INVALID; } + /// Next node + NodeIt& operator++() {return *this;} + + /// Comparison operator + bool operator==(const NodeIt&) const {return true;} + /// Comparison operator + bool operator!=(const NodeIt&) const {return true;} + /// Comparison operator + bool operator<(const NodeIt&) const {return false;} + + }; + + /// \brief Iterator class to iterate on the edges of the paths + /// + /// This class is used to iterate on the edges of the paths + /// + /// Of course it converts to Graph::Edge + class EdgeIt { + public: + /// Default constructor + EdgeIt() {} + /// Invalid constructor + EdgeIt(Invalid) {} + /// Constructor with starting point + EdgeIt(const Path &) {} + + operator Edge() const { return INVALID; } + + /// Next edge + EdgeIt& operator++() {return *this;} + + /// Comparison operator + bool operator==(const EdgeIt&) const {return true;} + /// Comparison operator + bool operator!=(const EdgeIt&) const {return true;} + /// Comparison operator + bool operator<(const EdgeIt&) const {return false;} + + }; + + + friend class Builder; + + /// \brief Class to build paths + /// + /// This class is used to fill a path with edges. + /// + /// You can push new edges to the front and to the back of the path in + /// arbitrary order then you should commit these changes to the graph. + /// + /// While the builder is active (after the first modifying + /// operation and until the call of \ref commit()) the + /// underlining Path is in a "transitional" state (operations on + /// it have undefined result). + class Builder { + public: + + /// Constructor + + /// Constructor + /// \param _path the path you want to fill in. + /// + + Builder(Path &_path) { ignore_unused_variable_warning(_path); } + + /// Sets the starting node of the path. + + /// Sets the starting node of the path. Edge added to the path + /// afterwards have to be incident to this node. + /// You \em must start building an empty path with these functions. + /// (And you \em must \em not use it later). + /// \sa pushFront() + /// \sa pushBack() + void setStartNode(const Node &) {} + + ///Push a new edge to the front of the path + + ///Push a new edge to the front of the path. + ///If the path is empty, you \em must call \ref setStartNode() before + ///the first use of \ref pushFront(). + void pushFront(const Edge&) {} + + ///Push a new edge to the back of the path + + ///Push a new edge to the back of the path. + ///If the path is empty, you \em must call \ref setStartNode() before + ///the first use of \ref pushBack(). + void pushBack(const Edge&) {} + + ///Commit the changes to the path. + + ///Commit the changes to the path. + /// + void commit() {} + + ///Reserve (front) storage for the builder in advance. + + ///If you know a reasonable upper bound on the number of the edges + ///to add to the front of the path, + ///using this function you may speed up the building. + void reserveFront(size_t) {} + ///Reserve (back) storage for the builder in advance. + + ///If you know a reasonable upper bound on the number of the edges + ///to add to the back of the path, + ///using this function you may speed up the building. + void reserveBack(size_t) {} + }; + + template + struct Constraints { + void constraints() { + typedef typename _Path::Node Node; + typedef typename _Path::NodeIt NodeIt; + typedef typename Graph::Node GraphNode; + + typedef typename _Path::Edge Edge; + typedef typename _Path::EdgeIt EdgeIt; + typedef typename Graph::Edge GraphEdge; + + typedef typename _Path::Builder Builder; + + path = _Path(graph); + + bool b = cpath.empty(); + int l = cpath.length(); + + Node gn; + Edge ge; + gn = cpath.source(); + gn = cpath.target(); + + NodeIt nit; + EdgeIt eit(INVALID); + nit = path.source(eit); + nit = path.target(eit); + + nit = NodeIt(); + nit = NodeIt(cpath); + nit = INVALID; + gn = nit; + ++nit; + b = nit == nit; + b = nit != nit; + b = nit < nit; + + eit = EdgeIt(); + eit = EdgeIt(cpath); + eit = INVALID; + ge = eit; + ++eit; + b = eit == eit; + b = eit != eit; + b = eit < eit; + + size_t st = 0; + + Builder builder(path); + builder.setStartNode(gn); + builder.pushFront(ge); + builder.pushBack(ge); + builder.commit(); + builder.reserveFront(st); + builder.reserveBack(st); + + ignore_unused_variable_warning(l); + ignore_unused_variable_warning(b); + } + + const Graph& graph; + const _Path& cpath; + _Path& path; + }; + + }; + + ///@} + } + +} // namespace lemon + +#endif // LEMON_CONCEPT_PATH_H diff -r da142c310d02 -r 4274224f8a7d lemon/concepts/ugraph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concepts/ugraph.h Tue Oct 24 17:19:16 2006 +0000 @@ -0,0 +1,713 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +///\ingroup graph_concepts +///\file +///\brief The concept of the undirected graphs. + + +#ifndef LEMON_CONCEPT_UGRAPH_H +#define LEMON_CONCEPT_UGRAPH_H + +#include +#include +#include + +namespace lemon { + namespace concepts { + + /// \addtogroup graph_concepts + /// @{ + + + /// \brief Class describing the concept of Undirected Graphs. + /// + /// This class describes the common interface of all Undirected + /// Graphs. + /// + /// As all concept describing classes it provides only interface + /// without any sensible implementation. So any algorithm for + /// undirected graph should compile with this class, but it will not + /// run properly, of course. + /// + /// The LEMON undirected graphs also fulfill the concept of + /// directed graphs (\ref lemon::concepts::Graph "Graph + /// Concept"). Each undirected edges can be seen as two opposite + /// directed edge and consequently the undirected graph can be + /// seen as the direceted graph of these directed edges. The + /// UGraph has the UEdge inner class for the undirected edges and + /// the Edge type for the directed edges. The Edge type is + /// convertible to UEdge or inherited from it so from a directed + /// edge we can get the represented undirected edge. + /// + /// In the sense of the LEMON each undirected edge has a default + /// direction (it should be in every computer implementation, + /// because the order of undirected edge's nodes defines an + /// orientation). With the default orientation we can define that + /// the directed edge is forward or backward directed. With the \c + /// direction() and \c direct() function we can get the direction + /// of the directed edge and we can direct an undirected edge. + /// + /// The UEdgeIt is an iterator for the undirected edges. We can use + /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and + /// OutEdgeIt iterates on the same undirected edges but with opposite + /// direction. The IncEdgeIt iterates also on the same undirected edges + /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just + /// to UEdge. + class UGraph { + public: + /// \brief The undirected graph should be tagged by the + /// UndirectedTag. + /// + /// The undirected graph should be tagged by the UndirectedTag. This + /// tag helps the enable_if technics to make compile time + /// specializations for undirected graphs. + typedef True UndirectedTag; + + /// \brief The base type of node iterators, + /// or in other words, the trivial node iterator. + /// + /// This is the base type of each node iterator, + /// thus each kind of node iterator converts to this. + /// More precisely each kind of node iterator should be inherited + /// from the trivial node iterator. + class Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + Node(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + Node(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Node) const { return true; } + + /// Inequality operator + + /// \sa operator==(Node n) + /// + bool operator!=(Node) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Node) const { return false; } + + }; + + /// This iterator goes through each node. + + /// This iterator goes through each node. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + ///\code + /// int count=0; + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; + ///\endcode + class NodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + NodeIt(const NodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + NodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + NodeIt(const UGraph&) { } + /// Node -> NodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + NodeIt(const UGraph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + NodeIt& operator++() { return *this; } + }; + + + /// The base type of the undirected edge iterators. + + /// The base type of the undirected edge iterators. + /// + class UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdge() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdge(const UEdge&) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(UEdge) const { return true; } + /// Inequality operator + + /// \sa operator==(UEdge n) + /// + bool operator!=(UEdge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(UEdge) const { return false; } + }; + + /// This iterator goes through each undirected edge. + + /// This iterator goes through each undirected edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of undirected edges in a graph \c g of type \c Graph as follows: + ///\code + /// int count=0; + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; + ///\endcode + class UEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdgeIt(const UEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first undirected edge. + + /// This constructor sets the iterator to the first undirected edge. + UEdgeIt(const UGraph&) { } + /// UEdge -> UEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the undirected edge-set, the iteration order is the + /// same. + UEdgeIt(const UGraph&, const UEdge&) { } + /// Next undirected edge + + /// Assign the iterator to the next undirected edge. + UEdgeIt& operator++() { return *this; } + }; + + /// \brief This iterator goes trough the incident undirected + /// edges of a node. + /// + /// This iterator goes trough the incident undirected edges + /// of a certain node of a graph. You should assume that the + /// loop edges will be iterated twice. + /// + /// Its usage is quite simple, for example you can compute the + /// degree (i.e. count the number of incident edges of a node \c n + /// in graph \c g of type \c Graph as follows. + /// + ///\code + /// int count=0; + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + class IncEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + IncEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + IncEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incident edge. + + /// This constructor set the iterator to the first incident edge of + /// the node. + IncEdgeIt(const UGraph&, const Node&) { } + /// UEdge -> IncEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + IncEdgeIt(const UGraph&, const UEdge&) { } + /// Next incident edge + + /// Assign the iterator to the next incident edge + /// of the corresponding node. + IncEdgeIt& operator++() { return *this; } + }; + + /// The directed edge type. + + /// The directed edge type. It can be converted to the + /// undirected edge or it should be inherited from the undirected + /// edge. + class Edge : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() { } + /// Copy constructor. + + /// Copy constructor. + /// + Edge(const Edge& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + Edge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Edge) const { return true; } + /// Inequality operator + + /// \sa operator==(Edge n) + /// + bool operator!=(Edge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + bool operator<(Edge) const { return false; } + + }; + /// This iterator goes through each directed edge. + + /// This iterator goes through each edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of edges in a graph \c g of type \c Graph as follows: + ///\code + /// int count=0; + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; + ///\endcode + class EdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + EdgeIt(const EdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + EdgeIt(Invalid) { } + /// This constructor sets the iterator to the first edge. + + /// This constructor sets the iterator to the first edge of \c g. + ///@param g the graph + EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); } + /// Edge -> EdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + EdgeIt(const UGraph&, const Edge&) { } + ///Next edge + + /// Assign the iterator to the next edge. + EdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the outgoing directed edges of a node. + + /// This iterator goes trough the \e outgoing edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class OutEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + OutEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first outgoing edge. + + /// This constructor sets the iterator to the first outgoing edge of + /// the node. + ///@param n the node + ///@param g the graph + OutEdgeIt(const UGraph& n, const Node& g) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> OutEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + OutEdgeIt(const UGraph&, const Edge&) { } + ///Next outgoing edge + + /// Assign the iterator to the next + /// outgoing edge of the corresponding node. + OutEdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the incoming directed edges of a node. + + /// This iterator goes trough the \e incoming edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + ///\code + /// int count=0; + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; + ///\endcode + + class InEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + InEdgeIt(const InEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + InEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incoming edge. + + /// This constructor set the iterator to the first incoming edge of + /// the node. + ///@param n the node + ///@param g the graph + InEdgeIt(const UGraph& g, const Node& n) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> InEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + InEdgeIt(const UGraph&, const Edge&) { } + /// Next incoming edge + + /// Assign the iterator to the next inedge of the corresponding node. + /// + InEdgeIt& operator++() { return *this; } + }; + + /// \brief Read write map of the nodes to type \c T. + /// + /// ReadWrite map of the nodes to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (NodeMap) + /// needs some extra attention! + template + class NodeMap : public ReadWriteMap< Node, T > + { + public: + + ///\e + NodeMap(const UGraph&) { } + ///\e + NodeMap(const UGraph&, T) { } + + ///Copy constructor + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + template + NodeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Read write map of the directed edges to type \c T. + /// + /// Reference map of the directed edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (EdgeMap) + /// needs some extra attention! + template + class EdgeMap : public ReadWriteMap + { + public: + + ///\e + EdgeMap(const UGraph&) { } + ///\e + EdgeMap(const UGraph&, T) { } + ///Copy constructor + EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } + ///Assignment operator + template + EdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// Read write map of the undirected edges to type \c T. + + /// Reference map of the edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (UEdgeMap) + /// needs some extra attention! + template + class UEdgeMap : public ReadWriteMap + { + public: + + ///\e + UEdgeMap(const UGraph&) { } + ///\e + UEdgeMap(const UGraph&, T) { } + ///Copy constructor + UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} + ///Assignment operator + template + UEdgeMap& operator=(const CMap&) { + checkConcept, CMap>(); + return *this; + } + }; + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge source + /// will be the given node. + Edge direct(const UEdge&, const Node&) const { + return INVALID; + } + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge + /// represents the given undireted edge and the direction comes + /// from the given bool. The source of the undirected edge and + /// the directed edge is the same when the given bool is true. + Edge direct(const UEdge&, bool) const { + return INVALID; + } + + /// \brief Returns true if the edge has default orientation. + /// + /// Returns whether the given directed edge is same orientation as + /// the corresponding undirected edge's default orientation. + bool direction(Edge) const { return true; } + + /// \brief Returns the opposite directed edge. + /// + /// Returns the opposite directed edge. + Edge oppositeEdge(Edge) const { return INVALID; } + + /// \brief Opposite node on an edge + /// + /// \return the opposite of the given Node on the given UEdge + Node oppositeNode(Node, UEdge) const { return INVALID; } + + /// \brief First node of the undirected edge. + /// + /// \return the first node of the given UEdge. + /// + /// Naturally undirected edges don't have direction and thus + /// don't have source and target node. But we use these two methods + /// to query the two nodes of the edge. The direction of the edge + /// which arises this way is called the inherent direction of the + /// undirected edge, and is used to define the "default" direction + /// of the directed versions of the edges. + /// \sa direction + Node source(UEdge) const { return INVALID; } + + /// \brief Second node of the undirected edge. + Node target(UEdge) const { return INVALID; } + + /// \brief Source node of the directed edge. + Node source(Edge) const { return INVALID; } + + /// \brief Target node of the directed edge. + Node target(Edge) const { return INVALID; } + + void first(Node&) const {} + void next(Node&) const {} + + void first(UEdge&) const {} + void next(UEdge&) const {} + + void first(Edge&) const {} + void next(Edge&) const {} + + void firstOut(Edge&, Node) const {} + void nextOut(Edge&) const {} + + void firstIn(Edge&, Node) const {} + void nextIn(Edge&) const {} + + + void firstInc(UEdge &, bool &, const Node &) const {} + void nextInc(UEdge &, bool &) const {} + + /// \brief Base node of the iterator + /// + /// Returns the base node (the source in this case) of the iterator + Node baseNode(OutEdgeIt e) const { + return source(e); + } + /// \brief Running node of the iterator + /// + /// Returns the running node (the target in this case) of the + /// iterator + Node runningNode(OutEdgeIt e) const { + return target(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node (the target in this case) of the iterator + Node baseNode(InEdgeIt e) const { + return target(e); + } + /// \brief Running node of the iterator + /// + /// Returns the running node (the source in this case) of the + /// iterator + Node runningNode(InEdgeIt e) const { + return source(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node of the iterator + Node baseNode(IncEdgeIt) const { + return INVALID; + } + + /// \brief Running node of the iterator + /// + /// Returns the running node of the iterator + Node runningNode(IncEdgeIt) const { + return INVALID; + } + + template + struct Constraints { + void constraints() { + checkConcept, Graph>(); + checkConcept, Graph>(); + } + }; + + }; + + /// @} + + } + +} + +#endif diff -r da142c310d02 -r 4274224f8a7d lemon/dag_shortest_path.h --- a/lemon/dag_shortest_path.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/dag_shortest_path.h Tue Oct 24 17:19:16 2006 +0000 @@ -93,7 +93,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; // The type of the length of the edges. @@ -111,7 +111,7 @@ /// /// The type of the map that stores the last /// edges of the shortest paths. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; @@ -128,7 +128,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; @@ -205,7 +205,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; // The type of the length of the edges. @@ -223,7 +223,7 @@ /// /// The type of the map that stores the last /// edges of the longest paths. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; @@ -240,7 +240,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; @@ -262,19 +262,19 @@ /// \ingroup flowalgs /// This class provides an efficient implementation of a Dag sortest path /// searching algorithm. The edge lengths are passed to the algorithm - /// using a \ref concept::ReadMap "ReadMap", so it is easy to change it + /// using a \ref concepts::ReadMap "ReadMap", so it is easy to change it /// to any kind of length. /// /// The complexity of the algorithm is O(n + e). /// /// The type of the length is determined by the - /// \ref concept::ReadMap::Value "Value" of the length map. + /// \ref concepts::ReadMap::Value "Value" of the length map. /// /// \param _Graph The graph type the algorithm runs on. The default value /// is \ref ListGraph. The value of _Graph is not used directly by /// DagShortestPath, it is only passed to \ref DagShortestPathDefaultTraits. /// \param _LengthMap This read-only EdgeMap determines the lengths of the - /// edges. The default map type is \ref concept::Graph::EdgeMap + /// edges. The default map type is \ref concepts::Graph::EdgeMap /// "Graph::EdgeMap". The value of _LengthMap is not used directly /// by DagShortestPath, it is only passed to \ref DagShortestPathDefaultTraits. /// \param _Traits Traits class to set various data types used by the @@ -811,7 +811,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; /// \brief The value type of the length map. @@ -829,7 +829,7 @@ /// /// The type of the map that stores the last /// edges of the shortest paths. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. typedef NullMap PredMap; /// \brief Instantiates a PredMap. @@ -841,7 +841,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. typedef NullMap DistMap; /// \brief Instantiates a DistMap. /// diff -r da142c310d02 -r 4274224f8a7d lemon/dfs.h --- a/lemon/dfs.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/dfs.h Tue Oct 24 17:19:16 2006 +0000 @@ -48,7 +48,7 @@ /// ///The type of the map that stores the last ///edges of the %DFS paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; ///Instantiates a PredMap. @@ -64,7 +64,7 @@ ///The type of the map that indicates which nodes are processed. ///The type of the map that indicates which nodes are processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef NullMap ProcessedMap; ///Instantiates a ProcessedMap. @@ -83,7 +83,7 @@ ///The type of the map that indicates which nodes are reached. ///The type of the map that indicates which nodes are reached. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef typename Graph::template NodeMap ReachedMap; ///Instantiates a ReachedMap. @@ -98,7 +98,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; ///Instantiates a DistMap. @@ -752,7 +752,7 @@ /// ///The type of the map that stores the last ///edges of the %DFS paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap PredMap; ///Instantiates a PredMap. @@ -772,7 +772,7 @@ ///The type of the map that indicates which nodes are processed. ///The type of the map that indicates which nodes are processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef NullMap ProcessedMap; ///Instantiates a ProcessedMap. @@ -791,7 +791,7 @@ ///The type of the map that indicates which nodes are reached. ///The type of the map that indicates which nodes are reached. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///\todo named parameter to set this type, function to read and write. typedef typename Graph::template NodeMap ReachedMap; ///Instantiates a ReachedMap. @@ -806,7 +806,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap DistMap; ///Instantiates a DistMap. @@ -1168,7 +1168,7 @@ /// \brief The type of the map that indicates which nodes are reached. /// /// The type of the map that indicates which nodes are reached. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// \todo named parameter to set this type, function to read and write. typedef typename Graph::template NodeMap ReachedMap; diff -r da142c310d02 -r 4274224f8a7d lemon/dijkstra.h --- a/lemon/dijkstra.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/dijkstra.h Tue Oct 24 17:19:16 2006 +0000 @@ -48,7 +48,7 @@ ///The type of the map that stores the edge lengths. ///The type of the map that stores the edge lengths. - ///It must meet the \ref concept::ReadMap "ReadMap" concept. + ///It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef LM LengthMap; //The type of the length of the edges. typedef typename LM::Value Value; @@ -86,7 +86,7 @@ /// ///The type of the map that stores the last ///edges of the shortest paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap PredMap; ///Instantiates a PredMap. @@ -102,7 +102,7 @@ ///The type of the map that stores whether a nodes is processed. ///The type of the map that stores whether a nodes is processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///By default it is a NullMap. ///\todo If it is set to a real map, ///Dijkstra::processed() should read this. @@ -124,7 +124,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename Graph::template NodeMap DistMap; ///Instantiates a DistMap. @@ -142,11 +142,11 @@ /// \ingroup flowalgs ///This class provides an efficient implementation of %Dijkstra algorithm. ///The edge lengths are passed to the algorithm using a - ///\ref concept::ReadMap "ReadMap", + ///\ref concepts::ReadMap "ReadMap", ///so it is easy to change it to any kind of length. /// ///The type of the length is determined by the - ///\ref concept::ReadMap::Value "Value" of the length map. + ///\ref concepts::ReadMap::Value "Value" of the length map. /// ///It is also possible to change the underlying priority heap. /// @@ -157,7 +157,7 @@ ///edges. It is read once for each edge, so the map may involve in ///relatively time consuming process to compute the edge length if ///it is necessary. The default map type is \ref - ///concept::Graph::EdgeMap "Graph::EdgeMap". The value + ///concepts::Graph::EdgeMap "Graph::EdgeMap". The value ///of LM is not used directly by Dijkstra, it is only passed to \ref ///DijkstraDefaultTraits. \param TR Traits class to set ///various data types used by the algorithm. The default traits @@ -819,7 +819,7 @@ ///The type of the map that stores the edge lengths. ///The type of the map that stores the edge lengths. - ///It must meet the \ref concept::ReadMap "ReadMap" concept. + ///It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef LM LengthMap; //The type of the length of the edges. typedef typename LM::Value Value; @@ -861,7 +861,7 @@ /// ///The type of the map that stores the last ///edges of the shortest paths. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap PredMap; ///Instantiates a PredMap. @@ -880,7 +880,7 @@ ///The type of the map that stores whether a nodes is processed. ///The type of the map that stores whether a nodes is processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///By default it is a NullMap. ///\todo If it is set to a real map, ///Dijkstra::processed() should read this. @@ -902,7 +902,7 @@ ///The type of the map that stores the dists of the nodes. ///The type of the map that stores the dists of the nodes. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef NullMap DistMap; ///Instantiates a DistMap. diff -r da142c310d02 -r 4274224f8a7d lemon/edge_set.h --- a/lemon/edge_set.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/edge_set.h Tue Oct 24 17:19:16 2006 +0000 @@ -238,11 +238,11 @@ /// original graph. /// /// \param _Graph The type of the graph which shares its node set with - /// this class. Its interface must conform to the \ref concept::Graph + /// this class. Its interface must conform to the \ref concepts::Graph /// "Graph" concept. /// /// In the edge extension and removing it conforms to the - /// \ref concept::Graph "Graph" concept. + /// \ref concepts::Graph "Graph" concept. template class ListEdgeSet : public EdgeSetExtender > { @@ -330,11 +330,11 @@ /// original graph. /// /// \param _Graph The type of the graph which shares its node set with - /// this class. Its interface must conform to the \ref concept::Graph + /// this class. Its interface must conform to the \ref concepts::Graph /// "Graph" concept. /// /// In the edge extension and removing it conforms to the - /// \ref concept::UGraph "UGraph" concept. + /// \ref concepts::UGraph "UGraph" concept. template class ListUEdgeSet : public UEdgeSetExtender > > { @@ -567,11 +567,11 @@ /// original graph. /// /// \param _Graph The type of the graph which shares its node set with - /// this class. Its interface must conform to the \ref concept::Graph + /// this class. Its interface must conform to the \ref concepts::Graph /// "Graph" concept. /// /// In the edge extension and removing it conforms to the - /// \ref concept::Graph "Graph" concept. + /// \ref concepts::Graph "Graph" concept. template class SmartEdgeSet : public EdgeSetExtender > { @@ -671,11 +671,11 @@ /// original graph. /// /// \param _Graph The type of the graph which shares its node set with - /// this class. Its interface must conform to the \ref concept::Graph + /// this class. Its interface must conform to the \ref concepts::Graph /// "Graph" concept. /// /// In the edge extension and removing it conforms to the - /// \ref concept::UGraph "UGraph" concept. + /// \ref concepts::UGraph "UGraph" concept. template class SmartUEdgeSet : public UEdgeSetExtender > > { diff -r da142c310d02 -r 4274224f8a7d lemon/floyd_warshall.h --- a/lemon/floyd_warshall.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/floyd_warshall.h Tue Oct 24 17:19:16 2006 +0000 @@ -94,7 +94,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; // The type of the length of the edges. @@ -129,7 +129,7 @@ /// \brief The type of the map that stores the dists of the nodes. /// /// The type of the map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMatrixMap "WriteMatrixMap" concept. + /// It must meet the \ref concepts::WriteMatrixMap "WriteMatrixMap" concept. /// typedef DynamicMatrixMap DistMap; @@ -149,7 +149,7 @@ /// \ingroup flowalgs /// This class provides an efficient implementation of \c Floyd-Warshall /// algorithm. The edge lengths are passed to the algorithm using a - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any /// kind of length. /// /// The algorithm solves the shortest path problem for each pair @@ -162,7 +162,7 @@ /// The complexity of this algorithm is \f$ O(n^3+e) \f$. /// /// The type of the length is determined by the - /// \ref concept::ReadMap::Value "Value" of the length map. + /// \ref concepts::ReadMap::Value "Value" of the length map. /// /// \param _Graph The graph type the algorithm runs on. The default value /// is \ref ListGraph. The value of _Graph is not used directly by @@ -171,7 +171,7 @@ /// edges. It is read once for each edge, so the map may involve in /// relatively time consuming process to compute the edge length if /// it is necessary. The default map type is \ref - /// concept::Graph::EdgeMap "Graph::EdgeMap". The value + /// concepts::Graph::EdgeMap "Graph::EdgeMap". The value /// of _LengthMap is not used directly by FloydWarshall, it is only passed /// to \ref FloydWarshallDefaultTraits. \param _Traits Traits class to set /// various data types used by the algorithm. The default traits diff -r da142c310d02 -r 4274224f8a7d lemon/fredman_tarjan.h --- a/lemon/fredman_tarjan.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/fredman_tarjan.h Tue Oct 24 17:19:16 2006 +0000 @@ -36,7 +36,7 @@ #include #include -#include +#include namespace lemon { @@ -52,7 +52,7 @@ ///The type of the map that stores the edge costs. ///The type of the map that stores the edge costs. - ///It must meet the \ref concept::ReadMap "ReadMap" concept. + ///It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef CM CostMap; //The type of the cost of the edges. typedef typename CM::Value Value; @@ -61,7 +61,7 @@ ///The type of the map that stores whether an edge is in the ///spanning tree or not. - ///It must meet the \ref concept::ReadWriteMap "ReadWriteMap" concept. + ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. ///By default it is a BoolEdgeMap. typedef typename UGraph::template UEdgeMap TreeMap; ///Instantiates a TreeMap. @@ -88,11 +88,11 @@ /// \f$ \log^{i+1}(n)=\log(\log^{i}(n)) \f$ /// ///The edge costs are passed to the algorithm using a \ref - ///concept::ReadMap "ReadMap", so it is easy to change it to any + ///concepts::ReadMap "ReadMap", so it is easy to change it to any ///kind of cost. /// ///The type of the cost is determined by the \ref - ///concept::ReadMap::Value "Value" of the cost map. + ///concepts::ReadMap::Value "Value" of the cost map. /// ///\param GR The graph type the algorithm runs on. The default value ///is \ref ListUGraph. The value of GR is not used directly by @@ -103,7 +103,7 @@ ///edges. It is read once for each edge, so the map may involve in ///relatively time consuming process to compute the edge cost if it ///is necessary. The default map type is \ref - ///concept::UGraph::UEdgeMap "UGraph::UEdgeMap". The value of + ///concepts::UGraph::UEdgeMap "UGraph::UEdgeMap". The value of ///CM is not used directly by FredmanTarjan, it is only passed to ///\ref FredmanTarjanDefaultTraits. /// @@ -365,7 +365,7 @@ graph(&_graph), cost(&_cost), _tree(0), local_tree(false) { - checkConcept(); + checkConcept(); } ///Destructor. diff -r da142c310d02 -r 4274224f8a7d lemon/full_graph.h --- a/lemon/full_graph.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/full_graph.h Tue Oct 24 17:19:16 2006 +0000 @@ -167,11 +167,11 @@ /// It is completely static, so you can neither add nor delete either /// edges or nodes. /// Thus it conforms to - /// the \ref concept::Graph "Graph" concept and + /// the \ref concepts::Graph "Graph" concept and ///it also has an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. - /// \sa concept::Graph. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. + /// \sa concepts::Graph. /// /// \sa FullUGraph /// @@ -384,7 +384,7 @@ /// ///It also has an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// /// \sa FullGraph /// diff -r da142c310d02 -r 4274224f8a7d lemon/graph_adaptor.h --- a/lemon/graph_adaptor.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/graph_adaptor.h Tue Oct 24 17:19:16 2006 +0000 @@ -2492,7 +2492,7 @@ /// The full code can be found in the \ref disjoint_paths_demo.cc demo file. /// /// This graph adaptor is fully conform to the - /// \ref concept::Graph "Graph" concept and + /// \ref concepts::Graph "Graph" concept and /// contains some additional member functions and types. The /// documentation of some member functions may be found just in the /// SplitGraphAdaptorBase class. diff -r da142c310d02 -r 4274224f8a7d lemon/grid_ugraph.h --- a/lemon/grid_ugraph.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/grid_ugraph.h Tue Oct 24 17:19:16 2006 +0000 @@ -292,10 +292,10 @@ /// } ///\endcode /// - /// The graph type is fully conform to the \ref concept::UGraph + /// The graph type is fully conform to the \ref concepts::UGraph /// "Undirected Graph" concept, and it also has an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// /// /// \author Balazs Dezso diff -r da142c310d02 -r 4274224f8a7d lemon/hypercube_graph.h --- a/lemon/hypercube_graph.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/hypercube_graph.h Tue Oct 24 17:19:16 2006 +0000 @@ -189,8 +189,8 @@ /// reasons. This way the maximal dimension of this implementation /// is 26. /// - /// The graph type is fully conform to the \ref concept::Graph - /// concept but it does not conform to the \ref concept::UGraph. + /// The graph type is fully conform to the \ref concepts::Graph + /// concept but it does not conform to the \ref concepts::UGraph. /// /// \author Balazs Dezso class HyperCubeGraph : public ExtendedHyperCubeGraphBase { diff -r da142c310d02 -r 4274224f8a7d lemon/johnson.h --- a/lemon/johnson.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/johnson.h Tue Oct 24 17:19:16 2006 +0000 @@ -96,7 +96,7 @@ /// \brief The type of the map that stores the edge lengths. /// /// The type of the map that stores the edge lengths. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _LengthMap LengthMap; // The type of the length of the edges. @@ -162,7 +162,7 @@ /// \brief The type of the matrix map that stores the dists of the nodes. /// /// The type of the matrix map that stores the dists of the nodes. - /// It must meet the \ref concept::WriteMatrixMap "WriteMatrixMap" concept. + /// It must meet the \ref concepts::WriteMatrixMap "WriteMatrixMap" concept. /// typedef DynamicMatrixMap DistMap; @@ -182,7 +182,7 @@ /// \ingroup flowalgs /// This class provides an efficient implementation of \c %Johnson /// algorithm. The edge lengths are passed to the algorithm using a - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any /// kind of length. /// /// The algorithm solves the shortest path problem for each pair @@ -197,7 +197,7 @@ /// Floyd-Warshall algorithm. /// /// The type of the length is determined by the - /// \ref concept::ReadMap::Value "Value" of the length map. + /// \ref concepts::ReadMap::Value "Value" of the length map. /// /// \param _Graph The graph type the algorithm runs on. The default value /// is \ref ListGraph. The value of _Graph is not used directly by @@ -206,7 +206,7 @@ /// edges. It is read once for each edge, so the map may involve in /// relatively time consuming process to compute the edge length if /// it is necessary. The default map type is \ref - /// concept::Graph::EdgeMap "Graph::EdgeMap". The value + /// concepts::Graph::EdgeMap "Graph::EdgeMap". The value /// of _LengthMap is not used directly by Johnson, it is only passed /// to \ref JohnsonDefaultTraits. \param _Traits Traits class to set /// various data types used by the algorithm. The default traits diff -r da142c310d02 -r 4274224f8a7d lemon/kruskal.h --- a/lemon/kruskal.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/kruskal.h Tue Oct 24 17:19:16 2006 +0000 @@ -44,8 +44,8 @@ /// Due to hard C++ hacking, it accepts various input and output types. /// /// \param g The graph the algorithm runs on. - /// It can be either \ref concept::Graph "directed" or - /// \ref concept::UGraph "undirected". + /// It can be either \ref concepts::Graph "directed" or + /// \ref concepts::UGraph "undirected". /// If the graph is directed, the algorithm consider it to be /// undirected by disregarding the direction of the edges. /// @@ -83,7 +83,7 @@ /// \return The cost of the found tree. /// /// \warning If kruskal runs on an - /// \ref lemon::concept::UGraph "undirected graph", be sure that the + /// \ref lemon::concepts::UGraph "undirected graph", be sure that the /// map storing the tree is also undirected /// (e.g. ListUGraph::UEdgeMap, otherwise the values of the /// half of the edges will not be set. diff -r da142c310d02 -r 4274224f8a7d lemon/lemon_reader.h --- a/lemon/lemon_reader.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/lemon_reader.h Tue Oct 24 17:19:16 2006 +0000 @@ -41,7 +41,7 @@ #include #include -#include +#include namespace lemon { @@ -831,7 +831,7 @@ template NodeSetReader& _readMap(std::string name, MapParameter map, const Reader& reader = Reader()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_reader_bits::ItemReader, Reader>(); if (readers.find(name) != readers.end()) { ErrorMessage msg; @@ -1061,7 +1061,7 @@ template EdgeSetReader& _readMap(std::string name, MapParameter map, const Reader& reader = Reader()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_reader_bits::ItemReader, Reader>(); if (readers.find(name) != readers.end()) { ErrorMessage msg; @@ -1305,7 +1305,7 @@ template UEdgeSetReader& _readMap(std::string name, MapParameter map, const Reader& reader = Reader()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_reader_bits::ItemReader, Reader>(); if (readers.find(name) != readers.end()) { ErrorMessage msg; @@ -1376,7 +1376,7 @@ UEdgeSetReader& _readDirMap(std::string name, MapParameter map, const Reader& reader = Reader()) { checkConcept<_reader_bits::ItemReader, Reader>(); - checkConcept, Map>(); + checkConcept, Map>(); readMap("+" + name, _reader_bits::forwardComposeMap(graph, map), reader); readMap("-" + name, diff -r da142c310d02 -r 4274224f8a7d lemon/lemon_writer.h --- a/lemon/lemon_writer.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/lemon_writer.h Tue Oct 24 17:19:16 2006 +0000 @@ -40,7 +40,7 @@ #include #include -#include +#include namespace lemon { @@ -483,7 +483,7 @@ template NodeSetWriter& writeNodeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); writers.push_back( make_pair(name, new _writer_bits:: @@ -672,7 +672,7 @@ template EdgeSetWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); writers.push_back( make_pair(name, new _writer_bits:: @@ -878,7 +878,7 @@ template UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); writers.push_back( make_pair(name, new _writer_bits:: @@ -901,7 +901,7 @@ template UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); writeUEdge("+" + name, _writer_bits::forwardComposeMap(graph, map), writer); diff -r da142c310d02 -r 4274224f8a7d lemon/list_graph.h --- a/lemon/list_graph.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/list_graph.h Tue Oct 24 17:19:16 2006 +0000 @@ -318,15 +318,15 @@ ///This is a simple and fast graph implementation. /// - ///It conforms to the \ref concept::Graph "Graph concept" and it + ///It conforms to the \ref concepts::Graph "Graph concept" and it ///also provides several additional useful extra functionalities. ///The most of the member functions and nested classes are ///documented only in the concept class. /// ///An important extra feature of this graph implementation is that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// - ///\sa concept::Graph. + ///\sa concepts::Graph. class ListGraph : public ExtendedListGraphBase { private: @@ -748,12 +748,12 @@ ///This is a simple and fast undirected graph implementation. /// ///An important extra feature of this graph implementation is that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// ///It conforms to the - ///\ref concept::UGraph "UGraph concept". + ///\ref concepts::UGraph "UGraph concept". /// - ///\sa concept::UGraph. + ///\sa concepts::UGraph. /// class ListUGraph : public ExtendedListUGraphBase { private: @@ -1497,12 +1497,12 @@ /// \brief A smart bipartite undirected graph class. /// /// This is a bipartite undirected graph implementation. - /// It is conforms to the \ref concept::BpUGraph "BpUGraph concept". + /// It is conforms to the \ref concepts::BpUGraph "BpUGraph concept". /// ///An important extra feature of this graph implementation is that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// - /// \sa concept::BpUGraph. + /// \sa concepts::BpUGraph. /// class ListBpUGraph : public ExtendedListBpUGraphBase { /// \brief ListBpUGraph is \e not copy constructible. diff -r da142c310d02 -r 4274224f8a7d lemon/lp_base.h --- a/lemon/lp_base.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/lp_base.h Tue Oct 24 17:19:16 2006 +0000 @@ -665,7 +665,7 @@ ///\code ///std::map ///\endcode - ///- an iterable lemon \ref concept::WriteMap "write map" like + ///- an iterable lemon \ref concepts::WriteMap "write map" like ///\code ///ListGraph::NodeMap ///ListGraph::EdgeMap @@ -765,7 +765,7 @@ ///\code ///std::map ///\endcode - ///- an iterable lemon \ref concept::WriteMap "write map" like + ///- an iterable lemon \ref concepts::WriteMap "write map" like ///\code ///ListGraph::NodeMap ///ListGraph::EdgeMap diff -r da142c310d02 -r 4274224f8a7d lemon/maps.h --- a/lemon/maps.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/maps.h Tue Oct 24 17:19:16 2006 +0000 @@ -29,7 +29,7 @@ ///\ingroup maps ///\brief Miscellaneous property maps /// -///\todo This file has the same name as the concept file in concept/, +///\todo This file has the same name as the concept file in concepts/, /// and this is not easily detectable in docs... #include @@ -252,7 +252,7 @@ ///Convert the \c Value of a map to another type. - ///This \ref concept::ReadMap "read only map" + ///This \ref concepts::ReadMap "read only map" ///converts the \c Value of a maps to type \c T. ///Its \c Key is inherited from \c M. template @@ -289,7 +289,7 @@ ///Simple wrapping of the map - ///This \ref concept::ReadMap "read only map" returns the simple + ///This \ref concepts::ReadMap "read only map" returns the simple ///wrapping of the given map. Sometimes the reference maps cannot be ///combined with simple read maps. This map adaptor wraps the given ///map to simple read map. @@ -309,7 +309,7 @@ ///Simple writeable wrapping of the map - ///This \ref concept::ReadMap "read only map" returns the simple + ///This \ref concepts::ReadMap "read only map" returns the simple ///wrapping of the given map. Sometimes the reference maps cannot be ///combined with simple read-write maps. This map adaptor wraps the ///given map to simple read-write map. @@ -330,7 +330,7 @@ ///Sum of two maps - ///This \ref concept::ReadMap "read only map" returns the sum of the two + ///This \ref concepts::ReadMap "read only map" returns the sum of the two ///given maps. Its \c Key and \c Value will be inherited from \c M1. ///The \c Key and \c Value of M2 must be convertible to those of \c M1. @@ -363,7 +363,7 @@ ///Shift a map with a constant. - ///This \ref concept::ReadMap "read only map" returns the sum of the + ///This \ref concepts::ReadMap "read only map" returns the sum of the ///given map and a constant value. ///Its \c Key and \c Value is inherited from \c M. /// @@ -396,7 +396,7 @@ ///Shift a map with a constant. - ///This \ref concept::ReadWriteMap "read-write map" returns the sum of the + ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the ///given map and a constant value. It makes also possible to write the map. ///Its \c Key and \c Value is inherited from \c M. /// @@ -445,7 +445,7 @@ ///Difference of two maps - ///This \ref concept::ReadMap "read only map" returns the difference + ///This \ref concepts::ReadMap "read only map" returns the difference ///of the values of the two ///given maps. Its \c Key and \c Value will be inherited from \c M1. ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. @@ -476,7 +476,7 @@ ///Product of two maps - ///This \ref concept::ReadMap "read only map" returns the product of the + ///This \ref concepts::ReadMap "read only map" returns the product of the ///values of the two ///given ///maps. Its \c Key and \c Value will be inherited from \c M1. @@ -507,7 +507,7 @@ ///Scales a maps with a constant. - ///This \ref concept::ReadMap "read only map" returns the value of the + ///This \ref concepts::ReadMap "read only map" returns the value of the ///given map multiplied from the left side with a constant value. ///Its \c Key and \c Value is inherited from \c M. /// @@ -540,7 +540,7 @@ ///Scales a maps with a constant. - ///This \ref concept::ReadWriteMap "read-write map" returns the value of the + ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the ///given map multiplied from the left side with a constant value. It can ///be used as write map also if the given multiplier is not zero. ///Its \c Key and \c Value is inherited from \c M. @@ -580,7 +580,7 @@ ///Quotient of two maps - ///This \ref concept::ReadMap "read only map" returns the quotient of the + ///This \ref concepts::ReadMap "read only map" returns the quotient of the ///values of the two ///given maps. Its \c Key and \c Value will be inherited from \c M1. ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. @@ -610,7 +610,7 @@ ///Composition of two maps - ///This \ref concept::ReadMap "read only map" returns the composition of + ///This \ref concepts::ReadMap "read only map" returns the composition of ///two ///given maps. That is to say, if \c m1 is of type \c M1 and \c m2 is ///of \c M2, @@ -655,7 +655,7 @@ ///Combines of two maps using an STL (binary) functor. /// /// - ///This \ref concept::ReadMap "read only map" takes two maps and a + ///This \ref concepts::ReadMap "read only map" takes two maps and a ///binary functor and returns the composition of ///the two ///given maps unsing the functor. @@ -727,7 +727,7 @@ ///Negative value of a map - ///This \ref concept::ReadMap "read only map" returns the negative + ///This \ref concepts::ReadMap "read only map" returns the negative ///value of the ///value returned by the ///given map. Its \c Key and \c Value will be inherited from \c M. @@ -748,7 +748,7 @@ ///Negative value of a map - ///This \ref concept::ReadWriteMap "read-write map" returns the negative + ///This \ref concepts::ReadWriteMap "read-write map" returns the negative ///value of the value returned by the ///given map. Its \c Key and \c Value will be inherited from \c M. ///The unary \c - operator must be defined for \c Value, of course. @@ -783,7 +783,7 @@ ///Absolute value of a map - ///This \ref concept::ReadMap "read only map" returns the absolute value + ///This \ref concepts::ReadMap "read only map" returns the absolute value ///of the ///value returned by the ///given map. Its \c Key and \c Value will be inherited @@ -832,7 +832,7 @@ ///Converts an STL style functor to a map - ///This \ref concept::ReadMap "read only map" returns the value + ///This \ref concepts::ReadMap "read only map" returns the value ///of a ///given map. /// @@ -890,7 +890,7 @@ ///that is it provides an operator() to read its values. /// ///For the sake of convenience it also works as - ///a ususal \ref concept::ReadMap "readable map", + ///a ususal \ref concepts::ReadMap "readable map", ///i.e. operator[] and the \c Key and \c Value typedefs also exist. template @@ -925,7 +925,7 @@ ///Applies all map setting operations to two maps - ///This map has two \ref concept::ReadMap "readable map" + ///This map has two \ref concepts::ReadMap "readable map" ///parameters and each read request will be passed just to the ///first map. This class is the just readable map type of the ForkWriteMap. /// @@ -949,9 +949,9 @@ ///Applies all map setting operations to two maps - ///This map has two \ref concept::WriteMap "writable map" + ///This map has two \ref concepts::WriteMap "writable map" ///parameters and each write request will be passed to both of them. - ///If \c M1 is also \ref concept::ReadMap "readable", + ///If \c M1 is also \ref concepts::ReadMap "readable", ///then the read operations will return the ///corresponding values of \c M1. /// @@ -996,7 +996,7 @@ ///Logical 'not' of a map - ///This bool \ref concept::ReadMap "read only map" returns the + ///This bool \ref concepts::ReadMap "read only map" returns the ///logical negation of ///value returned by the ///given map. Its \c Key and will be inherited from \c M, @@ -1017,7 +1017,7 @@ ///Logical 'not' of a map with writing possibility - ///This bool \ref concept::ReadWriteMap "read-write map" returns the + ///This bool \ref concepts::ReadWriteMap "read-write map" returns the ///logical negation of value returned by the given map. When it is set, ///the opposite value is set to the original map. ///Its \c Key and will be inherited from \c M, diff -r da142c310d02 -r 4274224f8a7d lemon/matrix_maps.h --- a/lemon/matrix_maps.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/matrix_maps.h Tue Oct 24 17:19:16 2006 +0000 @@ -25,13 +25,13 @@ #include #include -#include +#include /// \file /// \ingroup matrices /// \brief Maps indexed with pairs of items. /// -/// \todo This file has the same name as the concept file in concept/, +/// \todo This file has the same name as the concept file in concepts/, /// and this is not easily detectable in docs... namespace lemon { @@ -295,7 +295,7 @@ ///type of the two map shall be the same. template DynamicMatrixMap& operator=(const CMap& _cmap){ - checkConcept, CMap>(); + checkConcept, CMap>(); typename Parent::Notifier* notifier = Parent::getNotifier(); Key first, second; for(notifier->first(first); first != INVALID; @@ -432,7 +432,7 @@ ///type of the two map shall be the same. template DynamicSymMatrixMap& operator=(const CMap& _cmap){ - checkConcept, CMap>(); + checkConcept, CMap>(); typename Parent::Notifier* notifier = Parent::getNotifier(); Key first, second; for(notifier->first(first); first != INVALID; @@ -519,7 +519,7 @@ ///content change, so it is updated automaticly whenever it is ///needed. /// - ///This map meet with the concept::ReferenceMatrixMap called as ///"ReferenceMatrixMap". /// @@ -860,7 +860,7 @@ ///type of the two map shall be the same. template DynamicAsymMatrixMap& operator=(const CMap& _cdmap){ - checkConcept, CMap>(); + checkConcept, CMap>(); const typename FirstKeyProxy::Notifier* notifierFirstKey = _first_key_proxy.getNotifier(); const typename SecondKeyProxy::Notifier* notifierSecondKey = diff -r da142c310d02 -r 4274224f8a7d lemon/min_cost_arborescence.h --- a/lemon/min_cost_arborescence.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/min_cost_arborescence.h Tue Oct 24 17:19:16 2006 +0000 @@ -45,7 +45,7 @@ /// \brief The type of the map that stores the edge costs. /// /// The type of the map that stores the edge costs. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _CostMap CostMap; /// \brief The value type of the costs. @@ -57,7 +57,7 @@ /// in the arborescence. /// /// The type of the map that stores which edges are in the arborescence. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// Initially it will be set to false on each edge. After it /// will set all arborescence edges once. typedef typename Graph::template EdgeMap ArborescenceMap; @@ -110,7 +110,7 @@ /// edges. It is read once for each edge, so the map may involve in /// relatively time consuming process to compute the edge cost if /// it is necessary. The default map type is \ref - /// concept::Graph::EdgeMap "Graph::EdgeMap". The value + /// concepts::Graph::EdgeMap "Graph::EdgeMap". The value /// of _CostMap is not used directly by MinCostArborescence, /// it is only passed to \ref MinCostArborescenceDefaultTraits. /// \param _Traits Traits class to set various data types used diff -r da142c310d02 -r 4274224f8a7d lemon/min_cut.h --- a/lemon/min_cut.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/min_cut.h Tue Oct 24 17:19:16 2006 +0000 @@ -67,7 +67,7 @@ /// \brief The type of the map that stores the edge capacities. /// /// The type of the map that stores the edge capacities. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _CapacityMap CapacityMap; /// \brief The type of the capacity of the edges. @@ -113,7 +113,7 @@ /// \brief The type of the map that stores whether a nodes is processed. /// /// The type of the map that stores whether a nodes is processed. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. /// By default it is a NullMap. typedef NullMap ProcessedMap; @@ -134,7 +134,7 @@ /// \brief The type of the map that stores the cardinalties of the nodes. /// /// The type of the map that stores the cardinalities of the nodes. - /// It must meet the \ref concept::WriteMap "WriteMap" concept. + /// It must meet the \ref concepts::WriteMap "WriteMap" concept. typedef typename Graph::template NodeMap CardinalityMap; /// \brief Instantiates a CardinalityMap. @@ -162,11 +162,11 @@ /// before the given node. /// /// The edge capacities are passed to the algorithm using a - /// \ref concept::ReadMap "ReadMap", so it is easy to change it to any + /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any /// kind of capacity. /// /// The type of the capacity is determined by the \ref - /// concept::ReadMap::Value "Value" of the capacity map. + /// concepts::ReadMap::Value "Value" of the capacity map. /// /// It is also possible to change the underlying priority heap. /// @@ -179,7 +179,7 @@ /// the edges. It is read once for each edge, so the map may involve in /// relatively time consuming process to compute the edge capacity if /// it is necessary. The default map type is \ref - /// concept::Graph::EdgeMap "Graph::EdgeMap". The value + /// concepts::Graph::EdgeMap "Graph::EdgeMap". The value /// of CapacityMap is not used directly by search algorithm, it is only /// passed to \ref MaxCardinalitySearchDefaultTraits. /// \param _Traits Traits class to set various data types used by the @@ -714,7 +714,7 @@ /// \brief The type of the map that stores the edge capacities. /// /// The type of the map that stores the edge capacities. - /// It must meet the \ref concept::ReadMap "ReadMap" concept. + /// It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef _CapacityMap CapacityMap; /// \brief Instantiates a CapacityMap. diff -r da142c310d02 -r 4274224f8a7d lemon/prim.h --- a/lemon/prim.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/prim.h Tue Oct 24 17:19:16 2006 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include namespace lemon { @@ -46,7 +46,7 @@ ///The type of the map that stores the edge costs. ///The type of the map that stores the edge costs. - ///It must meet the \ref concept::ReadMap "ReadMap" concept. + ///It must meet the \ref concepts::ReadMap "ReadMap" concept. typedef CM CostMap; //The type of the cost of the edges. typedef typename CM::Value Value; @@ -82,7 +82,7 @@ /// ///The type of the map that stores the last ///edges of the minimum spanning tree. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. /// typedef typename UGraph::template NodeMap PredMap; ///Instantiates a PredMap. @@ -113,7 +113,7 @@ ///The type of the map that stores whether a nodes is processed. ///The type of the map that stores whether a nodes is processed. - ///It must meet the \ref concept::WriteMap "WriteMap" concept. + ///It must meet the \ref concepts::WriteMap "WriteMap" concept. ///By default it is a NodeMap. typedef NullMap ProcessedMap; ///Instantiates a ProcessedMap. @@ -140,11 +140,11 @@ ///n is the number of nodes in the graph. /// ///The edge costs are passed to the algorithm using a - ///\ref concept::ReadMap "ReadMap", + ///\ref concepts::ReadMap "ReadMap", ///so it is easy to change it to any kind of cost. /// ///The type of the cost is determined by the - ///\ref concept::ReadMap::Value "Value" of the cost map. + ///\ref concepts::ReadMap::Value "Value" of the cost map. /// ///It is also possible to change the underlying priority heap. /// @@ -156,7 +156,7 @@ ///edges. It is read once for each edge, so the map may involve in ///relatively time consuming process to compute the edge cost if ///it is necessary. The default map type is \ref - ///concept::UGraph::UEdgeMap "UGraph::UEdgeMap". The value + ///concepts::UGraph::UEdgeMap "UGraph::UEdgeMap". The value ///of CM is not used directly by Prim, it is only passed to \ref ///PrimDefaultTraits. /// @@ -412,7 +412,7 @@ _heap_cross_ref(NULL), local_heap_cross_ref(false), _heap(NULL), local_heap(false) { - checkConcept(); + checkConcept(); } ///Destructor. diff -r da142c310d02 -r 4274224f8a7d lemon/smart_graph.h --- a/lemon/smart_graph.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/smart_graph.h Tue Oct 24 17:19:16 2006 +0000 @@ -194,11 +194,11 @@ ///that it does support only limited (only stack-like) ///node and edge deletions. ///It conforms to - ///the \ref concept::Graph "Graph concept" with an + ///the \ref concepts::Graph "Graph concept" with an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// - ///\sa concept::Graph. + ///\sa concepts::Graph. /// ///\author Alpar Juttner class SmartGraph : public ExtendedSmartGraphBase { @@ -380,13 +380,13 @@ /// that it does support only limited (only stack-like) /// node and edge deletions. /// Except from this it conforms to - /// the \ref concept::UGraph "UGraph concept". + /// the \ref concepts::UGraph "UGraph concept". /// ///It also has an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// - /// \sa concept::UGraph. + /// \sa concepts::UGraph. /// /// \todo Snapshot hasn't been implemented yet. /// @@ -762,13 +762,13 @@ /// It is also quite memory efficient, but at the price /// that it does not support node and edge deletions. /// Except from this it conforms to - /// the \ref concept::BpUGraph "BpUGraph concept". + /// the \ref concepts::BpUGraph "BpUGraph concept". /// ///It also has an ///important extra feature that - ///its maps are real \ref concept::ReferenceMap "reference map"s. + ///its maps are real \ref concepts::ReferenceMap "reference map"s. /// - /// \sa concept::BpUGraph. + /// \sa concepts::BpUGraph. /// class SmartBpUGraph : public ExtendedSmartBpUGraphBase { private: diff -r da142c310d02 -r 4274224f8a7d lemon/topology.h --- a/lemon/topology.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/topology.h Tue Oct 24 17:19:16 2006 +0000 @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -53,7 +53,7 @@ /// \note By definition, the empty graph is connected. template bool connected(const UGraph& graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; if (NodeIt(graph) == INVALID) return true; Dfs dfs(graph); @@ -78,7 +78,7 @@ /// of zero connected components. template int countConnectedComponents(const UGraph &graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::Edge Edge; @@ -126,10 +126,10 @@ /// template int connectedComponents(const UGraph &graph, NodeMap &compMap) { - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::Edge Edge; - checkConcept, NodeMap>(); + checkConcept, NodeMap>(); typedef NullMap PredMap; typedef NullMap DistMap; @@ -244,7 +244,7 @@ /// \note By definition, the empty graph is strongly connected. template bool stronglyConnected(const Graph& graph) { - checkConcept(); + checkConcept(); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -302,7 +302,7 @@ /// strongly connected components. template int countStronglyConnectedComponents(const Graph& graph) { - checkConcept(); + checkConcept(); using namespace _topology_bits; @@ -371,10 +371,10 @@ /// template int stronglyConnectedComponents(const Graph& graph, NodeMap& compMap) { - checkConcept(); + checkConcept(); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; - checkConcept, NodeMap>(); + checkConcept, NodeMap>(); using namespace _topology_bits; @@ -434,11 +434,11 @@ /// \return The number of cut edges template int stronglyConnectedCutEdges(const Graph& graph, EdgeMap& cutMap) { - checkConcept(); + checkConcept(); typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; typedef typename Graph::NodeIt NodeIt; - checkConcept, EdgeMap>(); + checkConcept, EdgeMap>(); using namespace _topology_bits; @@ -730,7 +730,7 @@ /// \return The number of components. template int countBiNodeConnectedComponents(const UGraph& graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; using namespace _topology_bits; @@ -774,10 +774,10 @@ template int biNodeConnectedComponents(const UGraph& graph, UEdgeMap& compMap) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::UEdge UEdge; - checkConcept, UEdgeMap>(); + checkConcept, UEdgeMap>(); using namespace _topology_bits; @@ -814,10 +814,10 @@ /// \return The number of the cut nodes. template int biNodeConnectedCutNodes(const UGraph& graph, NodeMap& cutMap) { - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::NodeIt NodeIt; - checkConcept, NodeMap>(); + checkConcept, NodeMap>(); using namespace _topology_bits; @@ -1057,7 +1057,7 @@ /// \return The number of components. template int countBiEdgeConnectedComponents(const UGraph& graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; using namespace _topology_bits; @@ -1100,10 +1100,10 @@ /// template int biEdgeConnectedComponents(const UGraph& graph, NodeMap& compMap) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::Node Node; - checkConcept, NodeMap>(); + checkConcept, NodeMap>(); using namespace _topology_bits; @@ -1141,10 +1141,10 @@ /// \return The number of cut edges. template int biEdgeConnectedCutEdges(const UGraph& graph, UEdgeMap& cutMap) { - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::UEdge UEdge; - checkConcept, UEdgeMap>(); + checkConcept, UEdgeMap>(); using namespace _topology_bits; @@ -1205,8 +1205,8 @@ void topologicalSort(const Graph& graph, NodeMap& order) { using namespace _topology_bits; - checkConcept(); - checkConcept, NodeMap>(); + checkConcept(); + checkConcept, NodeMap>(); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -1247,8 +1247,8 @@ bool checkedTopologicalSort(const Graph& graph, NodeMap& order) { using namespace _topology_bits; - checkConcept(); - checkConcept, NodeMap>(); + checkConcept(); + checkConcept, NodeMap>(); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -1290,7 +1290,7 @@ template bool dag(const Graph& graph) { - checkConcept(); + checkConcept(); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -1331,7 +1331,7 @@ /// \see dag template bool acyclic(const UGraph& graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::Edge Edge; @@ -1364,7 +1364,7 @@ /// \return %True when the graph is acyclic and connected. template bool tree(const UGraph& graph) { - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::Edge Edge; @@ -1402,7 +1402,7 @@ /// \author Balazs Attila Mihaly template inline bool bipartite(const UGraph &graph){ - checkConcept(); + checkConcept(); typedef typename UGraph::NodeIt NodeIt; typedef typename UGraph::EdgeIt EdgeIt; @@ -1439,7 +1439,7 @@ /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth template inline bool bipartitePartitions(const UGraph &graph, NodeMap &partMap){ - checkConcept(); + checkConcept(); typedef typename UGraph::Node Node; typedef typename UGraph::NodeIt NodeIt; diff -r da142c310d02 -r 4274224f8a7d lemon/vmap.h --- a/lemon/vmap.h Tue Oct 24 16:49:41 2006 +0000 +++ b/lemon/vmap.h Tue Oct 24 17:19:16 2006 +0000 @@ -59,7 +59,7 @@ virtual void set(const Key &,const Value &) = 0; }; - ///Makes a virtual map from a \ref concept::ReadMap "ReadMap" + ///Makes a virtual map from a \ref concepts::ReadMap "ReadMap" template class VReadMap : public VMapBase { @@ -74,7 +74,7 @@ template vReadMap(const M& m) {return VReadMap(m);} - ///Makes a virtual map from a \ref concept::WriteMap "WriteMap" + ///Makes a virtual map from a \ref concepts::WriteMap "WriteMap" template class VWriteMap :public VMapBase { @@ -89,7 +89,7 @@ template vWriteMap(const M& m) {return VReadMap(m);} - ///Makes a virtual map from a \ref concept::ReadWriteMap "ReadWriteMap" + ///Makes a virtual map from a \ref concepts::ReadWriteMap "ReadWriteMap" template class VReadWriteMap :public VMapBase { diff -r da142c310d02 -r 4274224f8a7d test/bfs_test.cc --- a/test/bfs_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/bfs_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -20,7 +20,7 @@ #include #include #include -#include +#include using namespace lemon; @@ -29,7 +29,7 @@ void check_Bfs_Compile() { - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; @@ -66,22 +66,22 @@ void check_Bfs_Function_Compile() { typedef int VType; - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; - typedef concept::ReadMap LengthMap; + typedef concepts::ReadMap LengthMap; Graph g; bfs(g,Node()).run(); bfs(g).source(Node()).run(); bfs(g) - .predMap(concept::WriteMap()) - .distMap(concept::WriteMap()) - .reachedMap(concept::ReadWriteMap()) - .processedMap(concept::WriteMap()) + .predMap(concepts::WriteMap()) + .distMap(concepts::WriteMap()) + .reachedMap(concepts::ReadWriteMap()) + .processedMap(concepts::WriteMap()) .run(Node()); } diff -r da142c310d02 -r 4274224f8a7d test/bpugraph_test.cc --- a/test/bpugraph_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/bpugraph_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -16,7 +16,7 @@ * */ -#include +#include #include #include #include @@ -28,7 +28,7 @@ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; void check_concepts() { diff -r da142c310d02 -r 4274224f8a7d test/dfs_test.cc --- a/test/dfs_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/dfs_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -20,7 +20,7 @@ #include #include #include -#include +#include using namespace lemon; @@ -29,7 +29,7 @@ void check_Dfs_SmartGraph_Compile() { - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; @@ -67,22 +67,22 @@ void check_Dfs_Function_Compile() { typedef int VType; - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; - typedef concept::ReadMap LengthMap; + typedef concepts::ReadMap LengthMap; Graph g; dfs(g,Node()).run(); dfs(g).source(Node()).run(); dfs(g) - .predMap(concept::WriteMap()) - .distMap(concept::WriteMap()) - .reachedMap(concept::ReadWriteMap()) - .processedMap(concept::WriteMap()) + .predMap(concepts::WriteMap()) + .distMap(concepts::WriteMap()) + .reachedMap(concepts::ReadWriteMap()) + .processedMap(concepts::WriteMap()) .run(Node()); } diff -r da142c310d02 -r 4274224f8a7d test/dijkstra_test.cc --- a/test/dijkstra_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/dijkstra_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -21,8 +21,8 @@ #include #include #include -#include -#include +#include +#include using namespace lemon; const int PET_SIZE =5; @@ -31,13 +31,13 @@ void check_Dijkstra_BinHeap_Compile() { typedef int VType; - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; - typedef concept::ReadMap LengthMap; + typedef concepts::ReadMap LengthMap; typedef Dijkstra DType; @@ -70,20 +70,20 @@ void check_Dijkstra_Function_Compile() { typedef int VType; - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; - typedef concept::ReadMap LengthMap; + typedef concepts::ReadMap LengthMap; Graph g; dijkstra(g,LengthMap(),Node()).run(); dijkstra(g,LengthMap()).source(Node()).run(); dijkstra(g,LengthMap()) - .predMap(concept::WriteMap()) - .distMap(concept::WriteMap()) + .predMap(concepts::WriteMap()) + .distMap(concepts::WriteMap()) .run(Node()); } diff -r da142c310d02 -r 4274224f8a7d test/edge_set_test.cc --- a/test/edge_set_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/edge_set_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -15,7 +15,7 @@ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; typedef SmartGraph RGraph; diff -r da142c310d02 -r 4274224f8a7d test/graph_adaptor_test.cc --- a/test/graph_adaptor_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/graph_adaptor_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -20,9 +20,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -41,7 +41,7 @@ */ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; diff -r da142c310d02 -r 4274224f8a7d test/graph_factory_test.cc --- a/test/graph_factory_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/graph_factory_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -70,22 +70,22 @@ } //Compile Graph -template void lemon::concept::checkCompileGraph -(concept::Graph &); +template void lemon::concepts::checkCompileGraph +(concepts::Graph &); template -void lemon::concept::checkCompileGraph -(concept::Graph &); +void lemon::concepts::checkCompileGraph +(concepts::Graph &); template -void lemon::concept::checkCompileGraph -(concept::Graph &); +void lemon::concepts::checkCompileGraph +(concepts::Graph &); //Compile SmartGraph template -void lemon::concept::checkCompileGraph(SmartGraph &); +void lemon::concepts::checkCompileGraph(SmartGraph &); template -void lemon::concept::checkCompileGraphFindEdge(SmartGraph &); +void lemon::concepts::checkCompileGraphFindEdge(SmartGraph &); //Compile SymSmartGraph //template void hugo::checkCompileGraph(SymSmartGraph &); @@ -93,11 +93,11 @@ //Compile ListGraph template -void lemon::concept::checkCompileGraph(ListGraph &); +void lemon::concepts::checkCompileGraph(ListGraph &); template -void lemon::concept::checkCompileGraph(ListGraph &); +void lemon::concepts::checkCompileGraph(ListGraph &); template -void lemon::concept::checkCompileGraphFindEdge(ListGraph &); +void lemon::concepts::checkCompileGraphFindEdge(ListGraph &); //Compile SymListGraph @@ -106,9 +106,9 @@ //template void hugo::checkCompileGraphFindEdge(SymListGraph &); //Compile FullGraph -template void lemon::concept::checkCompileGraph(FullGraph &); +template void lemon::concepts::checkCompileGraph(FullGraph &); template -void lemon::concept::checkCompileGraphFindEdge(FullGraph &); +void lemon::concepts::checkCompileGraphFindEdge(FullGraph &); int main() @@ -143,7 +143,7 @@ // Some map tests. // FIXME: These shouldn't be here. - using namespace concept; + using namespace concepts; function_requires< ReadMapConcept< ReadMap > >(); function_requires< WriteMapConcept< WriteMap > >(); function_requires< ReadWriteMapConcept< ReadWriteMap > >(); diff -r da142c310d02 -r 4274224f8a7d test/graph_test.cc --- a/test/graph_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/graph_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; int main() { diff -r da142c310d02 -r 4274224f8a7d test/heap_test.cc --- a/test/heap_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/heap_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -40,7 +40,7 @@ #include using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; int main() { diff -r da142c310d02 -r 4274224f8a7d test/kruskal_test.cc --- a/test/kruskal_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/kruskal_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include using namespace std; @@ -32,11 +32,11 @@ void checkCompileKruskal() { - concept::WriteMap w; + concepts::WriteMap w; - concept::Graph g; + concepts::Graph g; kruskal(g, - concept::ReadMap(), + concepts::ReadMap(), w); } diff -r da142c310d02 -r 4274224f8a7d test/maps_test.cc --- a/test/maps_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/maps_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -20,13 +20,13 @@ #include #include -#include +#include #include #include "test_tools.h" using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; struct A {}; inline bool operator<(A, A) { return true; } diff -r da142c310d02 -r 4274224f8a7d test/matrix_maps_test.cc --- a/test/matrix_maps_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/matrix_maps_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -21,9 +21,9 @@ #include -#include -#include -#include +#include +#include +#include #include @@ -35,7 +35,7 @@ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; int main() { typedef SmartGraph Graph; diff -r da142c310d02 -r 4274224f8a7d test/path_test.cc --- a/test/path_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/path_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -31,11 +31,11 @@ using namespace lemon; void check_concepts() { - checkConcept, - concept::Path >(); - checkConcept, - Path >(); - checkConcept, Path >(); + checkConcept, + concepts::Path >(); + checkConcept, + Path >(); + checkConcept, Path >(); } int main() { diff -r da142c310d02 -r 4274224f8a7d test/preflow_test.cc --- a/test/preflow_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/preflow_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -23,21 +23,21 @@ #include #include #include -#include -#include +#include +#include using namespace lemon; void check_Preflow() { typedef int VType; - typedef concept::Graph Graph; + typedef concepts::Graph Graph; typedef Graph::Node Node; typedef Graph::Edge Edge; - typedef concept::ReadMap CapMap; - typedef concept::ReadWriteMap FlowMap; - typedef concept::ReadWriteMap CutMap; + typedef concepts::ReadMap CapMap; + typedef concepts::ReadWriteMap FlowMap; + typedef concepts::ReadWriteMap CutMap; typedef Preflow PType; diff -r da142c310d02 -r 4274224f8a7d test/test_tools.h --- a/test/test_tools.h Tue Oct 24 16:49:41 2006 +0000 +++ b/test/test_tools.h Tue Oct 24 17:19:16 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include #include diff -r da142c310d02 -r 4274224f8a7d test/ugraph_test.cc --- a/test/ugraph_test.cc Tue Oct 24 16:49:41 2006 +0000 +++ b/test/ugraph_test.cc Tue Oct 24 17:19:16 2006 +0000 @@ -17,7 +17,7 @@ */ #include -#include +#include #include #include #include @@ -29,7 +29,7 @@ using namespace lemon; -using namespace lemon::concept; +using namespace lemon::concepts; void check_concepts() {