COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/lemon/concept/graph_component.h @ 989:ca95f8b5c931

Last change on this file since 989:ca95f8b5c931 was 989:ca95f8b5c931, checked in by Balazs Dezso, 15 years ago

XyzConcept? moved to Xyz::Constraints
use checkConcept in the next way:

checkConcept<ErasableGraph?, ListGraph?>();
checkConcept<ReadWriteMap?<Node, Node>, PredMap?>;

File size: 22.4 KB
Line 
1/* -*- C++ -*-
2 * src/lemon/concept/graph_component.h - Part of LEMON, a generic C++ optimization library
3 *
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
6 *
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
10 *
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
13 * purpose.
14 *
15 */
16
17///\ingroup concept
18///\file
19///\brief The graph components.
20
21
22#ifndef LEMON_CONCEPT_GRAPH_COMPONENT_H
23#define LEMON_CONCEPT_GRAPH_COMPONENT_H
24
25#include <lemon/invalid.h>
26#include <lemon/concept/maps.h>
27
28namespace lemon {
29  namespace concept {
30
31
32    /****************   Graph iterator concepts   ****************/
33
34    /// Skeleton class for graph Node and Edge
35
36    /// \note Because Node and Edge are forbidden to inherit from the same
37    /// base class, this is a template. For Node you should instantiate it
38    /// with character 'n' and for Edge with 'e'.
39
40    template<char _selector>
41    class GraphItem {
42    public:
43      /// Default constructor.
44     
45      /// @warning The default constructor sets the item
46      /// to an undefined value.
47      GraphItem() {}
48      /// Copy constructor.
49     
50      /// Copy constructor.
51      ///
52      GraphItem(GraphItem const&) {}
53      /// Invalid constructor \& conversion.
54
55      /// This constructor initializes the item to be invalid.
56      /// \sa Invalid for more details.
57      GraphItem(Invalid) {}
58      /// Assign operator for nodes.
59
60      /// The nodes are assignable.
61      ///
62      GraphItem& operator=(GraphItem const&) { return *this; }
63      /// Equality operator.
64     
65      /// Two iterators are equal if and only if they represents the
66      /// same node in the graph or both are invalid.
67      bool operator==(GraphItem) const { return false; }
68      /// Inequality operator.
69       
70      /// \sa operator==(const Node& n)
71      ///
72      bool operator!=(GraphItem) const { return false; }
73
74      // Technical requirement. Do we really need this?
75      //      bool operator<(GraphItem) const { return false; }
76
77
78      template<typename _GraphItem>
79      struct Constraints {
80        void constraints() {
81          _GraphItem i1;
82          _GraphItem i2 = i1;
83          _GraphItem i3 = INVALID;
84         
85          i1 = i2 = i3;
86
87          bool b;
88          //      b = (ia == ib) && (ia != ib) && (ia < ib);
89          b = (ia == ib) && (ia != ib);
90          b = (ia == INVALID) && (ib != INVALID);
91        }
92
93        const _GraphItem &ia;
94        const _GraphItem &ib;
95      };
96    };
97
98    /// An empty base graph class.
99 
100    /// This class provides the minimal set of features needed for a graph
101    /// structure. All graph concepts have to be conform to this base
102    /// graph.
103    ///
104    /// \bug This is not true. The minimal graph concept is the
105    /// BaseIterableGraphComponent.
106
107    class BaseGraphComponent {
108    public:
109
110      typedef BaseGraphComponent Graph;
111     
112      /// Node class of the graph.
113
114      /// This class represents the Nodes of the graph.
115      ///
116      typedef GraphItem<'n'> Node;
117
118      /// Edge class of the graph.
119
120      /// This class represents the Edges of the graph.
121      ///
122      typedef GraphItem<'e'> Edge;
123
124      ///Gives back the target node of an edge.
125
126      ///Gives back the target node of an edge.
127      ///
128      Node target(const Edge&) const { return INVALID;}
129
130      ///Gives back the source node of an edge.
131
132      ///Gives back the source node of an edge.
133      ///
134      Node source(const Edge&) const { return INVALID;}
135
136
137      template <typename _Graph>
138      struct Constraints {
139        typedef typename _Graph::Node Node;
140        typedef typename _Graph::Edge Edge;
141     
142        void constraints() {
143          checkConcept<GraphItem<'n'>, Node>();
144          checkConcept<GraphItem<'e'>, Edge>();
145          {
146            Node n;
147            Edge e;
148            n = graph.source(e);
149            n = graph.target(e);
150          }     
151        }
152     
153        const _Graph& graph;
154      };
155    };
156
157    /// An empty iterable base graph class.
158 
159    /// This class provides beside the core graph features
160    /// core iterable interface for the graph structure.
161    /// Most of the base graphs should be conform to this concept.
162
163    class BaseIterableGraphComponent : virtual public BaseGraphComponent {
164    public:
165
166      typedef BaseGraphComponent::Node Node;
167      typedef BaseGraphComponent::Edge Edge;
168
169      /// Gives back the first Node in the iterating order.
170     
171      /// Gives back the first Node in the iterating order.
172      ///     
173      void first(Node&) const {}
174
175      /// Gives back the next Node in the iterating order.
176     
177      /// Gives back the next Node in the iterating order.
178      ///     
179      void next(Node&) const {}
180
181      /// Gives back the first Edge in the iterating order.
182     
183      /// Gives back the first Edge in the iterating order.
184      ///     
185      void first(Edge&) const {}
186      /// Gives back the next Edge in the iterating order.
187     
188      /// Gives back the next Edge in the iterating order.
189      ///     
190      void next(Edge&) const {}
191
192
193      /// Gives back the first of the Edges point to the given Node.
194     
195      /// Gives back the first of the Edges point to the given Node.
196      ///     
197      void firstIn(Edge&, const Node&) const {}
198
199      /// Gives back the next of the Edges points to the given Node.
200
201
202      /// Gives back the next of the Edges points to the given Node.
203      ///
204      void nextIn(Edge&) const {}
205
206      /// Gives back the first of the Edges start from the given Node.
207     
208      /// Gives back the first of the Edges start from the given Node.
209      ///     
210      void firstOut(Edge&, const Node&) const {}
211
212      /// Gives back the next of the Edges start from the given Node.
213     
214      /// Gives back the next of the Edges start from the given Node.
215      ///     
216      void nextOut(Edge&) const {}
217
218
219      template <typename _Graph>
220      struct Constraints {
221     
222        void constraints() {
223          checkConcept< BaseGraphComponent, _Graph >();
224          typename _Graph::Node node;     
225          typename _Graph::Edge edge;
226          {
227            graph.first(node);
228            graph.next(node);
229          }
230          {
231            graph.first(edge);
232            graph.next(edge);
233          }
234          {
235            graph.firstIn(edge, node);
236            graph.nextIn(edge);
237          }
238          {
239            graph.firstOut(edge, node);
240            graph.nextOut(edge);
241          }
242        }
243
244        const _Graph& graph;
245      };
246    };
247
248    /// An empty idable base graph class.
249 
250    /// This class provides beside the core graph features
251    /// core id functions for the graph structure.
252    /// The most of the base graphs should be conform to this concept.
253    /// The id's are unique and immutable.
254    class IDableGraphComponent : virtual public BaseGraphComponent {
255    public:
256
257      typedef BaseGraphComponent::Node Node;
258      typedef BaseGraphComponent::Edge Edge;
259
260      /// Gives back an unique integer id for the Node.
261
262      /// Gives back an unique integer id for the Node.
263      ///
264      int id(const Node&) const { return -1;}
265
266      /// Gives back an unique integer id for the Edge.
267
268      /// Gives back an unique integer id for the Edge.
269      ///
270      int id(const Edge&) const { return -1;}
271
272      template <typename _Graph>
273      struct Constraints {
274
275        void constraints() {
276          checkConcept< BaseGraphComponent, _Graph >();
277          typename _Graph::Node node;
278          int nid = graph.id(node);
279          nid = graph.id(node);
280          typename _Graph::Edge edge;
281          int eid = graph.id(edge);
282          eid = graph.id(edge);
283        }
284
285        const _Graph& graph;
286      };
287    };
288
289
290    /// An empty max-idable base graph class.
291 
292    /// This class provides beside the core graph features
293    /// core max id functions for the graph structure.
294    /// The most of the base graphs should be conform to this concept.
295    /// The id's are unique and immutable.
296    class MaxIDableGraphComponent : virtual public BaseGraphComponent {
297    public:
298
299      /// Gives back an integer greater or equal to the maximum Node id.
300
301      /// Gives back an integer greater or equal to the maximum Node id.
302      ///
303      int maxId(Node = INVALID) const { return -1;}
304
305      /// Gives back an integer greater or equal to the maximum Edge id.
306
307      /// Gives back an integer greater or equal to the maximum Edge id.
308      ///
309      int maxId(Edge = INVALID) const { return -1;}
310
311      template <typename _Graph>
312      struct Constraints {
313
314        void constraints() {
315          checkConcept<BaseGraphComponent, _Graph>();
316          int nid = graph.maxId(typename _Graph::Node());
317          ignore_unused_variable_warning(nid);
318          int eid = graph.maxId(typename _Graph::Edge());
319          ignore_unused_variable_warning(eid);
320        }
321     
322        const _Graph& graph;
323      };
324    };
325
326    /// An empty extendable base graph class.
327 
328    /// This class provides beside the core graph features
329    /// core graph extend interface for the graph structure.
330    /// The most of the base graphs should be conform to this concept.
331    class BaseExtendableGraphComponent : virtual public BaseGraphComponent {
332    public:
333
334      typedef BaseGraphComponent::Node Node;
335      typedef BaseGraphComponent::Edge Edge;
336
337      /// Adds a new Node to the graph.
338
339      /// Adds a new Node to the graph.
340      ///
341      Node addNode() {
342        return INVALID;
343      }
344   
345      /// Adds a new Edge connects the two Nodes to the graph.
346
347      /// Adds a new Edge connects the two Nodes to the graph.
348      ///
349      Edge addEdge(const Node& from, const Node& to) {
350        return INVALID;
351      }
352
353      template <typename _Graph>
354      struct Constraints {
355        void constraints() {
356          checkConcept<BaseGraphComponent, _Graph >();
357          typename _Graph::Node node_a, node_b;
358          node_a = graph.addNode();
359          typename _Graph::Edge edge;
360          edge = graph.addEdge(node_a, node_b);
361        }
362
363        _Graph& graph;
364      };
365    };
366
367    /// An empty erasable base graph class.
368 
369    /// This class provides beside the core graph features
370    /// core erase functions for the graph structure.
371    /// The most of the base graphs should be conform to this concept.
372    class BaseErasableGraphComponent : virtual public BaseGraphComponent {
373    public:
374
375      typedef BaseGraphComponent::Node Node;
376      typedef BaseGraphComponent::Edge Edge;
377
378      /// Erase a Node from the graph.
379     
380      /// Erase a Node from the graph. This function should not
381      /// erase edges connecting to the Node.
382      void erase(const Node&) {}   
383
384      /// Erase an Edge from the graph.
385
386      /// Erase an Edge from the graph.
387      ///
388      void erase(const Edge&) {}
389
390      template <typename _Graph>
391      struct Constraints {
392        void constraints() {
393          checkConcept<BaseGraphComponent, _Graph>();
394          typename _Graph::Node node;
395          graph.erase(node);
396          typename _Graph::Edge edge;
397          graph.erase(edge);
398        }
399
400        _Graph& graph;
401      };
402    };
403
404    /// An empty clearable base graph class.
405 
406    /// This class provides beside the core graph features
407    /// core clear functions for the graph structure.
408    /// The most of the base graphs should be conform to this concept.
409    class BaseClearableGraphComponent : virtual public BaseGraphComponent {
410    public:
411
412      /// Erase all the Nodes and Edges from the graph.
413
414      /// Erase all the Nodes and Edges from the graph.
415      ///
416      void clear() {}   
417
418      template <typename _Graph>
419      struct Constraints {
420        void constraints() {
421          checkConcept< BaseGraphComponent, _Graph>();
422          graph.clear();
423        }
424
425        _Graph& graph;
426      };
427    };
428
429
430    /// Skeleton class for graph NodeIt and EdgeIt
431
432    /// Skeleton class for graph NodeIt and EdgeIt.
433    ///
434    template <typename _Graph, typename _Item>
435    class GraphIterator : public _Item {
436    public:
437      /// \todo Don't we need the Item type as typedef?
438
439      /// Default constructor.
440     
441      /// @warning The default constructor sets the iterator
442      /// to an undefined value.
443      GraphIterator() {}
444      /// Copy constructor.
445     
446      /// Copy constructor.
447      ///
448      GraphIterator(GraphIterator const&) {}
449      /// Sets the iterator to the first item.
450     
451      /// Sets the iterator to the first item of \c the graph.
452      ///
453      explicit GraphIterator(const _Graph&) {}
454      /// Invalid constructor \& conversion.
455
456      /// This constructor initializes the item to be invalid.
457      /// \sa Invalid for more details.
458      GraphIterator(Invalid) {}
459      /// Assign operator for items.
460
461      /// The items are assignable.
462      ///
463      GraphIterator& operator=(GraphIterator const&) { return *this; }     
464      /// Next item.
465
466      /// Assign the iterator to the next item.
467      ///
468      GraphIterator& operator++() { return *this; }
469      //        Node operator*() const { return INVALID; }
470      /// Equality operator
471
472      /// Two iterators are equal if and only if they point to the
473      /// same object or both are invalid.
474      bool operator==(const GraphIterator&) const { return true;}
475      /// Inequality operator
476       
477      /// \sa operator==(Node n)
478      ///
479      bool operator!=(const GraphIterator&) const { return true;}
480     
481      template<typename _GraphIterator>
482      struct Constraints {
483        void constraints() {
484          //      checkConcept< Item, _GraphIterator >();
485          _GraphIterator it1(g);
486       
487          /// \todo Do we need NodeIt(Node) kind of constructor?
488          //    _GraphIterator it2(bj);
489          _GraphIterator it2;
490
491          it2 = ++it1;
492          ++it2 = it1;
493          ++(++it1);
494          /// \bug This should be: is_base_and_derived<BaseItem, _GraphIterator>
495          _Item bi = it1;
496          bi = it2;
497        }
498        _Graph& g;
499      };
500    };
501
502    /// Skeleton class for graph InEdgeIt and OutEdgeIt
503
504    /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same
505    /// base class, the _selector is a additional template parameter. For
506    /// InEdgeIt you should instantiate it with character 'i' and for
507    /// OutEdgeIt with 'o'.
508    /// \todo check the name of the concept GraphIncEdgeIterator
509    template <typename _Graph, char _selector>
510    class GraphIncEdgeIterator : public _Graph::Edge {
511    public:
512      /// Default constructor.
513     
514      /// @warning The default constructor sets the iterator
515      /// to an undefined value.
516      GraphIncEdgeIterator() {}
517      /// Copy constructor.
518     
519      /// Copy constructor.
520      ///
521      GraphIncEdgeIterator(GraphIncEdgeIterator const&) {}
522      /// Sets the iterator to the first edge incoming into or outgoing from the node.
523     
524      /// Sets the iterator to the first edge incoming into or outgoing from the node.
525      ///
526      explicit GraphIncEdgeIterator(const _Graph&, const typename _Graph::Node&) {}
527      /// Invalid constructor \& conversion.
528
529      /// This constructor initializes the item to be invalid.
530      /// \sa Invalid for more details.
531      GraphIncEdgeIterator(Invalid) {}
532      /// Assign operator for nodes.
533
534      /// The nodes are assignable.
535      ///
536      GraphIncEdgeIterator& operator=(GraphIncEdgeIterator const&) { return *this; }     
537      /// Next edge.
538
539      /// Assign the iterator to the next node.
540      ///
541      GraphIncEdgeIterator& operator++() { return *this; }
542      //        Node operator*() const { return INVALID; }
543      /// Equality operator
544
545      /// Two iterators are equal if and only if they point to the
546      /// same object or both are invalid.
547      bool operator==(const GraphIncEdgeIterator&) const { return true;}
548      /// Inequality operator
549       
550      /// \sa operator==(Node n)
551      ///
552      bool operator!=(const GraphIncEdgeIterator&) const { return true;}
553
554      template <typename _GraphIncEdgeIterator>
555      struct Constraints {
556        typedef typename _Graph::Node Node;
557        typedef typename _Graph::Edge Edge;
558        void constraints() {
559          checkConcept<GraphItem<'e'>, _GraphIncEdgeIterator>();
560          _GraphIncEdgeIterator it1(graph, node);
561          /// \todo Do we need OutEdgeIt(Edge) kind of constructor?
562          //    _GraphIncEdgeIterator it2(edge);
563          _GraphIncEdgeIterator it2;
564
565          it2 = ++it1;
566          ++it2 = it1;
567          ++(++it1);
568          Edge e = it1;
569          e = it2;
570        }
571
572        Edge& edge;
573        Node& node;
574        _Graph& graph;
575      };
576    };
577    /// An empty iterable base graph class.
578 
579    /// This class provides beside the core graph features
580    /// iterator based iterable interface for the graph structure.
581    /// This concept is part of the StaticGraphConcept.
582    class IterableGraphComponent : virtual public BaseGraphComponent {
583
584    public:
585   
586      typedef IterableGraphComponent Graph;
587
588      typedef BaseGraphComponent::Node Node;
589      typedef BaseGraphComponent::Edge Edge;
590
591      /// This iterator goes through each node.
592
593      /// This iterator goes through each node.
594      ///
595      typedef GraphIterator<Graph, Node> NodeIt;
596      /// This iterator goes through each node.
597
598      /// This iterator goes through each node.
599      ///
600      typedef GraphIterator<Graph, Edge> EdgeIt;
601      /// This iterator goes trough the incoming edges of a node.
602
603      /// This iterator goes trough the \e inccoming edges of a certain node
604      /// of a graph.
605      typedef GraphIncEdgeIterator<Graph, 'i'> InEdgeIt;
606      /// This iterator goes trough the outgoing edges of a node.
607
608      /// This iterator goes trough the \e outgoing edges of a certain node
609      /// of a graph.
610      typedef GraphIncEdgeIterator<Graph, 'o'> OutEdgeIt;
611    };
612   
613    template <typename _Graph>
614    struct Constraints {
615      void constraints() {
616        checkConcept< BaseGraphComponent, _Graph>();
617
618        checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >();
619        checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >();
620        checkConcept<GraphIncEdgeIterator<_Graph, 'i'>, typename _Graph::InEdgeIt >();
621        checkConcept<GraphIncEdgeIterator<_Graph, 'o'>, typename _Graph::OutEdgeIt >();
622      }
623    };
624
625
626    template <typename Graph, typename Item, typename _Value>
627    class GraphMap : public ReadWriteMap<Item, _Value> {
628    protected:     
629      GraphMap() {}
630    public:
631      explicit GraphMap(const Graph&) {}
632      GraphMap(const Graph&, const _Value&) {}
633      GraphMap(const GraphMap&) {}
634     
635      GraphMap& operator=(const GraphMap&) { return *this;}
636
637      template<typename _Map>
638      struct Constraints {
639        void constraints() {
640          checkConcept<ReadWriteMap<Item, _Value>, _Map >();
641          // Construction with a graph parameter
642          _Map a(g);
643          // Constructor with a graph and a default value parameter
644          _Map a2(g,t);
645          // Copy constructor. Do we need it?
646          _Map b=c;
647          // Copy operator. Do we need it?
648          a=b;
649
650          ignore_unused_variable_warning(a2);
651        }
652
653        const _Map &c;
654        const Graph &g;
655        const typename GraphMap::Value &t;
656      };
657
658    };
659
660    /// An empty mappable base graph class.
661 
662    /// This class provides beside the core graph features
663    /// map interface for the graph structure.
664    /// This concept is part of the StaticGraphConcept.
665    class MappableGraphComponent : virtual public BaseGraphComponent {
666    public:
667
668      typedef MappableGraphComponent Graph;
669
670      typedef BaseGraphComponent::Node Node;
671      typedef BaseGraphComponent::Edge Edge;
672
673      /// ReadWrite map of the nodes.
674   
675      /// ReadWrite map of the nodes.
676      ///
677      template <typename _Value>
678      class NodeMap : public GraphMap<Graph, Node, _Value> {
679      private:
680        NodeMap();
681      public:
682        // \todo call the right parent class constructor
683        explicit NodeMap(const Graph&) {}
684        NodeMap(const Graph&, const _Value&) {}
685        NodeMap(const NodeMap&) {}
686
687        NodeMap& operator=(const NodeMap&) { return *this;}
688
689      };
690
691      /// ReadWrite map of the edges.
692   
693      /// ReadWrite map of the edges.
694      ///
695      template <typename _Value>
696      class EdgeMap : public GraphMap<Graph, Edge, _Value> {
697      private:
698        EdgeMap();
699      public:
700        // \todo call the right parent class constructor
701        explicit EdgeMap(const Graph&) {}
702        EdgeMap(const Graph&, const _Value&) {}
703        EdgeMap(const EdgeMap&) {}
704
705        EdgeMap& operator=(const EdgeMap&) { return *this;}
706
707      };
708
709      template <typename _Graph>
710      struct Constraints {
711
712        struct Type {
713          int value;
714          Type() : value(0) {}
715          Type(int _v) : value(_v) {}
716        };
717
718        void constraints() {
719          checkConcept<BaseGraphComponent, _Graph>();
720          { // int map test
721            typedef typename _Graph::template NodeMap<int> IntNodeMap;
722            checkConcept<GraphMap<_Graph, typename _Graph::Node, int>, IntNodeMap >();
723          } { // bool map test
724            typedef typename _Graph::template NodeMap<bool> BoolNodeMap;
725            checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>, BoolNodeMap >();
726          } { // Type map test
727            typedef typename _Graph::template NodeMap<Type> TypeNodeMap;
728            checkConcept<GraphMap<_Graph, typename _Graph::Node, Type>, TypeNodeMap >();
729          }
730
731          { // int map test
732            typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
733            checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>, IntEdgeMap >();
734          } { // bool map test
735            typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
736            checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>, BoolEdgeMap >();
737          } { // Type map test
738            typedef typename _Graph::template EdgeMap<Type> TypeEdgeMap;
739            checkConcept<GraphMap<_Graph, typename _Graph::Edge, Type>, TypeEdgeMap >();
740          }
741        }
742
743        _Graph& graph;
744      };
745    };
746
747
748    class ExtendableGraphComponent : virtual public BaseGraphComponent {
749    public:
750
751      typedef ExtendableGraphComponent Graph;
752
753      typedef BaseGraphComponent::Node Node;
754      typedef BaseGraphComponent::Edge Edge;
755
756      Node addNode() {
757        return INVALID;
758      }
759   
760      Edge addEdge(const Node& from, const Node& to) {
761        return INVALID;
762      }
763
764      template <typename _Graph>
765      struct Constraints {
766        void constraints() {
767          checkConcept<BaseGraphComponent, _Graph >();
768          typename _Graph::Node node_a, node_b;
769          node_a = graph.addNode();
770          typename _Graph::Edge edge;
771          edge = graph.addEdge(node_a, node_b);     
772        }
773        _Graph& graph;
774      };
775    };
776    class ErasableGraphComponent : virtual public BaseGraphComponent {
777    public:
778
779      typedef ErasableGraphComponent Graph;
780
781      typedef BaseGraphComponent::Node Node;
782      typedef BaseGraphComponent::Edge Edge;
783
784      void erase(const Node&) {}   
785      void erase(const Edge&) {}
786
787      template <typename _Graph>
788      struct Constraints {
789        void constraints() {
790          checkConcept<BaseGraphComponent, _Graph >();
791          typename _Graph::Node node;
792          graph.erase(node);
793          typename _Graph::Edge edge;
794          graph.erase(edge);     
795        }
796
797        _Graph& graph;
798      };
799    };
800
801    class ClearableGraphComponent : virtual public BaseGraphComponent {
802    public:
803
804      typedef ClearableGraphComponent Graph;
805
806      typedef BaseGraphComponent::Node Node;
807      typedef BaseGraphComponent::Edge Edge;
808
809      void clear() {}   
810
811
812      template <typename _Graph>
813      struct ClearableGraphComponentConcept {
814        void constraints() {
815          checkConcept< BaseGraphComponent, _Graph >();
816          graph.clear();
817        }
818        _Graph& graph;
819      };
820    };
821
822  }
823
824}
825
826#endif
Note: See TracBrowser for help on using the repository browser.