* Somewhat less redundant and a bit more correct graph concepts.
authorklao
Thu, 04 Nov 2004 22:04:51 +0000
changeset 961289d80c33f04
parent 960 908a1a6f0752
child 962 1a770e9f80b2
* Somewhat less redundant and a bit more correct graph concepts.
* graph_wrapper_test does not compile
src/lemon/concept/graph.h
src/lemon/concept/graph_component.h
src/test/Makefile.am
src/test/new_graph_test.cc
     1.1 --- a/src/lemon/concept/graph.h	Thu Nov 04 21:28:55 2004 +0000
     1.2 +++ b/src/lemon/concept/graph.h	Thu Nov 04 22:04:51 2004 +0000
     1.3 @@ -765,26 +765,6 @@
     1.4      /************* New GraphBase stuff **************/
     1.5  
     1.6  
     1.7 -    /// \bug The nodes and edges are not allowed to inherit from the
     1.8 -    /// same baseclass.
     1.9 -
    1.10 -    class BaseGraphItem {
    1.11 -    public:
    1.12 -      BaseGraphItem() {}
    1.13 -      BaseGraphItem(Invalid) {}
    1.14 -
    1.15 -      // We explicitely list these:
    1.16 -      BaseGraphItem(BaseGraphItem const&) {}
    1.17 -      BaseGraphItem& operator=(BaseGraphItem const&) { return *this; }
    1.18 -
    1.19 -      bool operator==(BaseGraphItem) const { return false; }
    1.20 -      bool operator!=(BaseGraphItem) const { return false; }
    1.21 -
    1.22 -      // Technical requirement. Do we really need this?
    1.23 -      bool operator<(BaseGraphItem) const { return false; }
    1.24 -    };
    1.25 -
    1.26 -
    1.27      /// A minimal GraphBase concept
    1.28  
    1.29      /// This class describes a minimal concept which can be extended to a
    1.30 @@ -794,11 +774,14 @@
    1.31  
    1.32        GraphBase() {}
    1.33  
    1.34 +      /// \bug Should we demand that Node and Edge be subclasses of the
    1.35 +      /// Graph class???
    1.36  
    1.37 -      /// \bug Nodes and Edges are comparable each other
    1.38 -      
    1.39 -      class Node : public BaseGraphItem {};
    1.40 -      class Edge : public BaseGraphItem {};
    1.41 +      typedef GraphItem<'n'> Node;
    1.42 +      typedef GraphItem<'e'> Edge;
    1.43 +
    1.44 +//       class Node : public BaseGraphItem<'n'> {};
    1.45 +//       class Edge : public BaseGraphItem<'e'> {};
    1.46  
    1.47        // Graph operation
    1.48        void firstNode(Node &n) const { }
    1.49 @@ -840,27 +823,13 @@
    1.50  
    1.51  
    1.52  
    1.53 -    /**************** Concept checking classes ****************/
    1.54  
    1.55 -    template<typename BGI>
    1.56 -    struct BaseGraphItemConcept {
    1.57 -      void constraints() {
    1.58 -	BGI i1;
    1.59 -	BGI i2 = i1;
    1.60 -	BGI i3 = INVALID;
    1.61 -	
    1.62 -	i1 = i3;
    1.63 -	if( i1 == i3 ) {
    1.64 -	  if ( i2 != i3 && i3 < i2 )
    1.65 -	    return;
    1.66 -	}
    1.67 -      }
    1.68 -    };
    1.69 +    /**************** The full-featured graph concepts ****************/
    1.70  
    1.71      
    1.72 -    
    1.73      class StaticGraph 
    1.74 -      :  virtual public BaseGraphComponent, public IterableGraphComponent, public MappableGraphComponent {
    1.75 +      :  virtual public BaseGraphComponent,
    1.76 +	 public IterableGraphComponent, public MappableGraphComponent {
    1.77      public:
    1.78        typedef BaseGraphComponent::Node Node;
    1.79        typedef BaseGraphComponent::Edge Edge;
    1.80 @@ -869,15 +838,14 @@
    1.81      template <typename Graph>
    1.82      struct StaticGraphConcept {
    1.83        void constraints() {
    1.84 -	function_requires<BaseGraphComponentConcept<Graph> >();
    1.85  	function_requires<IterableGraphComponentConcept<Graph> >();
    1.86  	function_requires<MappableGraphComponentConcept<Graph> >();
    1.87        }
    1.88 -      Graph& graph;
    1.89      };
    1.90  
    1.91      class ExtendableGraph 
    1.92 -      :  virtual public BaseGraphComponent, public StaticGraph, public ExtendableGraphComponent, public ClearableGraphComponent {
    1.93 +      :  virtual public BaseGraphComponent, public StaticGraph,
    1.94 +	 public ExtendableGraphComponent, public ClearableGraphComponent {
    1.95      public:
    1.96        typedef BaseGraphComponent::Node Node;
    1.97        typedef BaseGraphComponent::Edge Edge;
    1.98 @@ -890,11 +858,11 @@
    1.99  	function_requires<ExtendableGraphComponentConcept<Graph> >();
   1.100  	function_requires<ClearableGraphComponentConcept<Graph> >();
   1.101        }
   1.102 -      Graph& graph;
   1.103      };
   1.104  
   1.105      class ErasableGraph 
   1.106 -      :  virtual public BaseGraphComponent, public ExtendableGraph, public ErasableGraphComponent {
   1.107 +      :  virtual public BaseGraphComponent, public ExtendableGraph,
   1.108 +	 public ErasableGraphComponent {
   1.109      public:
   1.110        typedef BaseGraphComponent::Node Node;
   1.111        typedef BaseGraphComponent::Edge Edge;
   1.112 @@ -906,7 +874,6 @@
   1.113  	function_requires<ExtendableGraphConcept<Graph> >();
   1.114  	function_requires<ErasableGraphComponentConcept<Graph> >();
   1.115        }
   1.116 -      Graph& graph;
   1.117      };
   1.118  
   1.119      // @}
     2.1 --- a/src/lemon/concept/graph_component.h	Thu Nov 04 21:28:55 2004 +0000
     2.2 +++ b/src/lemon/concept/graph_component.h	Thu Nov 04 22:04:51 2004 +0000
     2.3 @@ -28,10 +28,107 @@
     2.4  namespace lemon {
     2.5    namespace concept {
     2.6  
     2.7 +
     2.8 +    /****************   Graph iterator concepts   ****************/
     2.9 +
    2.10 +    /// Skeleton class for graph Node and Edge
    2.11 +
    2.12 +    /// \note Because Node and Edge are forbidden to inherit from the same
    2.13 +    /// base class, this is a template. For Node you shoul instantiate it
    2.14 +    /// with character 'n' and for Edge with 'e'.
    2.15 +
    2.16 +    template<char Ch>
    2.17 +    class GraphItem {
    2.18 +    public:
    2.19 +      GraphItem() {}
    2.20 +      GraphItem(Invalid) {}
    2.21 +
    2.22 +      // We explicitely list these:
    2.23 +      GraphItem(GraphItem const&) {}
    2.24 +      GraphItem& operator=(GraphItem const&) { return *this; }
    2.25 +
    2.26 +      bool operator==(GraphItem) const { return false; }
    2.27 +      bool operator!=(GraphItem) const { return false; }
    2.28 +
    2.29 +      // Technical requirement. Do we really need this?
    2.30 +      bool operator<(GraphItem) const { return false; }
    2.31 +    };
    2.32 +
    2.33 +
    2.34 +    template<typename GI>
    2.35 +    struct GraphItemConcept {
    2.36 +      void constraints() {
    2.37 +	GI i1;
    2.38 +	GI i2 = i1;
    2.39 +	GI i3 = INVALID;
    2.40 +	
    2.41 +	i1 = i2 = i3;
    2.42 +
    2.43 +	bool b;
    2.44 +	b = (ia == ib) && (ia != ib) && (ia < ib);
    2.45 +	b = (ia == INVALID) && (ib != INVALID);
    2.46 +      }
    2.47 +
    2.48 +      const GI &ia;
    2.49 +      const GI &ib;
    2.50 +    };
    2.51 +
    2.52 +
    2.53 +    template<typename Iter, typename Graph, typename BaseItem>
    2.54 +    struct GraphIteratorConcept {
    2.55 +      void constraints() {
    2.56 +	function_requires< GraphItemConcept<Iter> >();
    2.57 +	Iter it1(g);
    2.58 +
    2.59 +	/// \todo Do we need NodeIt(Node) kind of constructor?
    2.60 +	//	Iter it2(bj);
    2.61 +	Iter it2;
    2.62 +
    2.63 +	it2 = ++it1;
    2.64 +	++it2 = it1;
    2.65 +	++(++it1);
    2.66 +	/// \bug This should be: is_base_and_derived<BaseItem, Iter>
    2.67 +	BaseItem bi = it1;
    2.68 +	bi = it2;
    2.69 +      }
    2.70 +
    2.71 +      BaseItem bj;
    2.72 +      Graph g;
    2.73 +    };
    2.74 +
    2.75 +    template<typename Iter, typename Graph>
    2.76 +    struct GraphIncIteratorConcept {
    2.77 +      typedef typename Graph::Node Node;
    2.78 +      typedef typename Graph::Edge Edge;
    2.79 +      void constraints() {
    2.80 +	function_requires< GraphItemConcept<Iter> >();
    2.81 +	Iter it1(graph, node);
    2.82 +	/// \todo Do we need OutEdgeIt(Edge) kind of constructor?
    2.83 +	//	Iter it2(edge);
    2.84 +	Iter it2;
    2.85 +
    2.86 +	it2 = ++it1;
    2.87 +	++it2 = it1;
    2.88 +	++(++it1);
    2.89 +	Edge e = it1;
    2.90 +	e = it2;
    2.91 +      }
    2.92 +
    2.93 +      Edge edge;
    2.94 +      Node node;
    2.95 +      Graph graph;
    2.96 +    };
    2.97 +
    2.98 +
    2.99 +
   2.100      /// An empty base graph class.
   2.101    
   2.102 -    /// This class provides the most minimal features of a graph structure.
   2.103 -    /// All the graph concepts have to be conform to this base graph.
   2.104 +    /// This class provides the minimal set of features needed for a graph
   2.105 +    /// structure. All graph concepts have to be conform to this base
   2.106 +    /// graph.
   2.107 +    ///
   2.108 +    /// \bug This is not true. The minimal graph concept is the
   2.109 +    /// BaseIterableGraphComponent.
   2.110  
   2.111      class BaseGraphComponent {
   2.112      public:
   2.113 @@ -70,14 +167,14 @@
   2.114  
   2.115  	/// Two iterators are equal if and only if they represents the
   2.116  	/// same node in the graph or both are invalid.
   2.117 -	bool operator==(const Node&) { return true;}
   2.118 +	bool operator==(const Node&) const { return true;}
   2.119  
   2.120  
   2.121  	/// Inequality operator.
   2.122  	
   2.123  	/// \sa operator==(const Node& n)
   2.124  	///
   2.125 -	bool operator!=(const Node&) { return true;}
   2.126 +	bool operator!=(const Node&) const { return true;}
   2.127  
   2.128   	/// Comparison operator.
   2.129  
   2.130 @@ -85,7 +182,7 @@
   2.131  	///
   2.132  	/// This ordering can be different from the iterating order of nodes.
   2.133  	/// \todo Possibly we don't need it.
   2.134 -	bool operator<(const Node&) { return true;}
   2.135 +	bool operator<(const Node&) const { return true;}
   2.136        };
   2.137  
   2.138        /// Edge class of the graph.
   2.139 @@ -120,14 +217,14 @@
   2.140  
   2.141  	/// Two iterators are equal if and only if they represents the
   2.142  	/// same edge in the graph or both are invalid.
   2.143 -	bool operator==(const Edge&) { return true;}
   2.144 +	bool operator==(const Edge&) const { return true;}
   2.145  
   2.146  
   2.147  	/// Inequality operator.
   2.148  	
   2.149  	/// \sa operator==(const Edge& n)
   2.150  	///
   2.151 -	bool operator!=(const Edge&) { return true;}
   2.152 +	bool operator!=(const Edge&) const { return true;}
   2.153  
   2.154   	/// Comparison operator.
   2.155  
   2.156 @@ -135,7 +232,7 @@
   2.157  	///
   2.158  	/// This ordering can be different from the iterating order of edges.
   2.159  	/// \todo Possibly we don't need it.
   2.160 -	bool operator<(const Edge&) { return true;}
   2.161 +	bool operator<(const Edge&) const { return true;}
   2.162        };
   2.163  
   2.164        ///Gives back the head node of an edge.
   2.165 @@ -151,6 +248,7 @@
   2.166        Node tail(const Edge&) const { return INVALID;}
   2.167      };
   2.168  
   2.169 +
   2.170      /// Concept check structure for BaseGraph.
   2.171  
   2.172      /// Concept check structure for BaseGraph.
   2.173 @@ -162,24 +260,8 @@
   2.174        typedef typename Graph::Edge Edge;
   2.175        
   2.176        void constraints() {
   2.177 -	{
   2.178 -	  Node ni; 
   2.179 -	  Node nj(ni); 
   2.180 -	  Node nk(INVALID);
   2.181 -	  ni = nj;
   2.182 -	  bool b; b = true;
   2.183 -	  b = (ni == INVALID); b = (ni != INVALID);
   2.184 -	  b = (ni==nj); b = (ni != nj); b=( ni < nj);
   2.185 -	}
   2.186 -	{
   2.187 -	  Edge ei; 
   2.188 -	  Edge ej(ei); 
   2.189 -	  Edge ek(INVALID);
   2.190 -	  ei = ej;
   2.191 -	  bool b; b = true;
   2.192 -	  b = (ei == INVALID); b = (ei != INVALID);
   2.193 -	  b = (ei==ej); b = (ei != ej); b=( ei < ej);
   2.194 -	}
   2.195 +	function_requires< GraphItemConcept<Node> >();
   2.196 +	function_requires< GraphItemConcept<Edge> >();
   2.197  	{
   2.198  	  const Graph& const_graph = graph;
   2.199  	  Node n;
   2.200 @@ -262,29 +344,29 @@
   2.201      template <typename Graph>
   2.202      struct BaseIterableGraphComponentConcept {
   2.203        
   2.204 -      void constraints() { 
   2.205 -	const Graph& const_graph = graph;
   2.206 +      void constraints() {
   2.207 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.208  	typename Graph::Node node;      
   2.209  	typename Graph::Edge edge;
   2.210  	{
   2.211 -	  const_graph.first(node);
   2.212 -	  const_graph.next(node);
   2.213 +	  graph.first(node);
   2.214 +	  graph.next(node);
   2.215  	}
   2.216  	{
   2.217 -	  const_graph.first(edge);
   2.218 -	  const_graph.next(edge);
   2.219 +	  graph.first(edge);
   2.220 +	  graph.next(edge);
   2.221  	}
   2.222  	{
   2.223 -	  const_graph.firstIn(edge, node);
   2.224 -	  const_graph.nextIn(edge);
   2.225 +	  graph.firstIn(edge, node);
   2.226 +	  graph.nextIn(edge);
   2.227  	}
   2.228  	{
   2.229 -	  const_graph.firstOut(edge, node);
   2.230 -	  const_graph.nextOut(edge);
   2.231 +	  graph.firstOut(edge, node);
   2.232 +	  graph.nextOut(edge);
   2.233  	}
   2.234        }
   2.235  
   2.236 -      Graph& graph;
   2.237 +      const Graph& graph;
   2.238      };
   2.239  
   2.240      /// An empty idable base graph class.
   2.241 @@ -322,16 +404,16 @@
   2.242      struct IDableGraphComponentConcept {
   2.243  
   2.244        void constraints() {
   2.245 -	const Graph& const_graph = graph;
   2.246 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.247  	typename Graph::Node node;
   2.248 -	int nid = const_graph.id(node);
   2.249 -	nid = const_graph.id(node);
   2.250 +	int nid = graph.id(node);
   2.251 +	nid = graph.id(node);
   2.252  	typename Graph::Edge edge;
   2.253 -	int eid = const_graph.id(edge);
   2.254 -	eid = const_graph.id(edge);
   2.255 +	int eid = graph.id(edge);
   2.256 +	eid = graph.id(edge);
   2.257        }
   2.258  
   2.259 -      Graph& graph;
   2.260 +      const Graph& graph;
   2.261      };
   2.262  
   2.263  
   2.264 @@ -365,14 +447,14 @@
   2.265      struct MaxIDableGraphComponentConcept {
   2.266  
   2.267        void constraints() {
   2.268 -	const Graph& const_graph = graph;
   2.269 -	int nid = const_graph.maxEdgeId();
   2.270 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.271 +	int nid = graph.maxEdgeId();
   2.272  	ignore_unused_variable_warning(nid);
   2.273 -	int eid = const_graph.maxNodeId();
   2.274 +	int eid = graph.maxNodeId();
   2.275  	ignore_unused_variable_warning(eid);
   2.276        }
   2.277  
   2.278 -      Graph& graph;
   2.279 +      const Graph& graph;
   2.280      };
   2.281  
   2.282      /// An empty extendable base graph class.
   2.283 @@ -411,6 +493,7 @@
   2.284      template <typename Graph>
   2.285      struct BaseExtendableGraphComponentConcept {
   2.286        void constraints() {
   2.287 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.288  	typename Graph::Node node_a, node_b;
   2.289  	node_a = graph.addNode();
   2.290  	typename Graph::Edge edge;
   2.291 @@ -452,6 +535,7 @@
   2.292      template <typename Graph>
   2.293      struct BaseErasableGraphComponentConcept {
   2.294        void constraints() {
   2.295 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.296  	typename Graph::Node node;
   2.297  	graph.erase(node);
   2.298  	typename Graph::Edge edge;
   2.299 @@ -483,6 +567,7 @@
   2.300      template <typename Graph>
   2.301      struct BaseClearableGraphComponentConcept {
   2.302        void constraints() {
   2.303 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.304  	graph.clear();
   2.305        }
   2.306  
   2.307 @@ -490,7 +575,8 @@
   2.308      };
   2.309  
   2.310  
   2.311 -    class IterableGraphComponent : virtual public BaseGraphComponent {
   2.312 +    class IterableGraphComponent :
   2.313 +      virtual public BaseIterableGraphComponent {
   2.314  
   2.315      public:
   2.316      
   2.317 @@ -503,52 +589,56 @@
   2.318        public:
   2.319  	NodeIt() {}
   2.320  	NodeIt(Invalid) {}
   2.321 -	NodeIt(const Graph&) {}
   2.322 +	// explicit NodeIt(Node) {}
   2.323 +	explicit NodeIt(const Graph&) {}
   2.324  
   2.325  	NodeIt& operator++() { return *this; }
   2.326  	//	Node operator*() const { return INVALID; }
   2.327  
   2.328 -	bool operator==(const NodeIt&) { return true;}
   2.329 -	bool operator!=(const NodeIt&) { return true;}
   2.330 +	bool operator==(const NodeIt&) const { return true;}
   2.331 +	bool operator!=(const NodeIt&) const { return true;}
   2.332        };
   2.333  
   2.334        class EdgeIt : public Edge {
   2.335        public:
   2.336  	EdgeIt() {}
   2.337  	EdgeIt(Invalid) {}
   2.338 -	EdgeIt(const Graph&) {}
   2.339 +	// explicit EdgeIt(Edge) {}
   2.340 +	explicit EdgeIt(const Graph&) {}
   2.341  
   2.342  	EdgeIt& operator++() { return *this; }
   2.343  	//	Edge operator*() const { return INVALID; }
   2.344  
   2.345 -	bool operator==(const EdgeIt&) { return true;}
   2.346 -	bool operator!=(const EdgeIt&) { return true;}
   2.347 +	bool operator==(const EdgeIt&) const { return true;}
   2.348 +	bool operator!=(const EdgeIt&) const { return true;}
   2.349        };
   2.350  
   2.351        class InEdgeIt : public Edge {
   2.352        public:
   2.353  	InEdgeIt() {}
   2.354  	InEdgeIt(Invalid) {}
   2.355 -	InEdgeIt(const Graph&, const Node&) {}
   2.356 +	// explicit InEdgeIt(Edge) {}
   2.357 +	explicit InEdgeIt(const Graph&, const Node&) {}
   2.358  
   2.359  	InEdgeIt& operator++() { return *this; }
   2.360  	//	Edge operator*() const { return INVALID; }
   2.361  
   2.362 -	bool operator==(const InEdgeIt&) { return true;}
   2.363 -	bool operator!=(const InEdgeIt&) { return true;}
   2.364 +	bool operator==(const InEdgeIt&) const { return true;}
   2.365 +	bool operator!=(const InEdgeIt&) const { return true;}
   2.366        };
   2.367  
   2.368        class OutEdgeIt : public Edge {
   2.369        public:
   2.370  	OutEdgeIt() {}
   2.371  	OutEdgeIt(Invalid) {}
   2.372 -	OutEdgeIt(const Graph&, const Node&) {}
   2.373 +	// explicit OutEdgeIt(Edge) {}
   2.374 +	explicit OutEdgeIt(const Graph&, const Node&) {}
   2.375  
   2.376  	OutEdgeIt& operator++() { return *this; }
   2.377  	//	Edge operator*() const { return INVALID; }
   2.378  
   2.379 -	bool operator==(const OutEdgeIt&) { return true;}
   2.380 -	bool operator!=(const OutEdgeIt&) { return true;}
   2.381 +	bool operator==(const OutEdgeIt&) const { return true;}
   2.382 +	bool operator!=(const OutEdgeIt&) const { return true;}
   2.383        };
   2.384  
   2.385      };
   2.386 @@ -557,7 +647,8 @@
   2.387      struct IterableGraphComponentConcept {
   2.388  
   2.389        void constraints() {
   2.390 -  
   2.391 +  	function_requires< BaseIterableGraphComponentConcept<Graph> >();
   2.392 +
   2.393  	typedef typename Graph::Node Node;
   2.394  	typedef typename Graph::NodeIt NodeIt;
   2.395  	typedef typename Graph::Edge Edge;
   2.396 @@ -565,68 +656,10 @@
   2.397  	typedef typename Graph::InEdgeIt InEdgeIt;
   2.398  	typedef typename Graph::OutEdgeIt OutEdgeIt;
   2.399    
   2.400 -	{
   2.401 -	  NodeIt it; 
   2.402 -	  NodeIt jt(it); 
   2.403 -	  NodeIt kt(INVALID); 
   2.404 -	  NodeIt lt(graph);
   2.405 -	  it = jt;
   2.406 -	  jt = ++it;
   2.407 -	  bool b;
   2.408 -	  b = (it == INVALID); 
   2.409 -	  b = (it != INVALID);
   2.410 -	  b = (it == jt); 
   2.411 -	  b = (it != jt);
   2.412 -	  Node node = it;
   2.413 -	  node = it;
   2.414 -	}
   2.415 -	{
   2.416 -	  EdgeIt it; 
   2.417 -	  EdgeIt jt(it); 
   2.418 -	  EdgeIt kt(INVALID); 
   2.419 -	  EdgeIt lt(graph);
   2.420 -	  it = jt;
   2.421 -	  jt = ++it;
   2.422 -	  bool b;
   2.423 -	  b = (it == INVALID); 
   2.424 -	  b = (it != INVALID);
   2.425 -	  b = (it == jt); 
   2.426 -	  b = (it != jt);
   2.427 -	  Edge edge = it;
   2.428 -	  edge = it;
   2.429 -	}
   2.430 -	{
   2.431 -	  InEdgeIt it; 
   2.432 -	  InEdgeIt jt(it); 
   2.433 -	  InEdgeIt kt(INVALID); 
   2.434 -	  Node node;
   2.435 -	  InEdgeIt lt(graph, node);
   2.436 -	  it = jt;
   2.437 -	  jt = ++it;
   2.438 -	  bool b;
   2.439 -	  b = (it == INVALID); 
   2.440 -	  b = (it != INVALID);
   2.441 -	  b = (it == jt); 
   2.442 -	  b = (it != jt);
   2.443 -	  Edge edge = it;
   2.444 -	  edge = it;
   2.445 -	}
   2.446 -	{
   2.447 -	  OutEdgeIt it; 
   2.448 -	  OutEdgeIt jt(it); 
   2.449 -	  OutEdgeIt kt(INVALID); 
   2.450 -	  Node node;
   2.451 -	  OutEdgeIt lt(graph, node);
   2.452 -	  it = jt;
   2.453 -	  jt = ++it;
   2.454 -	  bool b;
   2.455 -	  b = (it == INVALID); 
   2.456 -	  b = (it != INVALID);
   2.457 -	  b = (it == jt); 
   2.458 -	  b = (it != jt);
   2.459 -	  Edge edge = it;
   2.460 -	  edge = it;
   2.461 -	}
   2.462 +	function_requires< GraphIteratorConcept<NodeIt, Graph, Node> >();
   2.463 +	function_requires< GraphIteratorConcept<EdgeIt, Graph, Edge> >();
   2.464 +	function_requires< GraphIncIteratorConcept<OutEdgeIt, Graph> >();
   2.465 +	function_requires< GraphIncIteratorConcept<InEdgeIt, Graph> >();
   2.466        }
   2.467        Graph& graph;
   2.468      };
   2.469 @@ -636,11 +669,11 @@
   2.470  
   2.471        typedef IdMappableGraphComponent Graph;
   2.472  
   2.473 +    public:
   2.474 +
   2.475        typedef BaseGraphComponent::Node Node;
   2.476        typedef BaseGraphComponent::Edge Edge;
   2.477  
   2.478 -    public:
   2.479 -
   2.480        class NodeIdMap : public ReadMap<Node, int> {
   2.481        public:
   2.482  	NodeIdMap(const Graph&) {}
   2.483 @@ -658,6 +691,7 @@
   2.484      template <typename Graph>
   2.485      struct IdMappableGraphComponentConcept {
   2.486        void constraints() {	
   2.487 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.488  	{
   2.489  	  typedef typename Graph::EdgeIdMap EdgeIdMap;
   2.490  	  function_requires<ReadMapConcept<EdgeIdMap> >();
   2.491 @@ -719,6 +753,7 @@
   2.492        };
   2.493  
   2.494        void constraints() {
   2.495 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.496  	{ // int map test
   2.497  	  typedef typename Graph::template NodeMap<int> IntNodeMap;
   2.498  	  function_requires<GraphMapConcept<IntNodeMap,Graph> >();
   2.499 @@ -767,6 +802,7 @@
   2.500      template <typename Graph>
   2.501      struct ExtendableGraphComponentConcept {
   2.502        void constraints() {
   2.503 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.504  	typename Graph::Node node_a, node_b;
   2.505  	node_a = graph.addNode();
   2.506  	typename Graph::Edge edge;
   2.507 @@ -791,6 +827,7 @@
   2.508      template <typename Graph>
   2.509      struct ErasableGraphComponentConcept {
   2.510        void constraints() {
   2.511 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.512  	typename Graph::Node node;
   2.513  	graph.erase(node);
   2.514  	typename Graph::Edge edge;
   2.515 @@ -815,6 +852,7 @@
   2.516      template <typename Graph>
   2.517      struct ClearableGraphComponentConcept {
   2.518        void constraints() {
   2.519 +	function_requires< BaseGraphComponentConcept<Graph> >();
   2.520  	graph.clear();
   2.521        }
   2.522        Graph& graph;
     3.1 --- a/src/test/Makefile.am	Thu Nov 04 21:28:55 2004 +0000
     3.2 +++ b/src/test/Makefile.am	Thu Nov 04 22:04:51 2004 +0000
     3.3 @@ -17,7 +17,6 @@
     3.4  	graph_utils_test \
     3.5  	kruskal_test \
     3.6  	min_cost_flow_test \
     3.7 -	new_graph_test \
     3.8  	suurballe_test \
     3.9  	path_test \
    3.10  	preflow_test \
    3.11 @@ -25,7 +24,6 @@
    3.12  	test_tools_pass \
    3.13  	time_measure_test \
    3.14  	unionfind_test \
    3.15 -	graph_wrapper_test \
    3.16  	xy_test
    3.17  
    3.18  TESTS = $(check_PROGRAMS)
    3.19 @@ -39,7 +37,6 @@
    3.20  graph_wrapper_test_SOURCES = graph_wrapper_test.cc
    3.21  kruskal_test_SOURCES = kruskal_test.cc
    3.22  min_cost_flow_test_SOURCES = min_cost_flow_test.cc
    3.23 -new_graph_test_SOURCES = new_graph_test.cc
    3.24  suurballe_test_SOURCES = suurballe_test.cc
    3.25  path_test_SOURCES = path_test.cc
    3.26  preflow_test_SOURCES = preflow_test.cc
     4.1 --- a/src/test/new_graph_test.cc	Thu Nov 04 21:28:55 2004 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,39 +0,0 @@
     4.4 -/* -*- C++ -*-
     4.5 - * src/test/new_graph_test.cc - Part of LEMON, a generic C++ optimization library
     4.6 - *
     4.7 - * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     4.8 - * (Egervary Combinatorial Optimization Research Group, EGRES).
     4.9 - *
    4.10 - * Permission to use, modify and distribute this software is granted
    4.11 - * provided that this copyright notice appears in all copies. For
    4.12 - * precise terms see the accompanying LICENSE file.
    4.13 - *
    4.14 - * This software is provided "AS IS" with no warranty of any kind,
    4.15 - * express or implied, and with no claim as to its suitability for any
    4.16 - * purpose.
    4.17 - *
    4.18 - */
    4.19 -
    4.20 -#include <lemon/concept/graph.h>
    4.21 -// #include <boost/concept_check.hpp>
    4.22 -
    4.23 -using namespace lemon::concept;
    4.24 -
    4.25 -// Borrowed from boost:
    4.26 -template <class T> inline void ignore_unused_variable_warning(const T&) { }
    4.27 -
    4.28 -int main()
    4.29 -{
    4.30 -  //    This is the "right" way to check a concept:
    4.31 -  // boost::function_requires< BaseGraphItemConcept<BaseGraphItem> >();
    4.32 -
    4.33 -  //    which is equivalent (considering compile-time checks) to
    4.34 -  // BaseGraphItemConcept<BaseGraphItem> bgic;
    4.35 -  // bgic.constraints();
    4.36 -  //    but not actually call or intatiates anything...
    4.37 -  //    It's doing aproximately this:
    4.38 -  typedef BaseGraphItemConcept<BaseGraphItem> CC;
    4.39 -  void (CC::*x)() = &CC::constraints;
    4.40 -  ignore_unused_variable_warning(x);
    4.41 -  //    But even more hackish...
    4.42 -}