diff --git a/lemon/concepts/graph.h b/lemon/concepts/graph.h --- a/lemon/concepts/graph.h +++ b/lemon/concepts/graph.h @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2008 + * Copyright (C) 2003-2009 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -20,11 +20,10 @@ ///\file ///\brief The concept of Undirected Graphs. -#ifndef LEMON_CONCEPT_GRAPH_H -#define LEMON_CONCEPT_GRAPH_H +#ifndef LEMON_CONCEPTS_GRAPH_H +#define LEMON_CONCEPTS_GRAPH_H #include -#include #include namespace lemon { @@ -311,8 +310,8 @@ /// The directed arc type. It can be converted to the /// edge or it should be inherited from the undirected - /// arc. - class Arc : public Edge { + /// edge. + class Arc { public: /// Default constructor @@ -323,7 +322,7 @@ /// Copy constructor. /// - Arc(const Arc& e) : Edge(e) { } + Arc(const Arc&) { } /// Initialize the iterator to be invalid. /// Initialize the iterator to be invalid. @@ -350,6 +349,8 @@ /// ordering of the items. bool operator<(Arc) const { return false; } + /// Converison to Edge + operator Edge() const { return Edge(); } }; /// This iterator goes through each directed arc. @@ -498,12 +499,11 @@ InArcIt& operator++() { return *this; } }; - /// \brief Read write map of the nodes to type \c T. + /// \brief Reference map of the nodes to type \c T. /// - /// ReadWrite map of the nodes to type \c T. - /// \sa Reference + /// Reference map of the nodes to type \c T. template - class NodeMap : public ReadWriteMap< Node, T > + class NodeMap : public ReferenceMap { public: @@ -514,7 +514,8 @@ private: ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + NodeMap(const NodeMap& nm) : + ReferenceMap(nm) { } ///Assignment operator template NodeMap& operator=(const CMap&) { @@ -523,12 +524,11 @@ } }; - /// \brief Read write map of the directed arcs to type \c T. + /// \brief Reference map of the arcs to type \c T. /// - /// Reference map of the directed arcs to type \c T. - /// \sa Reference + /// Reference map of the arcs to type \c T. template - class ArcMap : public ReadWriteMap + class ArcMap : public ReferenceMap { public: @@ -538,7 +538,8 @@ ArcMap(const Graph&, T) { } private: ///Copy constructor - ArcMap(const ArcMap& em) : ReadWriteMap(em) { } + ArcMap(const ArcMap& em) : + ReferenceMap(em) { } ///Assignment operator template ArcMap& operator=(const CMap&) { @@ -547,12 +548,11 @@ } }; - /// Read write map of the edges to type \c T. + /// Reference map of the edges to type \c T. - /// Reference map of the arcs to type \c T. - /// \sa Reference + /// Reference map of the edges to type \c T. template - class EdgeMap : public ReadWriteMap + class EdgeMap : public ReferenceMap { public: @@ -562,7 +562,8 @@ EdgeMap(const Graph&, T) { } private: ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) {} + EdgeMap(const EdgeMap& em) : + ReferenceMap(em) {} ///Assignment operator template EdgeMap& operator=(const CMap&) { @@ -602,23 +603,35 @@ /// \brief Opposite node on an arc /// - /// \return the opposite of the given Node on the given Edge + /// \return The opposite of the given node on the given edge. Node oppositeNode(Node, Edge) const { return INVALID; } /// \brief First node of the edge. /// - /// \return the first node of the given Edge. + /// \return The first node of the given edge. /// /// Naturally 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 arc. The direction of the arc - /// which arises this way is called the inherent direction of the + /// don't have source and target node. However we use \c u() and \c v() + /// methods to query the two nodes of the arc. The direction of the + /// arc which arises this way is called the inherent direction of the /// edge, and is used to define the "default" direction /// of the directed versions of the arcs. - /// \sa direction + /// \sa v() + /// \sa direction() Node u(Edge) const { return INVALID; } /// \brief Second node of the edge. + /// + /// \return The second node of the given edge. + /// + /// Naturally edges don't have direction and thus + /// don't have source and target node. However we use \c u() and \c v() + /// methods to query the two nodes of the arc. The direction of the + /// arc which arises this way is called the inherent direction of the + /// edge, and is used to define the "default" direction + /// of the directed versions of the arcs. + /// \sa u() + /// \sa direction() Node v(Edge) const { return INVALID; } /// \brief Source node of the directed arc. @@ -737,6 +750,7 @@ template struct Constraints { void constraints() { + checkConcept(); checkConcept, _Graph>(); checkConcept, _Graph>(); checkConcept, _Graph>();