deba@57: /* -*- C++ -*- deba@57: * deba@57: * This file is a part of LEMON, a generic C++ optimization library deba@57: * alpar@107: * Copyright (C) 2003-2008 deba@57: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport deba@57: * (Egervary Research Group on Combinatorial Optimization, EGRES). deba@57: * deba@57: * Permission to use, modify and distribute this software is granted deba@57: * provided that this copyright notice appears in all copies. For deba@57: * precise terms see the accompanying LICENSE file. deba@57: * deba@57: * This software is provided "AS IS" with no warranty of any kind, deba@57: * express or implied, and with no claim as to its suitability for any deba@57: * purpose. deba@57: * deba@57: */ deba@57: deba@57: ///\ingroup graph_concepts deba@57: ///\file deba@57: ///\brief The concept of graph components. deba@57: deba@57: deba@57: #ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H deba@57: #define LEMON_CONCEPT_GRAPH_COMPONENTS_H deba@57: deba@57: #include deba@57: #include deba@57: deba@57: #include deba@57: deba@57: namespace lemon { deba@57: namespace concepts { deba@57: deba@57: /// \brief Skeleton class for graph Node and Arc types deba@57: /// deba@57: /// This class describes the interface of Node and Arc (and Edge deba@57: /// in undirected graphs) subtypes of graph types. deba@57: /// deba@57: /// \note This class is a template class so that we can use it to deba@57: /// create graph skeleton classes. The reason for this is than Node deba@57: /// and Arc types should \em not derive from the same base class. deba@57: /// For Node you should instantiate it with character 'n' and for Arc deba@57: /// with 'a'. deba@57: deba@57: #ifndef DOXYGEN deba@57: template deba@57: #endif deba@57: class GraphItem { deba@57: public: deba@57: /// \brief Default constructor. deba@57: /// deba@57: /// \warning The default constructor is not required to set deba@57: /// the item to some well-defined value. So you should consider it deba@57: /// as uninitialized. deba@57: GraphItem() {} deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy constructor. deba@57: /// deba@57: GraphItem(const GraphItem &) {} deba@57: /// \brief Invalid constructor \& conversion. deba@57: /// deba@57: /// This constructor initializes the item to be invalid. deba@57: /// \sa Invalid for more details. deba@57: GraphItem(Invalid) {} deba@57: /// \brief Assign operator for nodes. deba@57: /// deba@57: /// The nodes are assignable. deba@57: /// deba@57: GraphItem& operator=(GraphItem const&) { return *this; } deba@57: /// \brief Equality operator. deba@57: /// deba@57: /// Two iterators are equal if and only if they represents the deba@57: /// same node in the graph or both are invalid. deba@57: bool operator==(GraphItem) const { return false; } deba@57: /// \brief Inequality operator. deba@57: /// deba@57: /// \sa operator==(const Node& n) deba@57: /// deba@57: bool operator!=(GraphItem) const { return false; } deba@57: deba@57: /// \brief Artificial ordering operator. deba@57: /// deba@57: /// To allow the use of graph descriptors as key type in std::map or deba@57: /// similar associative container we require this. deba@57: /// deba@57: /// \note This operator only have to define some strict ordering of deba@57: /// the items; this order has nothing to do with the iteration deba@57: /// ordering of the items. deba@57: bool operator<(GraphItem) const { return false; } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: _GraphItem i1; deba@57: _GraphItem i2 = i1; deba@57: _GraphItem i3 = INVALID; deba@57: deba@57: i1 = i2 = i3; deba@57: deba@57: bool b; deba@57: // b = (ia == ib) && (ia != ib) && (ia < ib); deba@57: b = (ia == ib) && (ia != ib); deba@57: b = (ia == INVALID) && (ib != INVALID); deba@57: b = (ia < ib); deba@57: } deba@57: deba@57: const _GraphItem &ia; deba@57: const _GraphItem &ib; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty base directed graph class. deba@57: /// deba@57: /// This class provides the minimal set of features needed for a deba@57: /// directed graph structure. All digraph concepts have to be deba@57: /// conform to this base directed graph. It just provides types deba@57: /// for nodes and arcs and functions to get the source and the deba@57: /// target of the arcs. deba@57: class BaseDigraphComponent { deba@57: public: deba@57: deba@57: typedef BaseDigraphComponent Digraph; deba@57: deba@57: /// \brief Node class of the digraph. deba@57: /// deba@57: /// This class represents the Nodes of the digraph. deba@57: /// deba@57: typedef GraphItem<'n'> Node; deba@57: deba@57: /// \brief Arc class of the digraph. deba@57: /// deba@57: /// This class represents the Arcs of the digraph. deba@57: /// deba@57: typedef GraphItem<'e'> Arc; deba@57: deba@57: /// \brief Gives back the target node of an arc. deba@57: /// deba@57: /// Gives back the target node of an arc. deba@57: /// deba@57: Node target(const Arc&) const { return INVALID;} deba@57: deba@57: /// \brief Gives back the source node of an arc. deba@57: /// deba@57: /// Gives back the source node of an arc. deba@57: /// deba@57: Node source(const Arc&) const { return INVALID;} deba@57: deba@57: /// \brief Gives back the opposite node on the given arc. deba@57: /// deba@57: /// Gives back the opposite node on the given arc. deba@57: Node oppositeNode(const Node&, const Arc&) const { deba@57: return INVALID; deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: typedef typename _Digraph::Node Node; deba@57: typedef typename _Digraph::Arc Arc; deba@57: deba@57: void constraints() { deba@57: checkConcept, Node>(); deba@57: checkConcept, Arc>(); deba@57: { deba@57: Node n; deba@57: Arc e(INVALID); deba@57: n = digraph.source(e); deba@57: n = digraph.target(e); deba@57: n = digraph.oppositeNode(n, e); deba@57: } deba@57: } deba@57: deba@57: const _Digraph& digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty base undirected graph class. deba@57: /// deba@57: /// This class provides the minimal set of features needed for an deba@57: /// undirected graph structure. All undirected graph concepts have deba@57: /// to be conform to this base graph. It just provides types for deba@57: /// nodes, arcs and edges and functions to get the deba@57: /// source and the target of the arcs and edges, deba@57: /// conversion from arcs to edges and function to get deba@57: /// both direction of the edges. deba@57: class BaseGraphComponent : public BaseDigraphComponent { deba@57: public: deba@57: typedef BaseDigraphComponent::Node Node; deba@57: typedef BaseDigraphComponent::Arc Arc; deba@57: /// \brief Undirected arc class of the graph. deba@57: /// deba@57: /// This class represents the edges of the graph. deba@57: /// The undirected graphs can be used as a directed graph which deba@57: /// for each arc contains the opposite arc too so the graph is deba@57: /// bidirected. The edge represents two opposite deba@57: /// directed arcs. deba@57: class Edge : public GraphItem<'u'> { deba@57: public: deba@57: typedef GraphItem<'u'> Parent; deba@57: /// \brief Default constructor. deba@57: /// deba@57: /// \warning The default constructor is not required to set deba@57: /// the item to some well-defined value. So you should consider it deba@57: /// as uninitialized. deba@57: Edge() {} deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy constructor. deba@57: /// deba@57: Edge(const Edge &) : Parent() {} deba@57: /// \brief Invalid constructor \& conversion. deba@57: /// deba@57: /// This constructor initializes the item to be invalid. deba@57: /// \sa Invalid for more details. deba@57: Edge(Invalid) {} deba@57: /// \brief Converter from arc to edge. deba@57: /// deba@57: /// Besides the core graph item functionality each arc should deba@57: /// be convertible to the represented edge. deba@57: Edge(const Arc&) {} deba@57: /// \brief Assign arc to edge. deba@57: /// deba@57: /// Besides the core graph item functionality each arc should deba@57: /// be convertible to the represented edge. deba@57: Edge& operator=(const Arc&) { return *this; } deba@57: }; deba@57: deba@57: /// \brief Returns the direction of the arc. deba@57: /// deba@57: /// Returns the direction of the arc. Each arc represents an deba@57: /// edge with a direction. It gives back the deba@57: /// direction. deba@57: bool direction(const Arc&) const { return true; } deba@57: deba@57: /// \brief Returns the directed arc. deba@57: /// deba@57: /// Returns the directed arc from its direction and the deba@57: /// represented edge. deba@57: Arc direct(const Edge&, bool) const { return INVALID;} deba@57: deba@57: /// \brief Returns the directed arc. deba@57: /// deba@57: /// Returns the directed arc from its source and the deba@57: /// represented edge. deba@57: Arc direct(const Edge&, const Node&) const { return INVALID;} deba@57: deba@57: /// \brief Returns the opposite arc. deba@57: /// deba@57: /// Returns the opposite arc. It is the arc representing the deba@57: /// same edge and has opposite direction. deba@57: Arc oppositeArc(const Arc&) const { return INVALID;} deba@57: deba@57: /// \brief Gives back one ending of an edge. deba@57: /// deba@57: /// Gives back one ending of an edge. deba@57: Node u(const Edge&) const { return INVALID;} deba@57: deba@57: /// \brief Gives back the other ending of an edge. deba@57: /// deba@57: /// Gives back the other ending of an edge. deba@57: Node v(const Edge&) const { return INVALID;} deba@57: deba@57: template deba@57: struct Constraints { deba@57: typedef typename _Graph::Node Node; deba@57: typedef typename _Graph::Arc Arc; deba@57: typedef typename _Graph::Edge Edge; deba@57: deba@57: void constraints() { deba@57: checkConcept(); deba@57: checkConcept, Edge>(); deba@57: { deba@57: Node n; deba@57: Edge ue(INVALID); deba@57: Arc e; deba@57: n = graph.u(ue); deba@57: n = graph.v(ue); deba@57: e = graph.direct(ue, true); deba@57: e = graph.direct(ue, n); deba@57: e = graph.oppositeArc(e); deba@57: ue = e; deba@57: bool d = graph.direction(e); deba@57: ignore_unused_variable_warning(d); deba@57: } deba@57: } deba@57: deba@57: const _Graph& graph; deba@57: }; deba@57: deba@57: }; deba@57: deba@57: /// \brief An empty idable base digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features deba@57: /// core id functions for the digraph structure. deba@57: /// The most of the base digraphs should be conform to this concept. deba@57: /// The id's are unique and immutable. deba@57: template deba@57: class IDableDigraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: deba@57: /// \brief Gives back an unique integer id for the Node. deba@57: /// deba@57: /// Gives back an unique integer id for the Node. deba@57: /// deba@57: int id(const Node&) const { return -1;} deba@57: deba@57: /// \brief Gives back the node by the unique id. deba@57: /// deba@57: /// Gives back the node by the unique id. deba@57: /// If the digraph does not contain node with the given id deba@57: /// then the result of the function is undetermined. deba@57: Node nodeFromId(int) const { return INVALID;} deba@57: deba@57: /// \brief Gives back an unique integer id for the Arc. deba@57: /// deba@57: /// Gives back an unique integer id for the Arc. deba@57: /// deba@57: int id(const Arc&) const { return -1;} deba@57: deba@57: /// \brief Gives back the arc by the unique id. deba@57: /// deba@57: /// Gives back the arc by the unique id. deba@57: /// If the digraph does not contain arc with the given id deba@57: /// then the result of the function is undetermined. deba@57: Arc arcFromId(int) const { return INVALID;} deba@57: deba@57: /// \brief Gives back an integer greater or equal to the maximum deba@57: /// Node id. deba@57: /// deba@57: /// Gives back an integer greater or equal to the maximum Node deba@57: /// id. deba@57: int maxNodeId() const { return -1;} deba@57: deba@57: /// \brief Gives back an integer greater or equal to the maximum deba@57: /// Arc id. deba@57: /// deba@57: /// Gives back an integer greater or equal to the maximum Arc deba@57: /// id. deba@57: int maxArcId() const { return -1;} deba@57: deba@57: template deba@57: struct Constraints { deba@57: deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Digraph::Node node; deba@57: int nid = digraph.id(node); deba@57: nid = digraph.id(node); deba@57: node = digraph.nodeFromId(nid); deba@57: typename _Digraph::Arc arc; deba@57: int eid = digraph.id(arc); deba@57: eid = digraph.id(arc); deba@57: arc = digraph.arcFromId(eid); deba@57: deba@57: nid = digraph.maxNodeId(); deba@57: ignore_unused_variable_warning(nid); deba@57: eid = digraph.maxArcId(); deba@57: ignore_unused_variable_warning(eid); deba@57: } deba@57: deba@57: const _Digraph& digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty idable base undirected graph class. deba@57: /// deba@57: /// This class provides beside the core undirected graph features deba@57: /// core id functions for the undirected graph structure. The deba@57: /// most of the base undirected graphs should be conform to this deba@57: /// concept. The id's are unique and immutable. deba@57: template deba@57: class IDableGraphComponent : public IDableDigraphComponent<_Base> { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Edge Edge; deba@57: deba@57: using IDableDigraphComponent<_Base>::id; deba@57: deba@57: /// \brief Gives back an unique integer id for the Edge. deba@57: /// deba@57: /// Gives back an unique integer id for the Edge. deba@57: /// deba@57: int id(const Edge&) const { return -1;} deba@57: deba@57: /// \brief Gives back the edge by the unique id. deba@57: /// deba@57: /// Gives back the edge by the unique id. If the deba@57: /// graph does not contain arc with the given id then the deba@57: /// result of the function is undetermined. deba@57: Edge edgeFromId(int) const { return INVALID;} deba@57: deba@57: /// \brief Gives back an integer greater or equal to the maximum deba@57: /// Edge id. deba@57: /// deba@57: /// Gives back an integer greater or equal to the maximum Edge deba@57: /// id. deba@57: int maxEdgeId() const { return -1;} deba@57: deba@57: template deba@57: struct Constraints { deba@57: deba@57: void constraints() { deba@57: checkConcept(); deba@57: checkConcept, _Graph >(); deba@57: typename _Graph::Edge edge; deba@57: int ueid = graph.id(edge); deba@57: ueid = graph.id(edge); deba@57: edge = graph.edgeFromId(ueid); deba@57: ueid = graph.maxEdgeId(); deba@57: ignore_unused_variable_warning(ueid); deba@57: } deba@57: deba@57: const _Graph& graph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief Skeleton class for graph NodeIt and ArcIt deba@57: /// deba@57: /// Skeleton class for graph NodeIt and ArcIt. deba@57: /// deba@57: template deba@57: class GraphItemIt : public _Item { deba@57: public: deba@57: /// \brief Default constructor. deba@57: /// deba@57: /// @warning The default constructor sets the iterator deba@57: /// to an undefined value. deba@57: GraphItemIt() {} deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy constructor. deba@57: /// deba@57: GraphItemIt(const GraphItemIt& ) {} deba@57: /// \brief Sets the iterator to the first item. deba@57: /// deba@57: /// Sets the iterator to the first item of \c the graph. deba@57: /// deba@57: explicit GraphItemIt(const _Graph&) {} deba@57: /// \brief Invalid constructor \& conversion. deba@57: /// deba@57: /// This constructor initializes the item to be invalid. deba@57: /// \sa Invalid for more details. deba@57: GraphItemIt(Invalid) {} deba@57: /// \brief Assign operator for items. deba@57: /// deba@57: /// The items are assignable. deba@57: /// deba@57: GraphItemIt& operator=(const GraphItemIt&) { return *this; } deba@57: /// \brief Next item. deba@57: /// deba@57: /// Assign the iterator to the next item. deba@57: /// deba@57: GraphItemIt& operator++() { return *this; } deba@57: /// \brief Equality operator deba@57: /// deba@57: /// Two iterators are equal if and only if they point to the deba@57: /// same object or both are invalid. deba@57: bool operator==(const GraphItemIt&) const { return true;} deba@57: /// \brief Inequality operator deba@57: /// deba@57: /// \sa operator==(Node n) deba@57: /// deba@57: bool operator!=(const GraphItemIt&) const { return true;} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: _GraphItemIt it1(g); deba@57: _GraphItemIt it2; deba@57: deba@57: it2 = ++it1; deba@57: ++it2 = it1; deba@57: ++(++it1); deba@57: deba@57: _Item bi = it1; deba@57: bi = it2; deba@57: } deba@57: _Graph& g; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief Skeleton class for graph InArcIt and OutArcIt deba@57: /// deba@57: /// \note Because InArcIt and OutArcIt may not inherit from the same deba@57: /// base class, the _selector is a additional template parameter. For deba@57: /// InArcIt you should instantiate it with character 'i' and for deba@57: /// OutArcIt with 'o'. deba@57: template deba@57: class GraphIncIt : public _Item { deba@57: public: deba@57: /// \brief Default constructor. deba@57: /// deba@57: /// @warning The default constructor sets the iterator deba@57: /// to an undefined value. deba@57: GraphIncIt() {} deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy constructor. deba@57: /// deba@57: GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} deba@57: /// \brief Sets the iterator to the first arc incoming into or outgoing deba@57: /// from the node. deba@57: /// deba@57: /// Sets the iterator to the first arc incoming into or outgoing deba@57: /// from the node. deba@57: /// deba@57: explicit GraphIncIt(const _Graph&, const _Base&) {} deba@57: /// \brief Invalid constructor \& conversion. deba@57: /// deba@57: /// This constructor initializes the item to be invalid. deba@57: /// \sa Invalid for more details. deba@57: GraphIncIt(Invalid) {} deba@57: /// \brief Assign operator for iterators. deba@57: /// deba@57: /// The iterators are assignable. deba@57: /// deba@57: GraphIncIt& operator=(GraphIncIt const&) { return *this; } deba@57: /// \brief Next item. deba@57: /// deba@57: /// Assign the iterator to the next item. deba@57: /// deba@57: GraphIncIt& operator++() { return *this; } deba@57: deba@57: /// \brief Equality operator deba@57: /// deba@57: /// Two iterators are equal if and only if they point to the deba@57: /// same object or both are invalid. deba@57: bool operator==(const GraphIncIt&) const { return true;} deba@57: deba@57: /// \brief Inequality operator deba@57: /// deba@57: /// \sa operator==(Node n) deba@57: /// deba@57: bool operator!=(const GraphIncIt&) const { return true;} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept, _GraphIncIt>(); deba@57: _GraphIncIt it1(graph, node); deba@57: _GraphIncIt it2; deba@57: deba@57: it2 = ++it1; deba@57: ++it2 = it1; deba@57: ++(++it1); deba@57: _Item e = it1; deba@57: e = it2; deba@57: deba@57: } deba@57: deba@57: _Item arc; deba@57: _Base node; deba@57: _Graph graph; deba@57: _GraphIncIt it; deba@57: }; deba@57: }; deba@57: deba@57: deba@57: /// \brief An empty iterable digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features deba@57: /// iterator based iterable interface for the digraph structure. deba@57: /// This concept is part of the Digraph concept. deba@57: template deba@57: class IterableDigraphComponent : public _Base { deba@57: deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: deba@57: typedef IterableDigraphComponent Digraph; deba@57: deba@57: /// \name Base iteration deba@57: /// deba@57: /// This interface provides functions for iteration on digraph items deba@57: /// deba@57: /// @{ deba@57: deba@57: /// \brief Gives back the first node in the iterating order. deba@57: /// deba@57: /// Gives back the first node in the iterating order. deba@57: /// deba@57: void first(Node&) const {} deba@57: deba@57: /// \brief Gives back the next node in the iterating order. deba@57: /// deba@57: /// Gives back the next node in the iterating order. deba@57: /// deba@57: void next(Node&) const {} deba@57: deba@57: /// \brief Gives back the first arc in the iterating order. deba@57: /// deba@57: /// Gives back the first arc in the iterating order. deba@57: /// deba@57: void first(Arc&) const {} deba@57: deba@57: /// \brief Gives back the next arc in the iterating order. deba@57: /// deba@57: /// Gives back the next arc in the iterating order. deba@57: /// deba@57: void next(Arc&) const {} deba@57: deba@57: deba@57: /// \brief Gives back the first of the arcs point to the given deba@57: /// node. deba@57: /// deba@57: /// Gives back the first of the arcs point to the given node. deba@57: /// deba@57: void firstIn(Arc&, const Node&) const {} deba@57: deba@57: /// \brief Gives back the next of the arcs points to the given deba@57: /// node. deba@57: /// deba@57: /// Gives back the next of the arcs points to the given node. deba@57: /// deba@57: void nextIn(Arc&) const {} deba@57: deba@57: /// \brief Gives back the first of the arcs start from the deba@57: /// given node. deba@57: /// deba@57: /// Gives back the first of the arcs start from the given node. deba@57: /// deba@57: void firstOut(Arc&, const Node&) const {} deba@57: deba@57: /// \brief Gives back the next of the arcs start from the given deba@57: /// node. deba@57: /// deba@57: /// Gives back the next of the arcs start from the given node. deba@57: /// deba@57: void nextOut(Arc&) const {} deba@57: deba@57: /// @} deba@57: deba@57: /// \name Class based iteration deba@57: /// deba@57: /// This interface provides functions for iteration on digraph items deba@57: /// deba@57: /// @{ deba@57: deba@57: /// \brief This iterator goes through each node. deba@57: /// deba@57: /// This iterator goes through each node. deba@57: /// deba@57: typedef GraphItemIt NodeIt; deba@57: deba@57: /// \brief This iterator goes through each node. deba@57: /// deba@57: /// This iterator goes through each node. deba@57: /// deba@57: typedef GraphItemIt ArcIt; deba@57: deba@57: /// \brief This iterator goes trough the incoming arcs of a node. deba@57: /// deba@57: /// This iterator goes trough the \e inccoming arcs of a certain node deba@57: /// of a digraph. deba@57: typedef GraphIncIt InArcIt; deba@57: deba@57: /// \brief This iterator goes trough the outgoing arcs of a node. deba@57: /// deba@57: /// This iterator goes trough the \e outgoing arcs of a certain node deba@57: /// of a digraph. deba@57: typedef GraphIncIt OutArcIt; deba@57: deba@57: /// \brief The base node of the iterator. deba@57: /// deba@57: /// Gives back the base node of the iterator. deba@57: /// It is always the target of the pointed arc. deba@57: Node baseNode(const InArcIt&) const { return INVALID; } deba@57: deba@57: /// \brief The running node of the iterator. deba@57: /// deba@57: /// Gives back the running node of the iterator. deba@57: /// It is always the source of the pointed arc. deba@57: Node runningNode(const InArcIt&) const { return INVALID; } deba@57: deba@57: /// \brief The base node of the iterator. deba@57: /// deba@57: /// Gives back the base node of the iterator. deba@57: /// It is always the source of the pointed arc. deba@57: Node baseNode(const OutArcIt&) const { return INVALID; } deba@57: deba@57: /// \brief The running node of the iterator. deba@57: /// deba@57: /// Gives back the running node of the iterator. deba@57: /// It is always the target of the pointed arc. deba@57: Node runningNode(const OutArcIt&) const { return INVALID; } deba@57: deba@57: /// @} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: deba@57: { deba@57: typename _Digraph::Node node(INVALID); deba@57: typename _Digraph::Arc arc(INVALID); deba@57: { deba@57: digraph.first(node); deba@57: digraph.next(node); deba@57: } deba@57: { deba@57: digraph.first(arc); deba@57: digraph.next(arc); deba@57: } deba@57: { deba@57: digraph.firstIn(arc, node); deba@57: digraph.nextIn(arc); deba@57: } deba@57: { deba@57: digraph.firstOut(arc, node); deba@57: digraph.nextOut(arc); deba@57: } deba@57: } deba@57: deba@57: { deba@57: checkConcept, deba@57: typename _Digraph::ArcIt >(); deba@57: checkConcept, deba@57: typename _Digraph::NodeIt >(); deba@57: checkConcept, typename _Digraph::InArcIt>(); deba@57: checkConcept, typename _Digraph::OutArcIt>(); deba@57: deba@57: typename _Digraph::Node n; deba@57: typename _Digraph::InArcIt ieit(INVALID); deba@57: typename _Digraph::OutArcIt oeit(INVALID); deba@57: n = digraph.baseNode(ieit); deba@57: n = digraph.runningNode(ieit); deba@57: n = digraph.baseNode(oeit); deba@57: n = digraph.runningNode(oeit); deba@57: ignore_unused_variable_warning(n); deba@57: } deba@57: } deba@57: deba@57: const _Digraph& digraph; deba@57: deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty iterable undirected graph class. deba@57: /// deba@57: /// This class provides beside the core graph features iterator deba@57: /// based iterable interface for the undirected graph structure. deba@57: /// This concept is part of the Graph concept. deba@57: template deba@57: class IterableGraphComponent : public IterableDigraphComponent<_Base> { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: typedef typename Base::Edge Edge; deba@57: deba@57: deba@57: typedef IterableGraphComponent Graph; deba@57: deba@57: /// \name Base iteration deba@57: /// deba@57: /// This interface provides functions for iteration on graph items deba@57: /// @{ deba@57: deba@57: using IterableDigraphComponent<_Base>::first; deba@57: using IterableDigraphComponent<_Base>::next; deba@57: deba@57: /// \brief Gives back the first edge in the iterating deba@57: /// order. deba@57: /// deba@57: /// Gives back the first edge in the iterating order. deba@57: /// deba@57: void first(Edge&) const {} deba@57: deba@57: /// \brief Gives back the next edge in the iterating deba@57: /// order. deba@57: /// deba@57: /// Gives back the next edge in the iterating order. deba@57: /// deba@57: void next(Edge&) const {} deba@57: deba@57: deba@57: /// \brief Gives back the first of the edges from the deba@57: /// given node. deba@57: /// deba@57: /// Gives back the first of the edges from the given deba@57: /// node. The bool parameter gives back that direction which deba@57: /// gives a good direction of the edge so the source of the deba@57: /// directed arc is the given node. deba@57: void firstInc(Edge&, bool&, const Node&) const {} deba@57: deba@57: /// \brief Gives back the next of the edges from the deba@57: /// given node. deba@57: /// deba@57: /// Gives back the next of the edges from the given deba@57: /// node. The bool parameter should be used as the \c firstInc() deba@57: /// use it. deba@57: void nextInc(Edge&, bool&) const {} deba@57: deba@57: using IterableDigraphComponent<_Base>::baseNode; deba@57: using IterableDigraphComponent<_Base>::runningNode; deba@57: deba@57: /// @} deba@57: deba@57: /// \name Class based iteration deba@57: /// deba@57: /// This interface provides functions for iteration on graph items deba@57: /// deba@57: /// @{ deba@57: deba@57: /// \brief This iterator goes through each node. deba@57: /// deba@57: /// This iterator goes through each node. deba@57: typedef GraphItemIt EdgeIt; deba@57: /// \brief This iterator goes trough the incident arcs of a deba@57: /// node. deba@57: /// deba@57: /// This iterator goes trough the incident arcs of a certain deba@57: /// node of a graph. deba@78: typedef GraphIncIt IncEdgeIt; deba@57: /// \brief The base node of the iterator. deba@57: /// deba@57: /// Gives back the base node of the iterator. deba@78: Node baseNode(const IncEdgeIt&) const { return INVALID; } deba@57: deba@57: /// \brief The running node of the iterator. deba@57: /// deba@57: /// Gives back the running node of the iterator. deba@78: Node runningNode(const IncEdgeIt&) const { return INVALID; } deba@57: deba@57: /// @} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept, _Graph>(); deba@57: deba@57: { deba@57: typename _Graph::Node node(INVALID); deba@57: typename _Graph::Edge edge(INVALID); deba@57: bool dir; deba@57: { deba@57: graph.first(edge); deba@57: graph.next(edge); deba@57: } deba@57: { deba@57: graph.firstInc(edge, dir, node); deba@57: graph.nextInc(edge, dir); deba@57: } deba@57: deba@57: } deba@57: deba@57: { deba@57: checkConcept, deba@57: typename _Graph::EdgeIt >(); deba@57: checkConcept, typename _Graph::IncEdgeIt>(); deba@57: deba@57: typename _Graph::Node n; deba@78: typename _Graph::IncEdgeIt ueit(INVALID); deba@57: n = graph.baseNode(ueit); deba@57: n = graph.runningNode(ueit); deba@57: } deba@57: } deba@57: deba@57: const _Graph& graph; deba@57: deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty alteration notifier digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features alteration deba@57: /// notifier interface for the digraph structure. This implements deba@57: /// an observer-notifier pattern for each digraph item. More deba@57: /// obsevers can be registered into the notifier and whenever an deba@57: /// alteration occured in the digraph all the observers will deba@57: /// notified about it. deba@57: template deba@57: class AlterableDigraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: deba@57: deba@57: /// The node observer registry. deba@57: typedef AlterationNotifier deba@57: NodeNotifier; deba@57: /// The arc observer registry. deba@57: typedef AlterationNotifier deba@57: ArcNotifier; deba@57: deba@57: /// \brief Gives back the node alteration notifier. deba@57: /// deba@57: /// Gives back the node alteration notifier. deba@57: NodeNotifier& notifier(Node) const { deba@57: return NodeNotifier(); deba@57: } deba@57: deba@57: /// \brief Gives back the arc alteration notifier. deba@57: /// deba@57: /// Gives back the arc alteration notifier. deba@57: ArcNotifier& notifier(Arc) const { deba@57: return ArcNotifier(); deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Digraph::NodeNotifier& nn deba@57: = digraph.notifier(typename _Digraph::Node()); deba@57: deba@57: typename _Digraph::ArcNotifier& en deba@57: = digraph.notifier(typename _Digraph::Arc()); deba@57: deba@57: ignore_unused_variable_warning(nn); deba@57: ignore_unused_variable_warning(en); deba@57: } deba@57: deba@57: const _Digraph& digraph; deba@57: deba@57: }; deba@57: deba@57: }; deba@57: deba@57: /// \brief An empty alteration notifier undirected graph class. deba@57: /// deba@57: /// This class provides beside the core graph features alteration deba@57: /// notifier interface for the graph structure. This implements deba@57: /// an observer-notifier pattern for each graph item. More deba@57: /// obsevers can be registered into the notifier and whenever an deba@57: /// alteration occured in the graph all the observers will deba@57: /// notified about it. deba@57: template deba@57: class AlterableGraphComponent : public AlterableDigraphComponent<_Base> { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Edge Edge; deba@57: deba@57: deba@57: /// The arc observer registry. deba@57: typedef AlterationNotifier deba@57: EdgeNotifier; deba@57: deba@57: /// \brief Gives back the arc alteration notifier. deba@57: /// deba@57: /// Gives back the arc alteration notifier. deba@57: EdgeNotifier& notifier(Edge) const { deba@57: return EdgeNotifier(); deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept, _Graph>(); deba@57: typename _Graph::EdgeNotifier& uen deba@57: = graph.notifier(typename _Graph::Edge()); deba@57: ignore_unused_variable_warning(uen); deba@57: } deba@57: deba@57: const _Graph& graph; deba@57: deba@57: }; deba@57: deba@57: }; deba@57: deba@57: /// \brief Class describing the concept of graph maps deba@57: /// deba@57: /// This class describes the common interface of the graph maps deba@57: /// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to deba@57: /// associate data to graph descriptors (nodes or arcs). deba@57: template deba@57: class GraphMap : public ReadWriteMap<_Item, _Value> { deba@57: public: deba@57: deba@57: typedef ReadWriteMap<_Item, _Value> Parent; deba@57: deba@57: /// The graph type of the map. deba@57: typedef _Graph Graph; deba@57: /// The key type of the map. deba@57: typedef _Item Key; deba@57: /// The value type of the map. deba@57: typedef _Value Value; deba@57: deba@57: /// \brief Construct a new map. deba@57: /// deba@57: /// Construct a new map for the graph. deba@57: explicit GraphMap(const Graph&) {} deba@57: /// \brief Construct a new map with default value. deba@57: /// deba@57: /// Construct a new map for the graph and initalise the values. deba@57: GraphMap(const Graph&, const Value&) {} deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy Constructor. deba@57: GraphMap(const GraphMap&) : Parent() {} deba@57: deba@57: /// \brief Assign operator. deba@57: /// deba@57: /// Assign operator. It does not mofify the underlying graph, deba@57: /// it just iterates on the current item set and set the map deba@57: /// with the value returned by the assigned map. deba@57: template deba@57: GraphMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); deba@57: return *this; deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept, _Map >(); deba@57: // Construction with a graph parameter deba@57: _Map a(g); deba@57: // Constructor with a graph and a default value parameter deba@57: _Map a2(g,t); deba@57: // Copy constructor. deba@57: _Map b(c); deba@57: deba@57: ReadMap cmap; deba@57: b = cmap; deba@57: deba@57: ignore_unused_variable_warning(a2); deba@57: ignore_unused_variable_warning(b); deba@57: } deba@57: deba@57: const _Map &c; deba@57: const Graph &g; deba@57: const typename GraphMap::Value &t; deba@57: }; deba@57: deba@57: }; deba@57: deba@57: /// \brief An empty mappable digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features deba@57: /// map interface for the digraph structure. deba@57: /// This concept is part of the Digraph concept. deba@57: template deba@57: class MappableDigraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: deba@57: typedef MappableDigraphComponent Digraph; deba@57: deba@57: /// \brief ReadWrite map of the nodes. deba@57: /// deba@57: /// ReadWrite map of the nodes. deba@57: /// deba@57: template deba@57: class NodeMap : public GraphMap { deba@57: public: deba@57: typedef GraphMap Parent; deba@57: deba@57: /// \brief Construct a new map. deba@57: /// deba@57: /// Construct a new map for the digraph. deba@57: explicit NodeMap(const MappableDigraphComponent& digraph) deba@57: : Parent(digraph) {} deba@57: deba@57: /// \brief Construct a new map with default value. deba@57: /// deba@57: /// Construct a new map for the digraph and initalise the values. deba@57: NodeMap(const MappableDigraphComponent& digraph, const _Value& value) deba@57: : Parent(digraph, value) {} deba@57: deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy Constructor. deba@57: NodeMap(const NodeMap& nm) : Parent(nm) {} deba@57: deba@57: /// \brief Assign operator. deba@57: /// deba@57: /// Assign operator. deba@57: template deba@57: NodeMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); deba@57: return *this; deba@57: } deba@57: deba@57: }; deba@57: deba@57: /// \brief ReadWrite map of the arcs. deba@57: /// deba@57: /// ReadWrite map of the arcs. deba@57: /// deba@57: template deba@57: class ArcMap : public GraphMap { deba@57: public: deba@57: typedef GraphMap Parent; deba@57: deba@57: /// \brief Construct a new map. deba@57: /// deba@57: /// Construct a new map for the digraph. deba@57: explicit ArcMap(const MappableDigraphComponent& digraph) deba@57: : Parent(digraph) {} deba@57: deba@57: /// \brief Construct a new map with default value. deba@57: /// deba@57: /// Construct a new map for the digraph and initalise the values. deba@57: ArcMap(const MappableDigraphComponent& digraph, const _Value& value) deba@57: : Parent(digraph, value) {} deba@57: deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy Constructor. deba@57: ArcMap(const ArcMap& nm) : Parent(nm) {} deba@57: deba@57: /// \brief Assign operator. deba@57: /// deba@57: /// Assign operator. deba@57: template deba@57: ArcMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); deba@57: return *this; deba@57: } deba@57: deba@57: }; deba@57: deba@57: deba@57: template deba@57: struct Constraints { deba@57: deba@57: struct Dummy { deba@57: int value; deba@57: Dummy() : value(0) {} deba@57: Dummy(int _v) : value(_v) {} deba@57: }; deba@57: deba@57: void constraints() { deba@57: checkConcept(); deba@57: { // int map test deba@57: typedef typename _Digraph::template NodeMap IntNodeMap; deba@57: checkConcept, deba@57: IntNodeMap >(); deba@57: } { // bool map test deba@57: typedef typename _Digraph::template NodeMap BoolNodeMap; deba@57: checkConcept, deba@57: BoolNodeMap >(); deba@57: } { // Dummy map test deba@57: typedef typename _Digraph::template NodeMap DummyNodeMap; deba@57: checkConcept, deba@57: DummyNodeMap >(); deba@57: } deba@57: deba@57: { // int map test deba@57: typedef typename _Digraph::template ArcMap IntArcMap; deba@57: checkConcept, deba@57: IntArcMap >(); deba@57: } { // bool map test deba@57: typedef typename _Digraph::template ArcMap BoolArcMap; deba@57: checkConcept, deba@57: BoolArcMap >(); deba@57: } { // Dummy map test deba@57: typedef typename _Digraph::template ArcMap DummyArcMap; deba@57: checkConcept, deba@57: DummyArcMap >(); deba@57: } deba@57: } deba@57: deba@57: _Digraph& digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty mappable base bipartite graph class. deba@57: /// deba@57: /// This class provides beside the core graph features deba@57: /// map interface for the graph structure. deba@57: /// This concept is part of the Graph concept. deba@57: template deba@57: class MappableGraphComponent : public MappableDigraphComponent<_Base> { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Edge Edge; deba@57: deba@57: typedef MappableGraphComponent Graph; deba@57: deba@57: /// \brief ReadWrite map of the edges. deba@57: /// deba@57: /// ReadWrite map of the edges. deba@57: /// deba@57: template deba@57: class EdgeMap : public GraphMap { deba@57: public: deba@57: typedef GraphMap Parent; deba@57: deba@57: /// \brief Construct a new map. deba@57: /// deba@57: /// Construct a new map for the graph. deba@57: explicit EdgeMap(const MappableGraphComponent& graph) deba@57: : Parent(graph) {} deba@57: deba@57: /// \brief Construct a new map with default value. deba@57: /// deba@57: /// Construct a new map for the graph and initalise the values. deba@57: EdgeMap(const MappableGraphComponent& graph, const _Value& value) deba@57: : Parent(graph, value) {} deba@57: deba@57: /// \brief Copy constructor. deba@57: /// deba@57: /// Copy Constructor. deba@57: EdgeMap(const EdgeMap& nm) : Parent(nm) {} deba@57: deba@57: /// \brief Assign operator. deba@57: /// deba@57: /// Assign operator. deba@57: template deba@57: EdgeMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); deba@57: return *this; deba@57: } deba@57: deba@57: }; deba@57: deba@57: deba@57: template deba@57: struct Constraints { deba@57: deba@57: struct Dummy { deba@57: int value; deba@57: Dummy() : value(0) {} deba@57: Dummy(int _v) : value(_v) {} deba@57: }; deba@57: deba@57: void constraints() { deba@57: checkConcept, _Graph>(); deba@57: deba@57: { // int map test deba@57: typedef typename _Graph::template EdgeMap IntEdgeMap; deba@57: checkConcept, deba@57: IntEdgeMap >(); deba@57: } { // bool map test deba@57: typedef typename _Graph::template EdgeMap BoolEdgeMap; deba@57: checkConcept, deba@57: BoolEdgeMap >(); deba@57: } { // Dummy map test deba@57: typedef typename _Graph::template EdgeMap DummyEdgeMap; deba@57: checkConcept, deba@57: DummyEdgeMap >(); deba@57: } deba@57: } deba@57: deba@57: _Graph& graph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty extendable digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features digraph deba@57: /// extendable interface for the digraph structure. The main deba@57: /// difference between the base and this interface is that the deba@57: /// digraph alterations should handled already on this level. deba@57: template deba@57: class ExtendableDigraphComponent : public _Base { deba@57: public: deba@57: typedef _Base Base; deba@57: deba@57: typedef typename _Base::Node Node; deba@57: typedef typename _Base::Arc Arc; deba@57: deba@57: /// \brief Adds a new node to the digraph. deba@57: /// deba@57: /// Adds a new node to the digraph. deba@57: /// deba@57: Node addNode() { deba@57: return INVALID; deba@57: } deba@57: deba@57: /// \brief Adds a new arc connects the given two nodes. deba@57: /// deba@57: /// Adds a new arc connects the the given two nodes. deba@57: Arc addArc(const Node&, const Node&) { deba@57: return INVALID; deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Digraph::Node node_a, node_b; deba@57: node_a = digraph.addNode(); deba@57: node_b = digraph.addNode(); deba@57: typename _Digraph::Arc arc; deba@57: arc = digraph.addArc(node_a, node_b); deba@57: } deba@57: deba@57: _Digraph& digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty extendable base undirected graph class. deba@57: /// deba@57: /// This class provides beside the core undirected graph features deba@57: /// core undircted graph extend interface for the graph structure. deba@57: /// The main difference between the base and this interface is deba@57: /// that the graph alterations should handled already on this deba@57: /// level. deba@57: template deba@57: class ExtendableGraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename _Base::Node Node; deba@57: typedef typename _Base::Edge Edge; deba@57: deba@57: /// \brief Adds a new node to the graph. deba@57: /// deba@57: /// Adds a new node to the graph. deba@57: /// deba@57: Node addNode() { deba@57: return INVALID; deba@57: } deba@57: deba@57: /// \brief Adds a new arc connects the given two nodes. deba@57: /// deba@57: /// Adds a new arc connects the the given two nodes. deba@57: Edge addArc(const Node&, const Node&) { deba@57: return INVALID; deba@57: } deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Graph::Node node_a, node_b; deba@57: node_a = graph.addNode(); deba@57: node_b = graph.addNode(); deba@57: typename _Graph::Edge edge; deba@57: edge = graph.addEdge(node_a, node_b); deba@57: } deba@57: deba@57: _Graph& graph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty erasable digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features core erase deba@57: /// functions for the digraph structure. The main difference between deba@57: /// the base and this interface is that the digraph alterations deba@57: /// should handled already on this level. deba@57: template deba@57: class ErasableDigraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Arc Arc; deba@57: deba@57: /// \brief Erase a node from the digraph. deba@57: /// deba@57: /// Erase a node from the digraph. This function should deba@57: /// erase all arcs connecting to the node. deba@57: void erase(const Node&) {} deba@57: deba@57: /// \brief Erase an arc from the digraph. deba@57: /// deba@57: /// Erase an arc from the digraph. deba@57: /// deba@57: void erase(const Arc&) {} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Digraph::Node node; deba@57: digraph.erase(node); deba@57: typename _Digraph::Arc arc; deba@57: digraph.erase(arc); deba@57: } deba@57: deba@57: _Digraph& digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty erasable base undirected graph class. deba@57: /// deba@57: /// This class provides beside the core undirected graph features deba@57: /// core erase functions for the undirceted graph structure. The deba@57: /// main difference between the base and this interface is that deba@57: /// the graph alterations should handled already on this level. deba@57: template deba@57: class ErasableGraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: typedef typename Base::Node Node; deba@57: typedef typename Base::Edge Edge; deba@57: deba@57: /// \brief Erase a node from the graph. deba@57: /// deba@57: /// Erase a node from the graph. This function should erase deba@57: /// arcs connecting to the node. deba@57: void erase(const Node&) {} deba@57: deba@57: /// \brief Erase an arc from the graph. deba@57: /// deba@57: /// Erase an arc from the graph. deba@57: /// deba@57: void erase(const Edge&) {} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: typename _Graph::Node node; deba@57: graph.erase(node); deba@57: typename _Graph::Arc arc; deba@57: graph.erase(arc); deba@57: } deba@57: deba@57: _Graph& graph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty clearable base digraph class. deba@57: /// deba@57: /// This class provides beside the core digraph features core clear deba@57: /// functions for the digraph structure. The main difference between deba@57: /// the base and this interface is that the digraph alterations deba@57: /// should handled already on this level. deba@57: template deba@57: class ClearableDigraphComponent : public _Base { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: deba@57: /// \brief Erase all nodes and arcs from the digraph. deba@57: /// deba@57: /// Erase all nodes and arcs from the digraph. deba@57: /// deba@57: void clear() {} deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept(); deba@57: digraph.clear(); deba@57: } deba@57: deba@57: _Digraph digraph; deba@57: }; deba@57: }; deba@57: deba@57: /// \brief An empty clearable base undirected graph class. deba@57: /// deba@57: /// This class provides beside the core undirected graph features deba@57: /// core clear functions for the undirected graph structure. The deba@57: /// main difference between the base and this interface is that deba@57: /// the graph alterations should handled already on this level. deba@57: template deba@57: class ClearableGraphComponent : public ClearableDigraphComponent<_Base> { deba@57: public: deba@57: deba@57: typedef _Base Base; deba@57: deba@57: template deba@57: struct Constraints { deba@57: void constraints() { deba@57: checkConcept, _Graph>(); deba@57: } deba@57: deba@57: _Graph graph; deba@57: }; deba@57: }; deba@57: deba@57: } deba@57: deba@57: } deba@57: deba@57: #endif