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