src/lemon/concept/graph_component.h
changeset 1030 c8a41699e613
parent 1022 567f392d1d2e
child 1043 52a2201a88e9
     1.1 --- a/src/lemon/concept/graph_component.h	Fri Dec 03 12:19:26 2004 +0000
     1.2 +++ b/src/lemon/concept/graph_component.h	Mon Dec 06 00:30:44 2004 +0000
     1.3 @@ -14,7 +14,7 @@
     1.4   *
     1.5   */
     1.6  
     1.7 -///\ingroup concept
     1.8 +///\ingroup graph_concepts
     1.9  ///\file
    1.10  ///\brief The graph components.
    1.11  
    1.12 @@ -28,22 +28,32 @@
    1.13  namespace lemon {
    1.14    namespace concept {
    1.15  
    1.16 +    /// \addtogroup graph_concepts
    1.17 +    /// @{
    1.18  
    1.19      /****************   Graph iterator concepts   ****************/
    1.20  
    1.21 -    /// Skeleton class for graph Node and Edge
    1.22 +    /// Skeleton class for graph Node and Edge types
    1.23  
    1.24 -    /// \note Because Node and Edge are forbidden to inherit from the same
    1.25 -    /// base class, this is a template. For Node you should instantiate it
    1.26 -    /// with character 'n' and for Edge with 'e'.
    1.27 +    /// This class describes the interface of Node and Edge (and UndirEdge
    1.28 +    /// in undirected graphs) subtypes of graph types.
    1.29 +    ///
    1.30 +    /// \note This class is a template class so that we can use it to
    1.31 +    /// create graph skeleton classes. The reason for this is than Node
    1.32 +    /// and Edge types should \em not derive from the same base class.
    1.33 +    /// For Node you should instantiate it with character 'n' and for Edge
    1.34 +    /// with 'e'.
    1.35  
    1.36 -    template<char _selector>
    1.37 +#ifndef DOXYGEN
    1.38 +    template <char _selector = '0'>
    1.39 +#endif
    1.40      class GraphItem {
    1.41      public:
    1.42        /// Default constructor.
    1.43        
    1.44 -      /// @warning The default constructor sets the item
    1.45 -      /// to an undefined value.
    1.46 +      /// \warning The default constructor is not required to set
    1.47 +      /// the item to some well-defined value. So you should consider it
    1.48 +      /// as uninitialized.
    1.49        GraphItem() {}
    1.50        /// Copy constructor.
    1.51        
    1.52 @@ -71,9 +81,17 @@
    1.53        ///
    1.54        bool operator!=(GraphItem) const { return false; }
    1.55  
    1.56 -      // Technical requirement. Do we really need this?
    1.57 -      //      bool operator<(GraphItem) const { return false; }
    1.58 +      /// Artificial ordering operator.
    1.59  
    1.60 +      /// To allow the use of graph descriptors as key type in std::map or
    1.61 +      /// similar associative container we require this.
    1.62 +      ///
    1.63 +      /// \note This operator only have to define some strict ordering of
    1.64 +      /// the items; this order has nothing to do with the iteration
    1.65 +      /// ordering of the items.
    1.66 +      ///
    1.67 +      /// \bug This is a technical requirement. Do we really need this?
    1.68 +      bool operator<(GraphItem) const { return false; }
    1.69  
    1.70        template<typename _GraphItem>
    1.71        struct Constraints {
    1.72 @@ -88,6 +106,7 @@
    1.73  	  //	  b = (ia == ib) && (ia != ib) && (ia < ib);
    1.74  	  b = (ia == ib) && (ia != ib);
    1.75  	  b = (ia == INVALID) && (ib != INVALID);
    1.76 +	  b = (ia < ib);
    1.77  	}
    1.78  
    1.79  	const _GraphItem &ia;
    1.80 @@ -95,6 +114,21 @@
    1.81        };
    1.82      };
    1.83  
    1.84 +    /// A type describing the concept of graph node
    1.85 +
    1.86 +    /// This is an instantiation of \ref GraphItem which can be used as a
    1.87 +    /// Node subtype in graph skeleton definitions
    1.88 +    typedef GraphItem<'n'> GraphNode;
    1.89 +
    1.90 +    /// A type describing the concept of graph edge
    1.91 +
    1.92 +    /// This is an instantiation of \ref GraphItem which can be used as a
    1.93 +    /// Edge subtype in graph skeleton definitions
    1.94 +    typedef GraphItem<'e'> GraphEdge;
    1.95 +
    1.96 +
    1.97 +    /**************** Basic features of graphs ****************/
    1.98 +
    1.99      /// An empty base graph class.
   1.100    
   1.101      /// This class provides the minimal set of features needed for a graph
   1.102 @@ -629,6 +663,11 @@
   1.103      };
   1.104  
   1.105  
   1.106 +    /// Class describing the concept of graph maps
   1.107 +
   1.108 +    /// This class describes the common interface of the graph maps
   1.109 +    /// (NodeMap, EdgeMap), that is \ref maps "maps" which can be used to
   1.110 +    /// associate data to graph descriptors (nodes or edges).
   1.111      template <typename Graph, typename Item, typename _Value>
   1.112      class GraphMap : public ReadWriteMap<Item, _Value> {
   1.113      protected:      
   1.114 @@ -804,6 +843,8 @@
   1.115        };
   1.116      };
   1.117  
   1.118 +    /// @}
   1.119 +
   1.120    }
   1.121  
   1.122  }