1.1 --- a/lemon/concepts/graph_components.h Mon Jan 12 23:11:39 2009 +0100
1.2 +++ b/lemon/concepts/graph_components.h Thu Nov 05 15:48:01 2009 +0100
1.3 @@ -20,9 +20,8 @@
1.4 ///\file
1.5 ///\brief The concept of graph components.
1.6
1.7 -
1.8 -#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
1.9 -#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
1.10 +#ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H
1.11 +#define LEMON_CONCEPTS_GRAPH_COMPONENTS_H
1.12
1.13 #include <lemon/core.h>
1.14 #include <lemon/concepts/maps.h>
1.15 @@ -32,75 +31,83 @@
1.16 namespace lemon {
1.17 namespace concepts {
1.18
1.19 - /// \brief Skeleton class for graph Node and Arc types
1.20 + /// \brief Concept class for \c Node, \c Arc and \c Edge types.
1.21 ///
1.22 - /// This class describes the interface of Node and Arc (and Edge
1.23 - /// in undirected graphs) subtypes of graph types.
1.24 + /// This class describes the concept of \c Node, \c Arc and \c Edge
1.25 + /// subtypes of digraph and graph types.
1.26 ///
1.27 /// \note This class is a template class so that we can use it to
1.28 - /// create graph skeleton classes. The reason for this is than Node
1.29 - /// and Arc types should \em not derive from the same base class.
1.30 - /// For Node you should instantiate it with character 'n' and for Arc
1.31 - /// with 'a'.
1.32 -
1.33 + /// create graph skeleton classes. The reason for this is that \c Node
1.34 + /// and \c Arc (or \c Edge) types should \e not derive from the same
1.35 + /// base class. For \c Node you should instantiate it with character
1.36 + /// \c 'n', for \c Arc with \c 'a' and for \c Edge with \c 'e'.
1.37 #ifndef DOXYGEN
1.38 - template <char _selector = '0'>
1.39 + template <char sel = '0'>
1.40 #endif
1.41 class GraphItem {
1.42 public:
1.43 /// \brief Default constructor.
1.44 ///
1.45 + /// Default constructor.
1.46 /// \warning The default constructor is not required to set
1.47 /// the item to some well-defined value. So you should consider it
1.48 /// as uninitialized.
1.49 GraphItem() {}
1.50 +
1.51 /// \brief Copy constructor.
1.52 ///
1.53 /// Copy constructor.
1.54 + GraphItem(const GraphItem &) {}
1.55 +
1.56 + /// \brief Constructor for conversion from \c INVALID.
1.57 ///
1.58 - GraphItem(const GraphItem &) {}
1.59 - /// \brief Invalid constructor \& conversion.
1.60 - ///
1.61 - /// This constructor initializes the item to be invalid.
1.62 + /// Constructor for conversion from \c INVALID.
1.63 + /// It initializes the item to be invalid.
1.64 /// \sa Invalid for more details.
1.65 GraphItem(Invalid) {}
1.66 - /// \brief Assign operator for nodes.
1.67 +
1.68 + /// \brief Assignment operator.
1.69 ///
1.70 - /// The nodes are assignable.
1.71 + /// Assignment operator for the item.
1.72 + GraphItem& operator=(const GraphItem&) { return *this; }
1.73 +
1.74 + /// \brief Assignment operator for INVALID.
1.75 ///
1.76 - GraphItem& operator=(GraphItem const&) { return *this; }
1.77 + /// This operator makes the item invalid.
1.78 + GraphItem& operator=(Invalid) { return *this; }
1.79 +
1.80 /// \brief Equality operator.
1.81 ///
1.82 - /// Two iterators are equal if and only if they represents the
1.83 - /// same node in the graph or both are invalid.
1.84 - bool operator==(GraphItem) const { return false; }
1.85 + /// Equality operator.
1.86 + bool operator==(const GraphItem&) const { return false; }
1.87 +
1.88 /// \brief Inequality operator.
1.89 ///
1.90 - /// \sa operator==(const Node& n)
1.91 + /// Inequality operator.
1.92 + bool operator!=(const GraphItem&) const { return false; }
1.93 +
1.94 + /// \brief Ordering operator.
1.95 ///
1.96 - bool operator!=(GraphItem) const { return false; }
1.97 -
1.98 - /// \brief Artificial ordering operator.
1.99 + /// This operator defines an ordering of the items.
1.100 + /// It makes possible to use graph item types as key types in
1.101 + /// associative containers (e.g. \c std::map).
1.102 ///
1.103 - /// To allow the use of graph descriptors as key type in std::map or
1.104 - /// similar associative container we require this.
1.105 - ///
1.106 - /// \note This operator only have to define some strict ordering of
1.107 + /// \note This operator only has to define some strict ordering of
1.108 /// the items; this order has nothing to do with the iteration
1.109 /// ordering of the items.
1.110 - bool operator<(GraphItem) const { return false; }
1.111 + bool operator<(const GraphItem&) const { return false; }
1.112
1.113 template<typename _GraphItem>
1.114 struct Constraints {
1.115 void constraints() {
1.116 _GraphItem i1;
1.117 + i1=INVALID;
1.118 _GraphItem i2 = i1;
1.119 _GraphItem i3 = INVALID;
1.120
1.121 i1 = i2 = i3;
1.122
1.123 bool b;
1.124 - // b = (ia == ib) && (ia != ib) && (ia < ib);
1.125 b = (ia == ib) && (ia != ib);
1.126 b = (ia == INVALID) && (ib != INVALID);
1.127 b = (ia < ib);
1.128 @@ -111,13 +118,12 @@
1.129 };
1.130 };
1.131
1.132 - /// \brief An empty base directed graph class.
1.133 + /// \brief Base skeleton class for directed graphs.
1.134 ///
1.135 - /// This class provides the minimal set of features needed for a
1.136 - /// directed graph structure. All digraph concepts have to be
1.137 - /// conform to this base directed graph. It just provides types
1.138 - /// for nodes and arcs and functions to get the source and the
1.139 - /// target of the arcs.
1.140 + /// This class describes the base interface of directed graph types.
1.141 + /// All digraph %concepts have to conform to this class.
1.142 + /// It just provides types for nodes and arcs and functions
1.143 + /// to get the source and the target nodes of arcs.
1.144 class BaseDigraphComponent {
1.145 public:
1.146
1.147 @@ -125,31 +131,27 @@
1.148
1.149 /// \brief Node class of the digraph.
1.150 ///
1.151 - /// This class represents the Nodes of the digraph.
1.152 - ///
1.153 + /// This class represents the nodes of the digraph.
1.154 typedef GraphItem<'n'> Node;
1.155
1.156 /// \brief Arc class of the digraph.
1.157 ///
1.158 - /// This class represents the Arcs of the digraph.
1.159 + /// This class represents the arcs of the digraph.
1.160 + typedef GraphItem<'a'> Arc;
1.161 +
1.162 + /// \brief Return the source node of an arc.
1.163 ///
1.164 - typedef GraphItem<'e'> Arc;
1.165 + /// This function returns the source node of an arc.
1.166 + Node source(const Arc&) const { return INVALID; }
1.167
1.168 - /// \brief Gives back the target node of an arc.
1.169 + /// \brief Return the target node of an arc.
1.170 ///
1.171 - /// Gives back the target node of an arc.
1.172 + /// This function returns the target node of an arc.
1.173 + Node target(const Arc&) const { return INVALID; }
1.174 +
1.175 + /// \brief Return the opposite node on the given arc.
1.176 ///
1.177 - Node target(const Arc&) const { return INVALID;}
1.178 -
1.179 - /// \brief Gives back the source node of an arc.
1.180 - ///
1.181 - /// Gives back the source node of an arc.
1.182 - ///
1.183 - Node source(const Arc&) const { return INVALID;}
1.184 -
1.185 - /// \brief Gives back the opposite node on the given arc.
1.186 - ///
1.187 - /// Gives back the opposite node on the given arc.
1.188 + /// This function returns the opposite node on the given arc.
1.189 Node oppositeNode(const Node&, const Arc&) const {
1.190 return INVALID;
1.191 }
1.192 @@ -175,91 +177,92 @@
1.193 };
1.194 };
1.195
1.196 - /// \brief An empty base undirected graph class.
1.197 + /// \brief Base skeleton class for undirected graphs.
1.198 ///
1.199 - /// This class provides the minimal set of features needed for an
1.200 - /// undirected graph structure. All undirected graph concepts have
1.201 - /// to be conform to this base graph. It just provides types for
1.202 - /// nodes, arcs and edges and functions to get the
1.203 - /// source and the target of the arcs and edges,
1.204 - /// conversion from arcs to edges and function to get
1.205 - /// both direction of the edges.
1.206 + /// This class describes the base interface of undirected graph types.
1.207 + /// All graph %concepts have to conform to this class.
1.208 + /// It extends the interface of \ref BaseDigraphComponent with an
1.209 + /// \c Edge type and functions to get the end nodes of edges,
1.210 + /// to convert from arcs to edges and to get both direction of edges.
1.211 class BaseGraphComponent : public BaseDigraphComponent {
1.212 public:
1.213 +
1.214 + typedef BaseGraphComponent Graph;
1.215 +
1.216 typedef BaseDigraphComponent::Node Node;
1.217 typedef BaseDigraphComponent::Arc Arc;
1.218 - /// \brief Undirected arc class of the graph.
1.219 +
1.220 + /// \brief Undirected edge class of the graph.
1.221 ///
1.222 - /// This class represents the edges of the graph.
1.223 - /// The undirected graphs can be used as a directed graph which
1.224 - /// for each arc contains the opposite arc too so the graph is
1.225 - /// bidirected. The edge represents two opposite
1.226 - /// directed arcs.
1.227 - class Edge : public GraphItem<'u'> {
1.228 + /// This class represents the undirected edges of the graph.
1.229 + /// Undirected graphs can be used as directed graphs, each edge is
1.230 + /// represented by two opposite directed arcs.
1.231 + class Edge : public GraphItem<'e'> {
1.232 + typedef GraphItem<'e'> Parent;
1.233 +
1.234 public:
1.235 - typedef GraphItem<'u'> Parent;
1.236 /// \brief Default constructor.
1.237 ///
1.238 + /// Default constructor.
1.239 /// \warning The default constructor is not required to set
1.240 /// the item to some well-defined value. So you should consider it
1.241 /// as uninitialized.
1.242 Edge() {}
1.243 +
1.244 /// \brief Copy constructor.
1.245 ///
1.246 /// Copy constructor.
1.247 + Edge(const Edge &) : Parent() {}
1.248 +
1.249 + /// \brief Constructor for conversion from \c INVALID.
1.250 ///
1.251 - Edge(const Edge &) : Parent() {}
1.252 - /// \brief Invalid constructor \& conversion.
1.253 - ///
1.254 - /// This constructor initializes the item to be invalid.
1.255 + /// Constructor for conversion from \c INVALID.
1.256 + /// It initializes the item to be invalid.
1.257 /// \sa Invalid for more details.
1.258 Edge(Invalid) {}
1.259 - /// \brief Converter from arc to edge.
1.260 +
1.261 + /// \brief Constructor for conversion from an arc.
1.262 ///
1.263 + /// Constructor for conversion from an arc.
1.264 /// Besides the core graph item functionality each arc should
1.265 /// be convertible to the represented edge.
1.266 Edge(const Arc&) {}
1.267 - /// \brief Assign arc to edge.
1.268 - ///
1.269 - /// Besides the core graph item functionality each arc should
1.270 - /// be convertible to the represented edge.
1.271 - Edge& operator=(const Arc&) { return *this; }
1.272 - };
1.273 + };
1.274
1.275 - /// \brief Returns the direction of the arc.
1.276 + /// \brief Return one end node of an edge.
1.277 + ///
1.278 + /// This function returns one end node of an edge.
1.279 + Node u(const Edge&) const { return INVALID; }
1.280 +
1.281 + /// \brief Return the other end node of an edge.
1.282 + ///
1.283 + /// This function returns the other end node of an edge.
1.284 + Node v(const Edge&) const { return INVALID; }
1.285 +
1.286 + /// \brief Return a directed arc related to an edge.
1.287 + ///
1.288 + /// This function returns a directed arc from its direction and the
1.289 + /// represented edge.
1.290 + Arc direct(const Edge&, bool) const { return INVALID; }
1.291 +
1.292 + /// \brief Return a directed arc related to an edge.
1.293 + ///
1.294 + /// This function returns a directed arc from its source node and the
1.295 + /// represented edge.
1.296 + Arc direct(const Edge&, const Node&) const { return INVALID; }
1.297 +
1.298 + /// \brief Return the direction of the arc.
1.299 ///
1.300 /// Returns the direction of the arc. Each arc represents an
1.301 /// edge with a direction. It gives back the
1.302 /// direction.
1.303 bool direction(const Arc&) const { return true; }
1.304
1.305 - /// \brief Returns the directed arc.
1.306 + /// \brief Return the opposite arc.
1.307 ///
1.308 - /// Returns the directed arc from its direction and the
1.309 - /// represented edge.
1.310 - Arc direct(const Edge&, bool) const { return INVALID;}
1.311 -
1.312 - /// \brief Returns the directed arc.
1.313 - ///
1.314 - /// Returns the directed arc from its source and the
1.315 - /// represented edge.
1.316 - Arc direct(const Edge&, const Node&) const { return INVALID;}
1.317 -
1.318 - /// \brief Returns the opposite arc.
1.319 - ///
1.320 - /// Returns the opposite arc. It is the arc representing the
1.321 - /// same edge and has opposite direction.
1.322 - Arc oppositeArc(const Arc&) const { return INVALID;}
1.323 -
1.324 - /// \brief Gives back one ending of an edge.
1.325 - ///
1.326 - /// Gives back one ending of an edge.
1.327 - Node u(const Edge&) const { return INVALID;}
1.328 -
1.329 - /// \brief Gives back the other ending of an edge.
1.330 - ///
1.331 - /// Gives back the other ending of an edge.
1.332 - Node v(const Edge&) const { return INVALID;}
1.333 + /// This function returns the opposite arc, i.e. the arc representing
1.334 + /// the same edge and has opposite direction.
1.335 + Arc oppositeArc(const Arc&) const { return INVALID; }
1.336
1.337 template <typename _Graph>
1.338 struct Constraints {
1.339 @@ -269,7 +272,7 @@
1.340
1.341 void constraints() {
1.342 checkConcept<BaseDigraphComponent, _Graph>();
1.343 - checkConcept<GraphItem<'u'>, Edge>();
1.344 + checkConcept<GraphItem<'e'>, Edge>();
1.345 {
1.346 Node n;
1.347 Edge ue(INVALID);
1.348 @@ -277,6 +280,7 @@
1.349 n = graph.u(ue);
1.350 n = graph.v(ue);
1.351 e = graph.direct(ue, true);
1.352 + e = graph.direct(ue, false);
1.353 e = graph.direct(ue, n);
1.354 e = graph.oppositeArc(e);
1.355 ue = e;
1.356 @@ -290,59 +294,57 @@
1.357
1.358 };
1.359
1.360 - /// \brief An empty idable base digraph class.
1.361 + /// \brief Skeleton class for \e idable directed graphs.
1.362 ///
1.363 - /// This class provides beside the core digraph features
1.364 - /// core id functions for the digraph structure.
1.365 - /// The most of the base digraphs should be conform to this concept.
1.366 - /// The id's are unique and immutable.
1.367 - template <typename _Base = BaseDigraphComponent>
1.368 - class IDableDigraphComponent : public _Base {
1.369 + /// This class describes the interface of \e idable directed graphs.
1.370 + /// It extends \ref BaseDigraphComponent with the core ID functions.
1.371 + /// The ids of the items must be unique and immutable.
1.372 + /// This concept is part of the Digraph concept.
1.373 + template <typename BAS = BaseDigraphComponent>
1.374 + class IDableDigraphComponent : public BAS {
1.375 public:
1.376
1.377 - typedef _Base Base;
1.378 + typedef BAS Base;
1.379 typedef typename Base::Node Node;
1.380 typedef typename Base::Arc Arc;
1.381
1.382 - /// \brief Gives back an unique integer id for the Node.
1.383 + /// \brief Return a unique integer id for the given node.
1.384 ///
1.385 - /// Gives back an unique integer id for the Node.
1.386 + /// This function returns a unique integer id for the given node.
1.387 + int id(const Node&) const { return -1; }
1.388 +
1.389 + /// \brief Return the node by its unique id.
1.390 ///
1.391 - int id(const Node&) const { return -1;}
1.392 + /// This function returns the node by its unique id.
1.393 + /// If the digraph does not contain a node with the given id,
1.394 + /// then the result of the function is undefined.
1.395 + Node nodeFromId(int) const { return INVALID; }
1.396
1.397 - /// \brief Gives back the node by the unique id.
1.398 + /// \brief Return a unique integer id for the given arc.
1.399 ///
1.400 - /// Gives back the node by the unique id.
1.401 - /// If the digraph does not contain node with the given id
1.402 - /// then the result of the function is undetermined.
1.403 - Node nodeFromId(int) const { return INVALID;}
1.404 + /// This function returns a unique integer id for the given arc.
1.405 + int id(const Arc&) const { return -1; }
1.406
1.407 - /// \brief Gives back an unique integer id for the Arc.
1.408 + /// \brief Return the arc by its unique id.
1.409 ///
1.410 - /// Gives back an unique integer id for the Arc.
1.411 + /// This function returns the arc by its unique id.
1.412 + /// If the digraph does not contain an arc with the given id,
1.413 + /// then the result of the function is undefined.
1.414 + Arc arcFromId(int) const { return INVALID; }
1.415 +
1.416 + /// \brief Return an integer greater or equal to the maximum
1.417 + /// node id.
1.418 ///
1.419 - int id(const Arc&) const { return -1;}
1.420 + /// This function returns an integer greater or equal to the
1.421 + /// maximum node id.
1.422 + int maxNodeId() const { return -1; }
1.423
1.424 - /// \brief Gives back the arc by the unique id.
1.425 + /// \brief Return an integer greater or equal to the maximum
1.426 + /// arc id.
1.427 ///
1.428 - /// Gives back the arc by the unique id.
1.429 - /// If the digraph does not contain arc with the given id
1.430 - /// then the result of the function is undetermined.
1.431 - Arc arcFromId(int) const { return INVALID;}
1.432 -
1.433 - /// \brief Gives back an integer greater or equal to the maximum
1.434 - /// Node id.
1.435 - ///
1.436 - /// Gives back an integer greater or equal to the maximum Node
1.437 - /// id.
1.438 - int maxNodeId() const { return -1;}
1.439 -
1.440 - /// \brief Gives back an integer greater or equal to the maximum
1.441 - /// Arc id.
1.442 - ///
1.443 - /// Gives back an integer greater or equal to the maximum Arc
1.444 - /// id.
1.445 - int maxArcId() const { return -1;}
1.446 + /// This function returns an integer greater or equal to the
1.447 + /// maximum arc id.
1.448 + int maxArcId() const { return -1; }
1.449
1.450 template <typename _Digraph>
1.451 struct Constraints {
1.452 @@ -350,10 +352,12 @@
1.453 void constraints() {
1.454 checkConcept<Base, _Digraph >();
1.455 typename _Digraph::Node node;
1.456 + node=INVALID;
1.457 int nid = digraph.id(node);
1.458 nid = digraph.id(node);
1.459 node = digraph.nodeFromId(nid);
1.460 typename _Digraph::Arc arc;
1.461 + arc=INVALID;
1.462 int eid = digraph.id(arc);
1.463 eid = digraph.id(arc);
1.464 arc = digraph.arcFromId(eid);
1.465 @@ -368,46 +372,45 @@
1.466 };
1.467 };
1.468
1.469 - /// \brief An empty idable base undirected graph class.
1.470 + /// \brief Skeleton class for \e idable undirected graphs.
1.471 ///
1.472 - /// This class provides beside the core undirected graph features
1.473 - /// core id functions for the undirected graph structure. The
1.474 - /// most of the base undirected graphs should be conform to this
1.475 - /// concept. The id's are unique and immutable.
1.476 - template <typename _Base = BaseGraphComponent>
1.477 - class IDableGraphComponent : public IDableDigraphComponent<_Base> {
1.478 + /// This class describes the interface of \e idable undirected
1.479 + /// graphs. It extends \ref IDableDigraphComponent with the core ID
1.480 + /// functions of undirected graphs.
1.481 + /// The ids of the items must be unique and immutable.
1.482 + /// This concept is part of the Graph concept.
1.483 + template <typename BAS = BaseGraphComponent>
1.484 + class IDableGraphComponent : public IDableDigraphComponent<BAS> {
1.485 public:
1.486
1.487 - typedef _Base Base;
1.488 + typedef BAS Base;
1.489 typedef typename Base::Edge Edge;
1.490
1.491 - using IDableDigraphComponent<_Base>::id;
1.492 + using IDableDigraphComponent<Base>::id;
1.493
1.494 - /// \brief Gives back an unique integer id for the Edge.
1.495 + /// \brief Return a unique integer id for the given edge.
1.496 ///
1.497 - /// Gives back an unique integer id for the Edge.
1.498 + /// This function returns a unique integer id for the given edge.
1.499 + int id(const Edge&) const { return -1; }
1.500 +
1.501 + /// \brief Return the edge by its unique id.
1.502 ///
1.503 - int id(const Edge&) const { return -1;}
1.504 + /// This function returns the edge by its unique id.
1.505 + /// If the graph does not contain an edge with the given id,
1.506 + /// then the result of the function is undefined.
1.507 + Edge edgeFromId(int) const { return INVALID; }
1.508
1.509 - /// \brief Gives back the edge by the unique id.
1.510 + /// \brief Return an integer greater or equal to the maximum
1.511 + /// edge id.
1.512 ///
1.513 - /// Gives back the edge by the unique id. If the
1.514 - /// graph does not contain arc with the given id then the
1.515 - /// result of the function is undetermined.
1.516 - Edge edgeFromId(int) const { return INVALID;}
1.517 -
1.518 - /// \brief Gives back an integer greater or equal to the maximum
1.519 - /// Edge id.
1.520 - ///
1.521 - /// Gives back an integer greater or equal to the maximum Edge
1.522 - /// id.
1.523 - int maxEdgeId() const { return -1;}
1.524 + /// This function returns an integer greater or equal to the
1.525 + /// maximum edge id.
1.526 + int maxEdgeId() const { return -1; }
1.527
1.528 template <typename _Graph>
1.529 struct Constraints {
1.530
1.531 void constraints() {
1.532 - checkConcept<Base, _Graph >();
1.533 checkConcept<IDableDigraphComponent<Base>, _Graph >();
1.534 typename _Graph::Edge edge;
1.535 int ueid = graph.id(edge);
1.536 @@ -421,231 +424,243 @@
1.537 };
1.538 };
1.539
1.540 - /// \brief Skeleton class for graph NodeIt and ArcIt
1.541 + /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types.
1.542 ///
1.543 - /// Skeleton class for graph NodeIt and ArcIt.
1.544 - ///
1.545 - template <typename _Graph, typename _Item>
1.546 - class GraphItemIt : public _Item {
1.547 + /// This class describes the concept of \c NodeIt, \c ArcIt and
1.548 + /// \c EdgeIt subtypes of digraph and graph types.
1.549 + template <typename GR, typename Item>
1.550 + class GraphItemIt : public Item {
1.551 public:
1.552 /// \brief Default constructor.
1.553 ///
1.554 - /// @warning The default constructor sets the iterator
1.555 - /// to an undefined value.
1.556 + /// Default constructor.
1.557 + /// \warning The default constructor is not required to set
1.558 + /// the iterator to some well-defined value. So you should consider it
1.559 + /// as uninitialized.
1.560 GraphItemIt() {}
1.561 +
1.562 /// \brief Copy constructor.
1.563 ///
1.564 /// Copy constructor.
1.565 + GraphItemIt(const GraphItemIt& it) : Item(it) {}
1.566 +
1.567 + /// \brief Constructor that sets the iterator to the first item.
1.568 ///
1.569 - GraphItemIt(const GraphItemIt& ) {}
1.570 - /// \brief Sets the iterator to the first item.
1.571 + /// Constructor that sets the iterator to the first item.
1.572 + explicit GraphItemIt(const GR&) {}
1.573 +
1.574 + /// \brief Constructor for conversion from \c INVALID.
1.575 ///
1.576 - /// Sets the iterator to the first item of \c the graph.
1.577 - ///
1.578 - explicit GraphItemIt(const _Graph&) {}
1.579 - /// \brief Invalid constructor \& conversion.
1.580 - ///
1.581 - /// This constructor initializes the item to be invalid.
1.582 + /// Constructor for conversion from \c INVALID.
1.583 + /// It initializes the iterator to be invalid.
1.584 /// \sa Invalid for more details.
1.585 GraphItemIt(Invalid) {}
1.586 - /// \brief Assign operator for items.
1.587 +
1.588 + /// \brief Assignment operator.
1.589 ///
1.590 - /// The items are assignable.
1.591 + /// Assignment operator for the iterator.
1.592 + GraphItemIt& operator=(const GraphItemIt&) { return *this; }
1.593 +
1.594 + /// \brief Increment the iterator.
1.595 ///
1.596 - GraphItemIt& operator=(const GraphItemIt&) { return *this; }
1.597 - /// \brief Next item.
1.598 - ///
1.599 - /// Assign the iterator to the next item.
1.600 - ///
1.601 + /// This operator increments the iterator, i.e. assigns it to the
1.602 + /// next item.
1.603 GraphItemIt& operator++() { return *this; }
1.604 +
1.605 /// \brief Equality operator
1.606 ///
1.607 + /// Equality operator.
1.608 /// Two iterators are equal if and only if they point to the
1.609 /// same object or both are invalid.
1.610 bool operator==(const GraphItemIt&) const { return true;}
1.611 +
1.612 /// \brief Inequality operator
1.613 ///
1.614 - /// \sa operator==(Node n)
1.615 - ///
1.616 + /// Inequality operator.
1.617 + /// Two iterators are equal if and only if they point to the
1.618 + /// same object or both are invalid.
1.619 bool operator!=(const GraphItemIt&) const { return true;}
1.620
1.621 template<typename _GraphItemIt>
1.622 struct Constraints {
1.623 void constraints() {
1.624 + checkConcept<GraphItem<>, _GraphItemIt>();
1.625 _GraphItemIt it1(g);
1.626 _GraphItemIt it2;
1.627 + _GraphItemIt it3 = it1;
1.628 + _GraphItemIt it4 = INVALID;
1.629
1.630 it2 = ++it1;
1.631 ++it2 = it1;
1.632 ++(++it1);
1.633
1.634 - _Item bi = it1;
1.635 + Item bi = it1;
1.636 bi = it2;
1.637 }
1.638 - _Graph& g;
1.639 + const GR& g;
1.640 };
1.641 };
1.642
1.643 - /// \brief Skeleton class for graph InArcIt and OutArcIt
1.644 + /// \brief Concept class for \c InArcIt, \c OutArcIt and
1.645 + /// \c IncEdgeIt types.
1.646 ///
1.647 - /// \note Because InArcIt and OutArcIt may not inherit from the same
1.648 - /// base class, the _selector is a additional template parameter. For
1.649 - /// InArcIt you should instantiate it with character 'i' and for
1.650 - /// OutArcIt with 'o'.
1.651 - template <typename _Graph,
1.652 - typename _Item = typename _Graph::Arc,
1.653 - typename _Base = typename _Graph::Node,
1.654 - char _selector = '0'>
1.655 - class GraphIncIt : public _Item {
1.656 + /// This class describes the concept of \c InArcIt, \c OutArcIt
1.657 + /// and \c IncEdgeIt subtypes of digraph and graph types.
1.658 + ///
1.659 + /// \note Since these iterator classes do not inherit from the same
1.660 + /// base class, there is an additional template parameter (selector)
1.661 + /// \c sel. For \c InArcIt you should instantiate it with character
1.662 + /// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'.
1.663 + template <typename GR,
1.664 + typename Item = typename GR::Arc,
1.665 + typename Base = typename GR::Node,
1.666 + char sel = '0'>
1.667 + class GraphIncIt : public Item {
1.668 public:
1.669 /// \brief Default constructor.
1.670 ///
1.671 - /// @warning The default constructor sets the iterator
1.672 - /// to an undefined value.
1.673 + /// Default constructor.
1.674 + /// \warning The default constructor is not required to set
1.675 + /// the iterator to some well-defined value. So you should consider it
1.676 + /// as uninitialized.
1.677 GraphIncIt() {}
1.678 +
1.679 /// \brief Copy constructor.
1.680 ///
1.681 /// Copy constructor.
1.682 + GraphIncIt(const GraphIncIt& it) : Item(it) {}
1.683 +
1.684 + /// \brief Constructor that sets the iterator to the first
1.685 + /// incoming or outgoing arc.
1.686 ///
1.687 - GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
1.688 - /// \brief Sets the iterator to the first arc incoming into or outgoing
1.689 - /// from the node.
1.690 + /// Constructor that sets the iterator to the first arc
1.691 + /// incoming to or outgoing from the given node.
1.692 + explicit GraphIncIt(const GR&, const Base&) {}
1.693 +
1.694 + /// \brief Constructor for conversion from \c INVALID.
1.695 ///
1.696 - /// Sets the iterator to the first arc incoming into or outgoing
1.697 - /// from the node.
1.698 - ///
1.699 - explicit GraphIncIt(const _Graph&, const _Base&) {}
1.700 - /// \brief Invalid constructor \& conversion.
1.701 - ///
1.702 - /// This constructor initializes the item to be invalid.
1.703 + /// Constructor for conversion from \c INVALID.
1.704 + /// It initializes the iterator to be invalid.
1.705 /// \sa Invalid for more details.
1.706 GraphIncIt(Invalid) {}
1.707 - /// \brief Assign operator for iterators.
1.708 +
1.709 + /// \brief Assignment operator.
1.710 ///
1.711 - /// The iterators are assignable.
1.712 + /// Assignment operator for the iterator.
1.713 + GraphIncIt& operator=(const GraphIncIt&) { return *this; }
1.714 +
1.715 + /// \brief Increment the iterator.
1.716 ///
1.717 - GraphIncIt& operator=(GraphIncIt const&) { return *this; }
1.718 - /// \brief Next item.
1.719 - ///
1.720 - /// Assign the iterator to the next item.
1.721 - ///
1.722 + /// This operator increments the iterator, i.e. assigns it to the
1.723 + /// next arc incoming to or outgoing from the given node.
1.724 GraphIncIt& operator++() { return *this; }
1.725
1.726 /// \brief Equality operator
1.727 ///
1.728 + /// Equality operator.
1.729 /// Two iterators are equal if and only if they point to the
1.730 /// same object or both are invalid.
1.731 bool operator==(const GraphIncIt&) const { return true;}
1.732
1.733 /// \brief Inequality operator
1.734 ///
1.735 - /// \sa operator==(Node n)
1.736 - ///
1.737 + /// Inequality operator.
1.738 + /// Two iterators are equal if and only if they point to the
1.739 + /// same object or both are invalid.
1.740 bool operator!=(const GraphIncIt&) const { return true;}
1.741
1.742 template <typename _GraphIncIt>
1.743 struct Constraints {
1.744 void constraints() {
1.745 - checkConcept<GraphItem<_selector>, _GraphIncIt>();
1.746 + checkConcept<GraphItem<sel>, _GraphIncIt>();
1.747 _GraphIncIt it1(graph, node);
1.748 _GraphIncIt it2;
1.749 + _GraphIncIt it3 = it1;
1.750 + _GraphIncIt it4 = INVALID;
1.751
1.752 it2 = ++it1;
1.753 ++it2 = it1;
1.754 ++(++it1);
1.755 - _Item e = it1;
1.756 + Item e = it1;
1.757 e = it2;
1.758 -
1.759 }
1.760 -
1.761 - _Item arc;
1.762 - _Base node;
1.763 - _Graph graph;
1.764 - _GraphIncIt it;
1.765 + const Base& node;
1.766 + const GR& graph;
1.767 };
1.768 };
1.769
1.770 -
1.771 - /// \brief An empty iterable digraph class.
1.772 + /// \brief Skeleton class for iterable directed graphs.
1.773 ///
1.774 - /// This class provides beside the core digraph features
1.775 - /// iterator based iterable interface for the digraph structure.
1.776 + /// This class describes the interface of iterable directed
1.777 + /// graphs. It extends \ref BaseDigraphComponent with the core
1.778 + /// iterable interface.
1.779 /// This concept is part of the Digraph concept.
1.780 - template <typename _Base = BaseDigraphComponent>
1.781 - class IterableDigraphComponent : public _Base {
1.782 + template <typename BAS = BaseDigraphComponent>
1.783 + class IterableDigraphComponent : public BAS {
1.784
1.785 public:
1.786
1.787 - typedef _Base Base;
1.788 + typedef BAS Base;
1.789 typedef typename Base::Node Node;
1.790 typedef typename Base::Arc Arc;
1.791
1.792 typedef IterableDigraphComponent Digraph;
1.793
1.794 - /// \name Base iteration
1.795 + /// \name Base Iteration
1.796 ///
1.797 - /// This interface provides functions for iteration on digraph items
1.798 + /// This interface provides functions for iteration on digraph items.
1.799 ///
1.800 /// @{
1.801
1.802 - /// \brief Gives back the first node in the iterating order.
1.803 + /// \brief Return the first node.
1.804 ///
1.805 - /// Gives back the first node in the iterating order.
1.806 - ///
1.807 + /// This function gives back the first node in the iteration order.
1.808 void first(Node&) const {}
1.809
1.810 - /// \brief Gives back the next node in the iterating order.
1.811 + /// \brief Return the next node.
1.812 ///
1.813 - /// Gives back the next node in the iterating order.
1.814 - ///
1.815 + /// This function gives back the next node in the iteration order.
1.816 void next(Node&) const {}
1.817
1.818 - /// \brief Gives back the first arc in the iterating order.
1.819 + /// \brief Return the first arc.
1.820 ///
1.821 - /// Gives back the first arc in the iterating order.
1.822 - ///
1.823 + /// This function gives back the first arc in the iteration order.
1.824 void first(Arc&) const {}
1.825
1.826 - /// \brief Gives back the next arc in the iterating order.
1.827 + /// \brief Return the next arc.
1.828 ///
1.829 - /// Gives back the next arc in the iterating order.
1.830 - ///
1.831 + /// This function gives back the next arc in the iteration order.
1.832 void next(Arc&) const {}
1.833
1.834 -
1.835 - /// \brief Gives back the first of the arcs point to the given
1.836 - /// node.
1.837 + /// \brief Return the first arc incomming to the given node.
1.838 ///
1.839 - /// Gives back the first of the arcs point to the given node.
1.840 - ///
1.841 + /// This function gives back the first arc incomming to the
1.842 + /// given node.
1.843 void firstIn(Arc&, const Node&) const {}
1.844
1.845 - /// \brief Gives back the next of the arcs points to the given
1.846 - /// node.
1.847 + /// \brief Return the next arc incomming to the given node.
1.848 ///
1.849 - /// Gives back the next of the arcs points to the given node.
1.850 - ///
1.851 + /// This function gives back the next arc incomming to the
1.852 + /// given node.
1.853 void nextIn(Arc&) const {}
1.854
1.855 - /// \brief Gives back the first of the arcs start from the
1.856 + /// \brief Return the first arc outgoing form the given node.
1.857 + ///
1.858 + /// This function gives back the first arc outgoing form the
1.859 /// given node.
1.860 - ///
1.861 - /// Gives back the first of the arcs start from the given node.
1.862 - ///
1.863 void firstOut(Arc&, const Node&) const {}
1.864
1.865 - /// \brief Gives back the next of the arcs start from the given
1.866 - /// node.
1.867 + /// \brief Return the next arc outgoing form the given node.
1.868 ///
1.869 - /// Gives back the next of the arcs start from the given node.
1.870 - ///
1.871 + /// This function gives back the next arc outgoing form the
1.872 + /// given node.
1.873 void nextOut(Arc&) const {}
1.874
1.875 /// @}
1.876
1.877 - /// \name Class based iteration
1.878 + /// \name Class Based Iteration
1.879 ///
1.880 - /// This interface provides functions for iteration on digraph items
1.881 + /// This interface provides iterator classes for digraph items.
1.882 ///
1.883 /// @{
1.884
1.885 @@ -655,15 +670,15 @@
1.886 ///
1.887 typedef GraphItemIt<Digraph, Node> NodeIt;
1.888
1.889 - /// \brief This iterator goes through each node.
1.890 + /// \brief This iterator goes through each arc.
1.891 ///
1.892 - /// This iterator goes through each node.
1.893 + /// This iterator goes through each arc.
1.894 ///
1.895 typedef GraphItemIt<Digraph, Arc> ArcIt;
1.896
1.897 /// \brief This iterator goes trough the incoming arcs of a node.
1.898 ///
1.899 - /// This iterator goes trough the \e inccoming arcs of a certain node
1.900 + /// This iterator goes trough the \e incoming arcs of a certain node
1.901 /// of a digraph.
1.902 typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt;
1.903
1.904 @@ -675,26 +690,26 @@
1.905
1.906 /// \brief The base node of the iterator.
1.907 ///
1.908 - /// Gives back the base node of the iterator.
1.909 - /// It is always the target of the pointed arc.
1.910 + /// This function gives back the base node of the iterator.
1.911 + /// It is always the target node of the pointed arc.
1.912 Node baseNode(const InArcIt&) const { return INVALID; }
1.913
1.914 /// \brief The running node of the iterator.
1.915 ///
1.916 - /// Gives back the running node of the iterator.
1.917 - /// It is always the source of the pointed arc.
1.918 + /// This function gives back the running node of the iterator.
1.919 + /// It is always the source node of the pointed arc.
1.920 Node runningNode(const InArcIt&) const { return INVALID; }
1.921
1.922 /// \brief The base node of the iterator.
1.923 ///
1.924 - /// Gives back the base node of the iterator.
1.925 - /// It is always the source of the pointed arc.
1.926 + /// This function gives back the base node of the iterator.
1.927 + /// It is always the source node of the pointed arc.
1.928 Node baseNode(const OutArcIt&) const { return INVALID; }
1.929
1.930 /// \brief The running node of the iterator.
1.931 ///
1.932 - /// Gives back the running node of the iterator.
1.933 - /// It is always the target of the pointed arc.
1.934 + /// This function gives back the running node of the iterator.
1.935 + /// It is always the target node of the pointed arc.
1.936 Node runningNode(const OutArcIt&) const { return INVALID; }
1.937
1.938 /// @}
1.939 @@ -736,31 +751,31 @@
1.940 typename _Digraph::Node, 'o'>, typename _Digraph::OutArcIt>();
1.941
1.942 typename _Digraph::Node n;
1.943 - typename _Digraph::InArcIt ieit(INVALID);
1.944 - typename _Digraph::OutArcIt oeit(INVALID);
1.945 - n = digraph.baseNode(ieit);
1.946 - n = digraph.runningNode(ieit);
1.947 - n = digraph.baseNode(oeit);
1.948 - n = digraph.runningNode(oeit);
1.949 + const typename _Digraph::InArcIt iait(INVALID);
1.950 + const typename _Digraph::OutArcIt oait(INVALID);
1.951 + n = digraph.baseNode(iait);
1.952 + n = digraph.runningNode(iait);
1.953 + n = digraph.baseNode(oait);
1.954 + n = digraph.runningNode(oait);
1.955 ignore_unused_variable_warning(n);
1.956 }
1.957 }
1.958
1.959 const _Digraph& digraph;
1.960 -
1.961 };
1.962 };
1.963
1.964 - /// \brief An empty iterable undirected graph class.
1.965 + /// \brief Skeleton class for iterable undirected graphs.
1.966 ///
1.967 - /// This class provides beside the core graph features iterator
1.968 - /// based iterable interface for the undirected graph structure.
1.969 + /// This class describes the interface of iterable undirected
1.970 + /// graphs. It extends \ref IterableDigraphComponent with the core
1.971 + /// iterable interface of undirected graphs.
1.972 /// This concept is part of the Graph concept.
1.973 - template <typename _Base = BaseGraphComponent>
1.974 - class IterableGraphComponent : public IterableDigraphComponent<_Base> {
1.975 + template <typename BAS = BaseGraphComponent>
1.976 + class IterableGraphComponent : public IterableDigraphComponent<BAS> {
1.977 public:
1.978
1.979 - typedef _Base Base;
1.980 + typedef BAS Base;
1.981 typedef typename Base::Node Node;
1.982 typedef typename Base::Arc Arc;
1.983 typedef typename Base::Edge Edge;
1.984 @@ -768,75 +783,71 @@
1.985
1.986 typedef IterableGraphComponent Graph;
1.987
1.988 - /// \name Base iteration
1.989 + /// \name Base Iteration
1.990 ///
1.991 - /// This interface provides functions for iteration on graph items
1.992 + /// This interface provides functions for iteration on edges.
1.993 + ///
1.994 /// @{
1.995
1.996 - using IterableDigraphComponent<_Base>::first;
1.997 - using IterableDigraphComponent<_Base>::next;
1.998 + using IterableDigraphComponent<Base>::first;
1.999 + using IterableDigraphComponent<Base>::next;
1.1000
1.1001 - /// \brief Gives back the first edge in the iterating
1.1002 - /// order.
1.1003 + /// \brief Return the first edge.
1.1004 ///
1.1005 - /// Gives back the first edge in the iterating order.
1.1006 - ///
1.1007 + /// This function gives back the first edge in the iteration order.
1.1008 void first(Edge&) const {}
1.1009
1.1010 - /// \brief Gives back the next edge in the iterating
1.1011 - /// order.
1.1012 + /// \brief Return the next edge.
1.1013 ///
1.1014 - /// Gives back the next edge in the iterating order.
1.1015 - ///
1.1016 + /// This function gives back the next edge in the iteration order.
1.1017 void next(Edge&) const {}
1.1018
1.1019 -
1.1020 - /// \brief Gives back the first of the edges from the
1.1021 + /// \brief Return the first edge incident to the given node.
1.1022 + ///
1.1023 + /// This function gives back the first edge incident to the given
1.1024 + /// node. The bool parameter gives back the direction for which the
1.1025 + /// source node of the directed arc representing the edge is the
1.1026 /// given node.
1.1027 - ///
1.1028 - /// Gives back the first of the edges from the given
1.1029 - /// node. The bool parameter gives back that direction which
1.1030 - /// gives a good direction of the edge so the source of the
1.1031 - /// directed arc is the given node.
1.1032 void firstInc(Edge&, bool&, const Node&) const {}
1.1033
1.1034 /// \brief Gives back the next of the edges from the
1.1035 /// given node.
1.1036 ///
1.1037 - /// Gives back the next of the edges from the given
1.1038 - /// node. The bool parameter should be used as the \c firstInc()
1.1039 - /// use it.
1.1040 + /// This function gives back the next edge incident to the given
1.1041 + /// node. The bool parameter should be used as \c firstInc() use it.
1.1042 void nextInc(Edge&, bool&) const {}
1.1043
1.1044 - using IterableDigraphComponent<_Base>::baseNode;
1.1045 - using IterableDigraphComponent<_Base>::runningNode;
1.1046 + using IterableDigraphComponent<Base>::baseNode;
1.1047 + using IterableDigraphComponent<Base>::runningNode;
1.1048
1.1049 /// @}
1.1050
1.1051 - /// \name Class based iteration
1.1052 + /// \name Class Based Iteration
1.1053 ///
1.1054 - /// This interface provides functions for iteration on graph items
1.1055 + /// This interface provides iterator classes for edges.
1.1056 ///
1.1057 /// @{
1.1058
1.1059 - /// \brief This iterator goes through each node.
1.1060 + /// \brief This iterator goes through each edge.
1.1061 ///
1.1062 - /// This iterator goes through each node.
1.1063 + /// This iterator goes through each edge.
1.1064 typedef GraphItemIt<Graph, Edge> EdgeIt;
1.1065 - /// \brief This iterator goes trough the incident arcs of a
1.1066 +
1.1067 + /// \brief This iterator goes trough the incident edges of a
1.1068 /// node.
1.1069 ///
1.1070 - /// This iterator goes trough the incident arcs of a certain
1.1071 + /// This iterator goes trough the incident edges of a certain
1.1072 /// node of a graph.
1.1073 - typedef GraphIncIt<Graph, Edge, Node, 'u'> IncEdgeIt;
1.1074 + typedef GraphIncIt<Graph, Edge, Node, 'e'> IncEdgeIt;
1.1075 +
1.1076 /// \brief The base node of the iterator.
1.1077 ///
1.1078 - /// Gives back the base node of the iterator.
1.1079 + /// This function gives back the base node of the iterator.
1.1080 Node baseNode(const IncEdgeIt&) const { return INVALID; }
1.1081
1.1082 /// \brief The running node of the iterator.
1.1083 ///
1.1084 - /// Gives back the running node of the iterator.
1.1085 + /// This function gives back the running node of the iterator.
1.1086 Node runningNode(const IncEdgeIt&) const { return INVALID; }
1.1087
1.1088 /// @}
1.1089 @@ -865,54 +876,54 @@
1.1090 checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
1.1091 typename _Graph::EdgeIt >();
1.1092 checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
1.1093 - typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
1.1094 + typename _Graph::Node, 'e'>, typename _Graph::IncEdgeIt>();
1.1095
1.1096 typename _Graph::Node n;
1.1097 - typename _Graph::IncEdgeIt ueit(INVALID);
1.1098 - n = graph.baseNode(ueit);
1.1099 - n = graph.runningNode(ueit);
1.1100 + const typename _Graph::IncEdgeIt ieit(INVALID);
1.1101 + n = graph.baseNode(ieit);
1.1102 + n = graph.runningNode(ieit);
1.1103 }
1.1104 }
1.1105
1.1106 const _Graph& graph;
1.1107 -
1.1108 };
1.1109 };
1.1110
1.1111 - /// \brief An empty alteration notifier digraph class.
1.1112 + /// \brief Skeleton class for alterable directed graphs.
1.1113 ///
1.1114 - /// This class provides beside the core digraph features alteration
1.1115 - /// notifier interface for the digraph structure. This implements
1.1116 + /// This class describes the interface of alterable directed
1.1117 + /// graphs. It extends \ref BaseDigraphComponent with the alteration
1.1118 + /// notifier interface. It implements
1.1119 /// an observer-notifier pattern for each digraph item. More
1.1120 /// obsevers can be registered into the notifier and whenever an
1.1121 - /// alteration occured in the digraph all the observers will
1.1122 + /// alteration occured in the digraph all the observers will be
1.1123 /// notified about it.
1.1124 - template <typename _Base = BaseDigraphComponent>
1.1125 - class AlterableDigraphComponent : public _Base {
1.1126 + template <typename BAS = BaseDigraphComponent>
1.1127 + class AlterableDigraphComponent : public BAS {
1.1128 public:
1.1129
1.1130 - typedef _Base Base;
1.1131 + typedef BAS Base;
1.1132 typedef typename Base::Node Node;
1.1133 typedef typename Base::Arc Arc;
1.1134
1.1135
1.1136 - /// The node observer registry.
1.1137 + /// Node alteration notifier class.
1.1138 typedef AlterationNotifier<AlterableDigraphComponent, Node>
1.1139 NodeNotifier;
1.1140 - /// The arc observer registry.
1.1141 + /// Arc alteration notifier class.
1.1142 typedef AlterationNotifier<AlterableDigraphComponent, Arc>
1.1143 ArcNotifier;
1.1144
1.1145 - /// \brief Gives back the node alteration notifier.
1.1146 + /// \brief Return the node alteration notifier.
1.1147 ///
1.1148 - /// Gives back the node alteration notifier.
1.1149 + /// This function gives back the node alteration notifier.
1.1150 NodeNotifier& notifier(Node) const {
1.1151 - return NodeNotifier();
1.1152 + return NodeNotifier();
1.1153 }
1.1154
1.1155 - /// \brief Gives back the arc alteration notifier.
1.1156 + /// \brief Return the arc alteration notifier.
1.1157 ///
1.1158 - /// Gives back the arc alteration notifier.
1.1159 + /// This function gives back the arc alteration notifier.
1.1160 ArcNotifier& notifier(Arc) const {
1.1161 return ArcNotifier();
1.1162 }
1.1163 @@ -932,34 +943,33 @@
1.1164 }
1.1165
1.1166 const _Digraph& digraph;
1.1167 -
1.1168 };
1.1169 -
1.1170 };
1.1171
1.1172 - /// \brief An empty alteration notifier undirected graph class.
1.1173 + /// \brief Skeleton class for alterable undirected graphs.
1.1174 ///
1.1175 - /// This class provides beside the core graph features alteration
1.1176 - /// notifier interface for the graph structure. This implements
1.1177 - /// an observer-notifier pattern for each graph item. More
1.1178 + /// This class describes the interface of alterable undirected
1.1179 + /// graphs. It extends \ref AlterableDigraphComponent with the alteration
1.1180 + /// notifier interface of undirected graphs. It implements
1.1181 + /// an observer-notifier pattern for the edges. More
1.1182 /// obsevers can be registered into the notifier and whenever an
1.1183 - /// alteration occured in the graph all the observers will
1.1184 + /// alteration occured in the graph all the observers will be
1.1185 /// notified about it.
1.1186 - template <typename _Base = BaseGraphComponent>
1.1187 - class AlterableGraphComponent : public AlterableDigraphComponent<_Base> {
1.1188 + template <typename BAS = BaseGraphComponent>
1.1189 + class AlterableGraphComponent : public AlterableDigraphComponent<BAS> {
1.1190 public:
1.1191
1.1192 - typedef _Base Base;
1.1193 + typedef BAS Base;
1.1194 typedef typename Base::Edge Edge;
1.1195
1.1196
1.1197 - /// The arc observer registry.
1.1198 + /// Edge alteration notifier class.
1.1199 typedef AlterationNotifier<AlterableGraphComponent, Edge>
1.1200 EdgeNotifier;
1.1201
1.1202 - /// \brief Gives back the arc alteration notifier.
1.1203 + /// \brief Return the edge alteration notifier.
1.1204 ///
1.1205 - /// Gives back the arc alteration notifier.
1.1206 + /// This function gives back the edge alteration notifier.
1.1207 EdgeNotifier& notifier(Edge) const {
1.1208 return EdgeNotifier();
1.1209 }
1.1210 @@ -967,44 +977,48 @@
1.1211 template <typename _Graph>
1.1212 struct Constraints {
1.1213 void constraints() {
1.1214 - checkConcept<AlterableGraphComponent<Base>, _Graph>();
1.1215 + checkConcept<AlterableDigraphComponent<Base>, _Graph>();
1.1216 typename _Graph::EdgeNotifier& uen
1.1217 = graph.notifier(typename _Graph::Edge());
1.1218 ignore_unused_variable_warning(uen);
1.1219 }
1.1220
1.1221 const _Graph& graph;
1.1222 -
1.1223 };
1.1224 -
1.1225 };
1.1226
1.1227 - /// \brief Class describing the concept of graph maps
1.1228 + /// \brief Concept class for standard graph maps.
1.1229 ///
1.1230 - /// This class describes the common interface of the graph maps
1.1231 - /// (NodeMap, ArcMap), that is maps that can be used to
1.1232 - /// associate data to graph descriptors (nodes or arcs).
1.1233 - template <typename _Graph, typename _Item, typename _Value>
1.1234 - class GraphMap : public ReadWriteMap<_Item, _Value> {
1.1235 + /// This class describes the concept of standard graph maps, i.e.
1.1236 + /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and
1.1237 + /// graph types, which can be used for associating data to graph items.
1.1238 + /// The standard graph maps must conform to the ReferenceMap concept.
1.1239 + template <typename GR, typename K, typename V>
1.1240 + class GraphMap : public ReferenceMap<K, V, V&, const V&> {
1.1241 + typedef ReferenceMap<K, V, V&, const V&> Parent;
1.1242 +
1.1243 public:
1.1244
1.1245 - typedef ReadWriteMap<_Item, _Value> Parent;
1.1246 + /// The key type of the map.
1.1247 + typedef K Key;
1.1248 + /// The value type of the map.
1.1249 + typedef V Value;
1.1250 + /// The reference type of the map.
1.1251 + typedef Value& Reference;
1.1252 + /// The const reference type of the map.
1.1253 + typedef const Value& ConstReference;
1.1254
1.1255 - /// The graph type of the map.
1.1256 - typedef _Graph Graph;
1.1257 - /// The key type of the map.
1.1258 - typedef _Item Key;
1.1259 - /// The value type of the map.
1.1260 - typedef _Value Value;
1.1261 + // The reference map tag.
1.1262 + typedef True ReferenceMapTag;
1.1263
1.1264 /// \brief Construct a new map.
1.1265 ///
1.1266 /// Construct a new map for the graph.
1.1267 - explicit GraphMap(const Graph&) {}
1.1268 + explicit GraphMap(const GR&) {}
1.1269 /// \brief Construct a new map with default value.
1.1270 ///
1.1271 - /// Construct a new map for the graph and initalise the values.
1.1272 - GraphMap(const Graph&, const Value&) {}
1.1273 + /// Construct a new map for the graph and initalize the values.
1.1274 + GraphMap(const GR&, const Value&) {}
1.1275
1.1276 private:
1.1277 /// \brief Copy constructor.
1.1278 @@ -1012,9 +1026,9 @@
1.1279 /// Copy Constructor.
1.1280 GraphMap(const GraphMap&) : Parent() {}
1.1281
1.1282 - /// \brief Assign operator.
1.1283 + /// \brief Assignment operator.
1.1284 ///
1.1285 - /// Assign operator. It does not mofify the underlying graph,
1.1286 + /// Assignment operator. It does not mofify the underlying graph,
1.1287 /// it just iterates on the current item set and set the map
1.1288 /// with the value returned by the assigned map.
1.1289 template <typename CMap>
1.1290 @@ -1027,53 +1041,55 @@
1.1291 template<typename _Map>
1.1292 struct Constraints {
1.1293 void constraints() {
1.1294 - checkConcept<ReadWriteMap<Key, Value>, _Map >();
1.1295 - // Construction with a graph parameter
1.1296 - _Map a(g);
1.1297 - // Constructor with a graph and a default value parameter
1.1298 - _Map a2(g,t);
1.1299 - // Copy constructor.
1.1300 - // _Map b(c);
1.1301 + checkConcept
1.1302 + <ReferenceMap<Key, Value, Value&, const Value&>, _Map>();
1.1303 + _Map m1(g);
1.1304 + _Map m2(g,t);
1.1305 +
1.1306 + // Copy constructor
1.1307 + // _Map m3(m);
1.1308
1.1309 + // Assignment operator
1.1310 // ReadMap<Key, Value> cmap;
1.1311 - // b = cmap;
1.1312 + // m3 = cmap;
1.1313
1.1314 - ignore_unused_variable_warning(a);
1.1315 - ignore_unused_variable_warning(a2);
1.1316 - // ignore_unused_variable_warning(b);
1.1317 + ignore_unused_variable_warning(m1);
1.1318 + ignore_unused_variable_warning(m2);
1.1319 + // ignore_unused_variable_warning(m3);
1.1320 }
1.1321
1.1322 - const _Map &c;
1.1323 - const Graph &g;
1.1324 + const _Map &m;
1.1325 + const GR &g;
1.1326 const typename GraphMap::Value &t;
1.1327 };
1.1328
1.1329 };
1.1330
1.1331 - /// \brief An empty mappable digraph class.
1.1332 + /// \brief Skeleton class for mappable directed graphs.
1.1333 ///
1.1334 - /// This class provides beside the core digraph features
1.1335 - /// map interface for the digraph structure.
1.1336 + /// This class describes the interface of mappable directed graphs.
1.1337 + /// It extends \ref BaseDigraphComponent with the standard digraph
1.1338 + /// map classes, namely \c NodeMap and \c ArcMap.
1.1339 /// This concept is part of the Digraph concept.
1.1340 - template <typename _Base = BaseDigraphComponent>
1.1341 - class MappableDigraphComponent : public _Base {
1.1342 + template <typename BAS = BaseDigraphComponent>
1.1343 + class MappableDigraphComponent : public BAS {
1.1344 public:
1.1345
1.1346 - typedef _Base Base;
1.1347 + typedef BAS Base;
1.1348 typedef typename Base::Node Node;
1.1349 typedef typename Base::Arc Arc;
1.1350
1.1351 typedef MappableDigraphComponent Digraph;
1.1352
1.1353 - /// \brief ReadWrite map of the nodes.
1.1354 + /// \brief Standard graph map for the nodes.
1.1355 ///
1.1356 - /// ReadWrite map of the nodes.
1.1357 - ///
1.1358 - template <typename _Value>
1.1359 - class NodeMap : public GraphMap<Digraph, Node, _Value> {
1.1360 + /// Standard graph map for the nodes.
1.1361 + /// It conforms to the ReferenceMap concept.
1.1362 + template <typename V>
1.1363 + class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
1.1364 + typedef GraphMap<MappableDigraphComponent, Node, V> Parent;
1.1365 +
1.1366 public:
1.1367 - typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent;
1.1368 -
1.1369 /// \brief Construct a new map.
1.1370 ///
1.1371 /// Construct a new map for the digraph.
1.1372 @@ -1082,8 +1098,8 @@
1.1373
1.1374 /// \brief Construct a new map with default value.
1.1375 ///
1.1376 - /// Construct a new map for the digraph and initalise the values.
1.1377 - NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
1.1378 + /// Construct a new map for the digraph and initalize the values.
1.1379 + NodeMap(const MappableDigraphComponent& digraph, const V& value)
1.1380 : Parent(digraph, value) {}
1.1381
1.1382 private:
1.1383 @@ -1092,26 +1108,26 @@
1.1384 /// Copy Constructor.
1.1385 NodeMap(const NodeMap& nm) : Parent(nm) {}
1.1386
1.1387 - /// \brief Assign operator.
1.1388 + /// \brief Assignment operator.
1.1389 ///
1.1390 - /// Assign operator.
1.1391 + /// Assignment operator.
1.1392 template <typename CMap>
1.1393 NodeMap& operator=(const CMap&) {
1.1394 - checkConcept<ReadMap<Node, _Value>, CMap>();
1.1395 + checkConcept<ReadMap<Node, V>, CMap>();
1.1396 return *this;
1.1397 }
1.1398
1.1399 };
1.1400
1.1401 - /// \brief ReadWrite map of the arcs.
1.1402 + /// \brief Standard graph map for the arcs.
1.1403 ///
1.1404 - /// ReadWrite map of the arcs.
1.1405 - ///
1.1406 - template <typename _Value>
1.1407 - class ArcMap : public GraphMap<Digraph, Arc, _Value> {
1.1408 + /// Standard graph map for the arcs.
1.1409 + /// It conforms to the ReferenceMap concept.
1.1410 + template <typename V>
1.1411 + class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
1.1412 + typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;
1.1413 +
1.1414 public:
1.1415 - typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent;
1.1416 -
1.1417 /// \brief Construct a new map.
1.1418 ///
1.1419 /// Construct a new map for the digraph.
1.1420 @@ -1120,8 +1136,8 @@
1.1421
1.1422 /// \brief Construct a new map with default value.
1.1423 ///
1.1424 - /// Construct a new map for the digraph and initalise the values.
1.1425 - ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
1.1426 + /// Construct a new map for the digraph and initalize the values.
1.1427 + ArcMap(const MappableDigraphComponent& digraph, const V& value)
1.1428 : Parent(digraph, value) {}
1.1429
1.1430 private:
1.1431 @@ -1130,12 +1146,12 @@
1.1432 /// Copy Constructor.
1.1433 ArcMap(const ArcMap& nm) : Parent(nm) {}
1.1434
1.1435 - /// \brief Assign operator.
1.1436 + /// \brief Assignment operator.
1.1437 ///
1.1438 - /// Assign operator.
1.1439 + /// Assignment operator.
1.1440 template <typename CMap>
1.1441 ArcMap& operator=(const CMap&) {
1.1442 - checkConcept<ReadMap<Arc, _Value>, CMap>();
1.1443 + checkConcept<ReadMap<Arc, V>, CMap>();
1.1444 return *this;
1.1445 }
1.1446
1.1447 @@ -1182,33 +1198,34 @@
1.1448 }
1.1449 }
1.1450
1.1451 - _Digraph& digraph;
1.1452 + const _Digraph& digraph;
1.1453 };
1.1454 };
1.1455
1.1456 - /// \brief An empty mappable base bipartite graph class.
1.1457 + /// \brief Skeleton class for mappable undirected graphs.
1.1458 ///
1.1459 - /// This class provides beside the core graph features
1.1460 - /// map interface for the graph structure.
1.1461 + /// This class describes the interface of mappable undirected graphs.
1.1462 + /// It extends \ref MappableDigraphComponent with the standard graph
1.1463 + /// map class for edges (\c EdgeMap).
1.1464 /// This concept is part of the Graph concept.
1.1465 - template <typename _Base = BaseGraphComponent>
1.1466 - class MappableGraphComponent : public MappableDigraphComponent<_Base> {
1.1467 + template <typename BAS = BaseGraphComponent>
1.1468 + class MappableGraphComponent : public MappableDigraphComponent<BAS> {
1.1469 public:
1.1470
1.1471 - typedef _Base Base;
1.1472 + typedef BAS Base;
1.1473 typedef typename Base::Edge Edge;
1.1474
1.1475 typedef MappableGraphComponent Graph;
1.1476
1.1477 - /// \brief ReadWrite map of the edges.
1.1478 + /// \brief Standard graph map for the edges.
1.1479 ///
1.1480 - /// ReadWrite map of the edges.
1.1481 - ///
1.1482 - template <typename _Value>
1.1483 - class EdgeMap : public GraphMap<Graph, Edge, _Value> {
1.1484 + /// Standard graph map for the edges.
1.1485 + /// It conforms to the ReferenceMap concept.
1.1486 + template <typename V>
1.1487 + class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
1.1488 + typedef GraphMap<MappableGraphComponent, Edge, V> Parent;
1.1489 +
1.1490 public:
1.1491 - typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
1.1492 -
1.1493 /// \brief Construct a new map.
1.1494 ///
1.1495 /// Construct a new map for the graph.
1.1496 @@ -1217,8 +1234,8 @@
1.1497
1.1498 /// \brief Construct a new map with default value.
1.1499 ///
1.1500 - /// Construct a new map for the graph and initalise the values.
1.1501 - EdgeMap(const MappableGraphComponent& graph, const _Value& value)
1.1502 + /// Construct a new map for the graph and initalize the values.
1.1503 + EdgeMap(const MappableGraphComponent& graph, const V& value)
1.1504 : Parent(graph, value) {}
1.1505
1.1506 private:
1.1507 @@ -1227,12 +1244,12 @@
1.1508 /// Copy Constructor.
1.1509 EdgeMap(const EdgeMap& nm) : Parent(nm) {}
1.1510
1.1511 - /// \brief Assign operator.
1.1512 + /// \brief Assignment operator.
1.1513 ///
1.1514 - /// Assign operator.
1.1515 + /// Assignment operator.
1.1516 template <typename CMap>
1.1517 EdgeMap& operator=(const CMap&) {
1.1518 - checkConcept<ReadMap<Edge, _Value>, CMap>();
1.1519 + checkConcept<ReadMap<Edge, V>, CMap>();
1.1520 return *this;
1.1521 }
1.1522
1.1523 @@ -1249,7 +1266,7 @@
1.1524 };
1.1525
1.1526 void constraints() {
1.1527 - checkConcept<MappableGraphComponent<Base>, _Graph>();
1.1528 + checkConcept<MappableDigraphComponent<Base>, _Graph>();
1.1529
1.1530 { // int map test
1.1531 typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
1.1532 @@ -1266,35 +1283,35 @@
1.1533 }
1.1534 }
1.1535
1.1536 - _Graph& graph;
1.1537 + const _Graph& graph;
1.1538 };
1.1539 };
1.1540
1.1541 - /// \brief An empty extendable digraph class.
1.1542 + /// \brief Skeleton class for extendable directed graphs.
1.1543 ///
1.1544 - /// This class provides beside the core digraph features digraph
1.1545 - /// extendable interface for the digraph structure. The main
1.1546 - /// difference between the base and this interface is that the
1.1547 - /// digraph alterations should handled already on this level.
1.1548 - template <typename _Base = BaseDigraphComponent>
1.1549 - class ExtendableDigraphComponent : public _Base {
1.1550 + /// This class describes the interface of extendable directed graphs.
1.1551 + /// It extends \ref BaseDigraphComponent with functions for adding
1.1552 + /// nodes and arcs to the digraph.
1.1553 + /// This concept requires \ref AlterableDigraphComponent.
1.1554 + template <typename BAS = BaseDigraphComponent>
1.1555 + class ExtendableDigraphComponent : public BAS {
1.1556 public:
1.1557 - typedef _Base Base;
1.1558 + typedef BAS Base;
1.1559
1.1560 - typedef typename _Base::Node Node;
1.1561 - typedef typename _Base::Arc Arc;
1.1562 + typedef typename Base::Node Node;
1.1563 + typedef typename Base::Arc Arc;
1.1564
1.1565 - /// \brief Adds a new node to the digraph.
1.1566 + /// \brief Add a new node to the digraph.
1.1567 ///
1.1568 - /// Adds a new node to the digraph.
1.1569 - ///
1.1570 + /// This function adds a new node to the digraph.
1.1571 Node addNode() {
1.1572 return INVALID;
1.1573 }
1.1574
1.1575 - /// \brief Adds a new arc connects the given two nodes.
1.1576 + /// \brief Add a new arc connecting the given two nodes.
1.1577 ///
1.1578 - /// Adds a new arc connects the the given two nodes.
1.1579 + /// This function adds a new arc connecting the given two nodes
1.1580 + /// of the digraph.
1.1581 Arc addArc(const Node&, const Node&) {
1.1582 return INVALID;
1.1583 }
1.1584 @@ -1314,33 +1331,32 @@
1.1585 };
1.1586 };
1.1587
1.1588 - /// \brief An empty extendable base undirected graph class.
1.1589 + /// \brief Skeleton class for extendable undirected graphs.
1.1590 ///
1.1591 - /// This class provides beside the core undirected graph features
1.1592 - /// core undircted graph extend interface for the graph structure.
1.1593 - /// The main difference between the base and this interface is
1.1594 - /// that the graph alterations should handled already on this
1.1595 - /// level.
1.1596 - template <typename _Base = BaseGraphComponent>
1.1597 - class ExtendableGraphComponent : public _Base {
1.1598 + /// This class describes the interface of extendable undirected graphs.
1.1599 + /// It extends \ref BaseGraphComponent with functions for adding
1.1600 + /// nodes and edges to the graph.
1.1601 + /// This concept requires \ref AlterableGraphComponent.
1.1602 + template <typename BAS = BaseGraphComponent>
1.1603 + class ExtendableGraphComponent : public BAS {
1.1604 public:
1.1605
1.1606 - typedef _Base Base;
1.1607 - typedef typename _Base::Node Node;
1.1608 - typedef typename _Base::Edge Edge;
1.1609 + typedef BAS Base;
1.1610 + typedef typename Base::Node Node;
1.1611 + typedef typename Base::Edge Edge;
1.1612
1.1613 - /// \brief Adds a new node to the graph.
1.1614 + /// \brief Add a new node to the digraph.
1.1615 ///
1.1616 - /// Adds a new node to the graph.
1.1617 - ///
1.1618 + /// This function adds a new node to the digraph.
1.1619 Node addNode() {
1.1620 return INVALID;
1.1621 }
1.1622
1.1623 - /// \brief Adds a new arc connects the given two nodes.
1.1624 + /// \brief Add a new edge connecting the given two nodes.
1.1625 ///
1.1626 - /// Adds a new arc connects the the given two nodes.
1.1627 - Edge addArc(const Node&, const Node&) {
1.1628 + /// This function adds a new edge connecting the given two nodes
1.1629 + /// of the graph.
1.1630 + Edge addEdge(const Node&, const Node&) {
1.1631 return INVALID;
1.1632 }
1.1633
1.1634 @@ -1359,39 +1375,38 @@
1.1635 };
1.1636 };
1.1637
1.1638 - /// \brief An empty erasable digraph class.
1.1639 + /// \brief Skeleton class for erasable directed graphs.
1.1640 ///
1.1641 - /// This class provides beside the core digraph features core erase
1.1642 - /// functions for the digraph structure. The main difference between
1.1643 - /// the base and this interface is that the digraph alterations
1.1644 - /// should handled already on this level.
1.1645 - template <typename _Base = BaseDigraphComponent>
1.1646 - class ErasableDigraphComponent : public _Base {
1.1647 + /// This class describes the interface of erasable directed graphs.
1.1648 + /// It extends \ref BaseDigraphComponent with functions for removing
1.1649 + /// nodes and arcs from the digraph.
1.1650 + /// This concept requires \ref AlterableDigraphComponent.
1.1651 + template <typename BAS = BaseDigraphComponent>
1.1652 + class ErasableDigraphComponent : public BAS {
1.1653 public:
1.1654
1.1655 - typedef _Base Base;
1.1656 + typedef BAS Base;
1.1657 typedef typename Base::Node Node;
1.1658 typedef typename Base::Arc Arc;
1.1659
1.1660 /// \brief Erase a node from the digraph.
1.1661 ///
1.1662 - /// Erase a node from the digraph. This function should
1.1663 - /// erase all arcs connecting to the node.
1.1664 + /// This function erases the given node from the digraph and all arcs
1.1665 + /// connected to the node.
1.1666 void erase(const Node&) {}
1.1667
1.1668 /// \brief Erase an arc from the digraph.
1.1669 ///
1.1670 - /// Erase an arc from the digraph.
1.1671 - ///
1.1672 + /// This function erases the given arc from the digraph.
1.1673 void erase(const Arc&) {}
1.1674
1.1675 template <typename _Digraph>
1.1676 struct Constraints {
1.1677 void constraints() {
1.1678 checkConcept<Base, _Digraph>();
1.1679 - typename _Digraph::Node node;
1.1680 + const typename _Digraph::Node node(INVALID);
1.1681 digraph.erase(node);
1.1682 - typename _Digraph::Arc arc;
1.1683 + const typename _Digraph::Arc arc(INVALID);
1.1684 digraph.erase(arc);
1.1685 }
1.1686
1.1687 @@ -1399,39 +1414,38 @@
1.1688 };
1.1689 };
1.1690
1.1691 - /// \brief An empty erasable base undirected graph class.
1.1692 + /// \brief Skeleton class for erasable undirected graphs.
1.1693 ///
1.1694 - /// This class provides beside the core undirected graph features
1.1695 - /// core erase functions for the undirceted graph structure. The
1.1696 - /// main difference between the base and this interface is that
1.1697 - /// the graph alterations should handled already on this level.
1.1698 - template <typename _Base = BaseGraphComponent>
1.1699 - class ErasableGraphComponent : public _Base {
1.1700 + /// This class describes the interface of erasable undirected graphs.
1.1701 + /// It extends \ref BaseGraphComponent with functions for removing
1.1702 + /// nodes and edges from the graph.
1.1703 + /// This concept requires \ref AlterableGraphComponent.
1.1704 + template <typename BAS = BaseGraphComponent>
1.1705 + class ErasableGraphComponent : public BAS {
1.1706 public:
1.1707
1.1708 - typedef _Base Base;
1.1709 + typedef BAS Base;
1.1710 typedef typename Base::Node Node;
1.1711 typedef typename Base::Edge Edge;
1.1712
1.1713 /// \brief Erase a node from the graph.
1.1714 ///
1.1715 - /// Erase a node from the graph. This function should erase
1.1716 - /// arcs connecting to the node.
1.1717 + /// This function erases the given node from the graph and all edges
1.1718 + /// connected to the node.
1.1719 void erase(const Node&) {}
1.1720
1.1721 - /// \brief Erase an arc from the graph.
1.1722 + /// \brief Erase an edge from the digraph.
1.1723 ///
1.1724 - /// Erase an arc from the graph.
1.1725 - ///
1.1726 + /// This function erases the given edge from the digraph.
1.1727 void erase(const Edge&) {}
1.1728
1.1729 template <typename _Graph>
1.1730 struct Constraints {
1.1731 void constraints() {
1.1732 checkConcept<Base, _Graph>();
1.1733 - typename _Graph::Node node;
1.1734 + const typename _Graph::Node node(INVALID);
1.1735 graph.erase(node);
1.1736 - typename _Graph::Edge edge;
1.1737 + const typename _Graph::Edge edge(INVALID);
1.1738 graph.erase(edge);
1.1739 }
1.1740
1.1741 @@ -1439,22 +1453,21 @@
1.1742 };
1.1743 };
1.1744
1.1745 - /// \brief An empty clearable base digraph class.
1.1746 + /// \brief Skeleton class for clearable directed graphs.
1.1747 ///
1.1748 - /// This class provides beside the core digraph features core clear
1.1749 - /// functions for the digraph structure. The main difference between
1.1750 - /// the base and this interface is that the digraph alterations
1.1751 - /// should handled already on this level.
1.1752 - template <typename _Base = BaseDigraphComponent>
1.1753 - class ClearableDigraphComponent : public _Base {
1.1754 + /// This class describes the interface of clearable directed graphs.
1.1755 + /// It extends \ref BaseDigraphComponent with a function for clearing
1.1756 + /// the digraph.
1.1757 + /// This concept requires \ref AlterableDigraphComponent.
1.1758 + template <typename BAS = BaseDigraphComponent>
1.1759 + class ClearableDigraphComponent : public BAS {
1.1760 public:
1.1761
1.1762 - typedef _Base Base;
1.1763 + typedef BAS Base;
1.1764
1.1765 /// \brief Erase all nodes and arcs from the digraph.
1.1766 ///
1.1767 - /// Erase all nodes and arcs from the digraph.
1.1768 - ///
1.1769 + /// This function erases all nodes and arcs from the digraph.
1.1770 void clear() {}
1.1771
1.1772 template <typename _Digraph>
1.1773 @@ -1464,29 +1477,35 @@
1.1774 digraph.clear();
1.1775 }
1.1776
1.1777 - _Digraph digraph;
1.1778 + _Digraph& digraph;
1.1779 };
1.1780 };
1.1781
1.1782 - /// \brief An empty clearable base undirected graph class.
1.1783 + /// \brief Skeleton class for clearable undirected graphs.
1.1784 ///
1.1785 - /// This class provides beside the core undirected graph features
1.1786 - /// core clear functions for the undirected graph structure. The
1.1787 - /// main difference between the base and this interface is that
1.1788 - /// the graph alterations should handled already on this level.
1.1789 - template <typename _Base = BaseGraphComponent>
1.1790 - class ClearableGraphComponent : public ClearableDigraphComponent<_Base> {
1.1791 + /// This class describes the interface of clearable undirected graphs.
1.1792 + /// It extends \ref BaseGraphComponent with a function for clearing
1.1793 + /// the graph.
1.1794 + /// This concept requires \ref AlterableGraphComponent.
1.1795 + template <typename BAS = BaseGraphComponent>
1.1796 + class ClearableGraphComponent : public ClearableDigraphComponent<BAS> {
1.1797 public:
1.1798
1.1799 - typedef _Base Base;
1.1800 + typedef BAS Base;
1.1801 +
1.1802 + /// \brief Erase all nodes and edges from the graph.
1.1803 + ///
1.1804 + /// This function erases all nodes and edges from the graph.
1.1805 + void clear() {}
1.1806
1.1807 template <typename _Graph>
1.1808 struct Constraints {
1.1809 void constraints() {
1.1810 - checkConcept<ClearableGraphComponent<Base>, _Graph>();
1.1811 + checkConcept<Base, _Graph>();
1.1812 + graph.clear();
1.1813 }
1.1814
1.1815 - _Graph graph;
1.1816 + _Graph& graph;
1.1817 };
1.1818 };
1.1819