1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lemon/concepts/ugraph.h Tue Oct 24 17:19:16 2006 +0000
1.3 @@ -0,0 +1,713 @@
1.4 +/* -*- C++ -*-
1.5 + *
1.6 + * This file is a part of LEMON, a generic C++ optimization library
1.7 + *
1.8 + * Copyright (C) 2003-2006
1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 + *
1.12 + * Permission to use, modify and distribute this software is granted
1.13 + * provided that this copyright notice appears in all copies. For
1.14 + * precise terms see the accompanying LICENSE file.
1.15 + *
1.16 + * This software is provided "AS IS" with no warranty of any kind,
1.17 + * express or implied, and with no claim as to its suitability for any
1.18 + * purpose.
1.19 + *
1.20 + */
1.21 +
1.22 +///\ingroup graph_concepts
1.23 +///\file
1.24 +///\brief The concept of the undirected graphs.
1.25 +
1.26 +
1.27 +#ifndef LEMON_CONCEPT_UGRAPH_H
1.28 +#define LEMON_CONCEPT_UGRAPH_H
1.29 +
1.30 +#include <lemon/concepts/graph_components.h>
1.31 +#include <lemon/concepts/graph.h>
1.32 +#include <lemon/bits/utility.h>
1.33 +
1.34 +namespace lemon {
1.35 + namespace concepts {
1.36 +
1.37 + /// \addtogroup graph_concepts
1.38 + /// @{
1.39 +
1.40 +
1.41 + /// \brief Class describing the concept of Undirected Graphs.
1.42 + ///
1.43 + /// This class describes the common interface of all Undirected
1.44 + /// Graphs.
1.45 + ///
1.46 + /// As all concept describing classes it provides only interface
1.47 + /// without any sensible implementation. So any algorithm for
1.48 + /// undirected graph should compile with this class, but it will not
1.49 + /// run properly, of course.
1.50 + ///
1.51 + /// The LEMON undirected graphs also fulfill the concept of
1.52 + /// directed graphs (\ref lemon::concepts::Graph "Graph
1.53 + /// Concept"). Each undirected edges can be seen as two opposite
1.54 + /// directed edge and consequently the undirected graph can be
1.55 + /// seen as the direceted graph of these directed edges. The
1.56 + /// UGraph has the UEdge inner class for the undirected edges and
1.57 + /// the Edge type for the directed edges. The Edge type is
1.58 + /// convertible to UEdge or inherited from it so from a directed
1.59 + /// edge we can get the represented undirected edge.
1.60 + ///
1.61 + /// In the sense of the LEMON each undirected edge has a default
1.62 + /// direction (it should be in every computer implementation,
1.63 + /// because the order of undirected edge's nodes defines an
1.64 + /// orientation). With the default orientation we can define that
1.65 + /// the directed edge is forward or backward directed. With the \c
1.66 + /// direction() and \c direct() function we can get the direction
1.67 + /// of the directed edge and we can direct an undirected edge.
1.68 + ///
1.69 + /// The UEdgeIt is an iterator for the undirected edges. We can use
1.70 + /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and
1.71 + /// OutEdgeIt iterates on the same undirected edges but with opposite
1.72 + /// direction. The IncEdgeIt iterates also on the same undirected edges
1.73 + /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just
1.74 + /// to UEdge.
1.75 + class UGraph {
1.76 + public:
1.77 + /// \brief The undirected graph should be tagged by the
1.78 + /// UndirectedTag.
1.79 + ///
1.80 + /// The undirected graph should be tagged by the UndirectedTag. This
1.81 + /// tag helps the enable_if technics to make compile time
1.82 + /// specializations for undirected graphs.
1.83 + typedef True UndirectedTag;
1.84 +
1.85 + /// \brief The base type of node iterators,
1.86 + /// or in other words, the trivial node iterator.
1.87 + ///
1.88 + /// This is the base type of each node iterator,
1.89 + /// thus each kind of node iterator converts to this.
1.90 + /// More precisely each kind of node iterator should be inherited
1.91 + /// from the trivial node iterator.
1.92 + class Node {
1.93 + public:
1.94 + /// Default constructor
1.95 +
1.96 + /// @warning The default constructor sets the iterator
1.97 + /// to an undefined value.
1.98 + Node() { }
1.99 + /// Copy constructor.
1.100 +
1.101 + /// Copy constructor.
1.102 + ///
1.103 + Node(const Node&) { }
1.104 +
1.105 + /// Invalid constructor \& conversion.
1.106 +
1.107 + /// This constructor initializes the iterator to be invalid.
1.108 + /// \sa Invalid for more details.
1.109 + Node(Invalid) { }
1.110 + /// Equality operator
1.111 +
1.112 + /// Two iterators are equal if and only if they point to the
1.113 + /// same object or both are invalid.
1.114 + bool operator==(Node) const { return true; }
1.115 +
1.116 + /// Inequality operator
1.117 +
1.118 + /// \sa operator==(Node n)
1.119 + ///
1.120 + bool operator!=(Node) const { return true; }
1.121 +
1.122 + /// Artificial ordering operator.
1.123 +
1.124 + /// To allow the use of graph descriptors as key type in std::map or
1.125 + /// similar associative container we require this.
1.126 + ///
1.127 + /// \note This operator only have to define some strict ordering of
1.128 + /// the items; this order has nothing to do with the iteration
1.129 + /// ordering of the items.
1.130 + bool operator<(Node) const { return false; }
1.131 +
1.132 + };
1.133 +
1.134 + /// This iterator goes through each node.
1.135 +
1.136 + /// This iterator goes through each node.
1.137 + /// Its usage is quite simple, for example you can count the number
1.138 + /// of nodes in graph \c g of type \c Graph like this:
1.139 + ///\code
1.140 + /// int count=0;
1.141 + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
1.142 + ///\endcode
1.143 + class NodeIt : public Node {
1.144 + public:
1.145 + /// Default constructor
1.146 +
1.147 + /// @warning The default constructor sets the iterator
1.148 + /// to an undefined value.
1.149 + NodeIt() { }
1.150 + /// Copy constructor.
1.151 +
1.152 + /// Copy constructor.
1.153 + ///
1.154 + NodeIt(const NodeIt& n) : Node(n) { }
1.155 + /// Invalid constructor \& conversion.
1.156 +
1.157 + /// Initialize the iterator to be invalid.
1.158 + /// \sa Invalid for more details.
1.159 + NodeIt(Invalid) { }
1.160 + /// Sets the iterator to the first node.
1.161 +
1.162 + /// Sets the iterator to the first node of \c g.
1.163 + ///
1.164 + NodeIt(const UGraph&) { }
1.165 + /// Node -> NodeIt conversion.
1.166 +
1.167 + /// Sets the iterator to the node of \c the graph pointed by
1.168 + /// the trivial iterator.
1.169 + /// This feature necessitates that each time we
1.170 + /// iterate the edge-set, the iteration order is the same.
1.171 + NodeIt(const UGraph&, const Node&) { }
1.172 + /// Next node.
1.173 +
1.174 + /// Assign the iterator to the next node.
1.175 + ///
1.176 + NodeIt& operator++() { return *this; }
1.177 + };
1.178 +
1.179 +
1.180 + /// The base type of the undirected edge iterators.
1.181 +
1.182 + /// The base type of the undirected edge iterators.
1.183 + ///
1.184 + class UEdge {
1.185 + public:
1.186 + /// Default constructor
1.187 +
1.188 + /// @warning The default constructor sets the iterator
1.189 + /// to an undefined value.
1.190 + UEdge() { }
1.191 + /// Copy constructor.
1.192 +
1.193 + /// Copy constructor.
1.194 + ///
1.195 + UEdge(const UEdge&) { }
1.196 + /// Initialize the iterator to be invalid.
1.197 +
1.198 + /// Initialize the iterator to be invalid.
1.199 + ///
1.200 + UEdge(Invalid) { }
1.201 + /// Equality operator
1.202 +
1.203 + /// Two iterators are equal if and only if they point to the
1.204 + /// same object or both are invalid.
1.205 + bool operator==(UEdge) const { return true; }
1.206 + /// Inequality operator
1.207 +
1.208 + /// \sa operator==(UEdge n)
1.209 + ///
1.210 + bool operator!=(UEdge) const { return true; }
1.211 +
1.212 + /// Artificial ordering operator.
1.213 +
1.214 + /// To allow the use of graph descriptors as key type in std::map or
1.215 + /// similar associative container we require this.
1.216 + ///
1.217 + /// \note This operator only have to define some strict ordering of
1.218 + /// the items; this order has nothing to do with the iteration
1.219 + /// ordering of the items.
1.220 + bool operator<(UEdge) const { return false; }
1.221 + };
1.222 +
1.223 + /// This iterator goes through each undirected edge.
1.224 +
1.225 + /// This iterator goes through each undirected edge of a graph.
1.226 + /// Its usage is quite simple, for example you can count the number
1.227 + /// of undirected edges in a graph \c g of type \c Graph as follows:
1.228 + ///\code
1.229 + /// int count=0;
1.230 + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
1.231 + ///\endcode
1.232 + class UEdgeIt : public UEdge {
1.233 + public:
1.234 + /// Default constructor
1.235 +
1.236 + /// @warning The default constructor sets the iterator
1.237 + /// to an undefined value.
1.238 + UEdgeIt() { }
1.239 + /// Copy constructor.
1.240 +
1.241 + /// Copy constructor.
1.242 + ///
1.243 + UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
1.244 + /// Initialize the iterator to be invalid.
1.245 +
1.246 + /// Initialize the iterator to be invalid.
1.247 + ///
1.248 + UEdgeIt(Invalid) { }
1.249 + /// This constructor sets the iterator to the first undirected edge.
1.250 +
1.251 + /// This constructor sets the iterator to the first undirected edge.
1.252 + UEdgeIt(const UGraph&) { }
1.253 + /// UEdge -> UEdgeIt conversion
1.254 +
1.255 + /// Sets the iterator to the value of the trivial iterator.
1.256 + /// This feature necessitates that each time we
1.257 + /// iterate the undirected edge-set, the iteration order is the
1.258 + /// same.
1.259 + UEdgeIt(const UGraph&, const UEdge&) { }
1.260 + /// Next undirected edge
1.261 +
1.262 + /// Assign the iterator to the next undirected edge.
1.263 + UEdgeIt& operator++() { return *this; }
1.264 + };
1.265 +
1.266 + /// \brief This iterator goes trough the incident undirected
1.267 + /// edges of a node.
1.268 + ///
1.269 + /// This iterator goes trough the incident undirected edges
1.270 + /// of a certain node of a graph. You should assume that the
1.271 + /// loop edges will be iterated twice.
1.272 + ///
1.273 + /// Its usage is quite simple, for example you can compute the
1.274 + /// degree (i.e. count the number of incident edges of a node \c n
1.275 + /// in graph \c g of type \c Graph as follows.
1.276 + ///
1.277 + ///\code
1.278 + /// int count=0;
1.279 + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
1.280 + ///\endcode
1.281 + class IncEdgeIt : public UEdge {
1.282 + public:
1.283 + /// Default constructor
1.284 +
1.285 + /// @warning The default constructor sets the iterator
1.286 + /// to an undefined value.
1.287 + IncEdgeIt() { }
1.288 + /// Copy constructor.
1.289 +
1.290 + /// Copy constructor.
1.291 + ///
1.292 + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
1.293 + /// Initialize the iterator to be invalid.
1.294 +
1.295 + /// Initialize the iterator to be invalid.
1.296 + ///
1.297 + IncEdgeIt(Invalid) { }
1.298 + /// This constructor sets the iterator to first incident edge.
1.299 +
1.300 + /// This constructor set the iterator to the first incident edge of
1.301 + /// the node.
1.302 + IncEdgeIt(const UGraph&, const Node&) { }
1.303 + /// UEdge -> IncEdgeIt conversion
1.304 +
1.305 + /// Sets the iterator to the value of the trivial iterator \c e.
1.306 + /// This feature necessitates that each time we
1.307 + /// iterate the edge-set, the iteration order is the same.
1.308 + IncEdgeIt(const UGraph&, const UEdge&) { }
1.309 + /// Next incident edge
1.310 +
1.311 + /// Assign the iterator to the next incident edge
1.312 + /// of the corresponding node.
1.313 + IncEdgeIt& operator++() { return *this; }
1.314 + };
1.315 +
1.316 + /// The directed edge type.
1.317 +
1.318 + /// The directed edge type. It can be converted to the
1.319 + /// undirected edge or it should be inherited from the undirected
1.320 + /// edge.
1.321 + class Edge : public UEdge {
1.322 + public:
1.323 + /// Default constructor
1.324 +
1.325 + /// @warning The default constructor sets the iterator
1.326 + /// to an undefined value.
1.327 + Edge() { }
1.328 + /// Copy constructor.
1.329 +
1.330 + /// Copy constructor.
1.331 + ///
1.332 + Edge(const Edge& e) : UEdge(e) { }
1.333 + /// Initialize the iterator to be invalid.
1.334 +
1.335 + /// Initialize the iterator to be invalid.
1.336 + ///
1.337 + Edge(Invalid) { }
1.338 + /// Equality operator
1.339 +
1.340 + /// Two iterators are equal if and only if they point to the
1.341 + /// same object or both are invalid.
1.342 + bool operator==(Edge) const { return true; }
1.343 + /// Inequality operator
1.344 +
1.345 + /// \sa operator==(Edge n)
1.346 + ///
1.347 + bool operator!=(Edge) const { return true; }
1.348 +
1.349 + /// Artificial ordering operator.
1.350 +
1.351 + /// To allow the use of graph descriptors as key type in std::map or
1.352 + /// similar associative container we require this.
1.353 + ///
1.354 + /// \note This operator only have to define some strict ordering of
1.355 + /// the items; this order has nothing to do with the iteration
1.356 + /// ordering of the items.
1.357 + bool operator<(Edge) const { return false; }
1.358 +
1.359 + };
1.360 + /// This iterator goes through each directed edge.
1.361 +
1.362 + /// This iterator goes through each edge of a graph.
1.363 + /// Its usage is quite simple, for example you can count the number
1.364 + /// of edges in a graph \c g of type \c Graph as follows:
1.365 + ///\code
1.366 + /// int count=0;
1.367 + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
1.368 + ///\endcode
1.369 + class EdgeIt : public Edge {
1.370 + public:
1.371 + /// Default constructor
1.372 +
1.373 + /// @warning The default constructor sets the iterator
1.374 + /// to an undefined value.
1.375 + EdgeIt() { }
1.376 + /// Copy constructor.
1.377 +
1.378 + /// Copy constructor.
1.379 + ///
1.380 + EdgeIt(const EdgeIt& e) : Edge(e) { }
1.381 + /// Initialize the iterator to be invalid.
1.382 +
1.383 + /// Initialize the iterator to be invalid.
1.384 + ///
1.385 + EdgeIt(Invalid) { }
1.386 + /// This constructor sets the iterator to the first edge.
1.387 +
1.388 + /// This constructor sets the iterator to the first edge of \c g.
1.389 + ///@param g the graph
1.390 + EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); }
1.391 + /// Edge -> EdgeIt conversion
1.392 +
1.393 + /// Sets the iterator to the value of the trivial iterator \c e.
1.394 + /// This feature necessitates that each time we
1.395 + /// iterate the edge-set, the iteration order is the same.
1.396 + EdgeIt(const UGraph&, const Edge&) { }
1.397 + ///Next edge
1.398 +
1.399 + /// Assign the iterator to the next edge.
1.400 + EdgeIt& operator++() { return *this; }
1.401 + };
1.402 +
1.403 + /// This iterator goes trough the outgoing directed edges of a node.
1.404 +
1.405 + /// This iterator goes trough the \e outgoing edges of a certain node
1.406 + /// of a graph.
1.407 + /// Its usage is quite simple, for example you can count the number
1.408 + /// of outgoing edges of a node \c n
1.409 + /// in graph \c g of type \c Graph as follows.
1.410 + ///\code
1.411 + /// int count=0;
1.412 + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
1.413 + ///\endcode
1.414 +
1.415 + class OutEdgeIt : public Edge {
1.416 + public:
1.417 + /// Default constructor
1.418 +
1.419 + /// @warning The default constructor sets the iterator
1.420 + /// to an undefined value.
1.421 + OutEdgeIt() { }
1.422 + /// Copy constructor.
1.423 +
1.424 + /// Copy constructor.
1.425 + ///
1.426 + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
1.427 + /// Initialize the iterator to be invalid.
1.428 +
1.429 + /// Initialize the iterator to be invalid.
1.430 + ///
1.431 + OutEdgeIt(Invalid) { }
1.432 + /// This constructor sets the iterator to the first outgoing edge.
1.433 +
1.434 + /// This constructor sets the iterator to the first outgoing edge of
1.435 + /// the node.
1.436 + ///@param n the node
1.437 + ///@param g the graph
1.438 + OutEdgeIt(const UGraph& n, const Node& g) {
1.439 + ignore_unused_variable_warning(n);
1.440 + ignore_unused_variable_warning(g);
1.441 + }
1.442 + /// Edge -> OutEdgeIt conversion
1.443 +
1.444 + /// Sets the iterator to the value of the trivial iterator.
1.445 + /// This feature necessitates that each time we
1.446 + /// iterate the edge-set, the iteration order is the same.
1.447 + OutEdgeIt(const UGraph&, const Edge&) { }
1.448 + ///Next outgoing edge
1.449 +
1.450 + /// Assign the iterator to the next
1.451 + /// outgoing edge of the corresponding node.
1.452 + OutEdgeIt& operator++() { return *this; }
1.453 + };
1.454 +
1.455 + /// This iterator goes trough the incoming directed edges of a node.
1.456 +
1.457 + /// This iterator goes trough the \e incoming edges of a certain node
1.458 + /// of a graph.
1.459 + /// Its usage is quite simple, for example you can count the number
1.460 + /// of outgoing edges of a node \c n
1.461 + /// in graph \c g of type \c Graph as follows.
1.462 + ///\code
1.463 + /// int count=0;
1.464 + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
1.465 + ///\endcode
1.466 +
1.467 + class InEdgeIt : public Edge {
1.468 + public:
1.469 + /// Default constructor
1.470 +
1.471 + /// @warning The default constructor sets the iterator
1.472 + /// to an undefined value.
1.473 + InEdgeIt() { }
1.474 + /// Copy constructor.
1.475 +
1.476 + /// Copy constructor.
1.477 + ///
1.478 + InEdgeIt(const InEdgeIt& e) : Edge(e) { }
1.479 + /// Initialize the iterator to be invalid.
1.480 +
1.481 + /// Initialize the iterator to be invalid.
1.482 + ///
1.483 + InEdgeIt(Invalid) { }
1.484 + /// This constructor sets the iterator to first incoming edge.
1.485 +
1.486 + /// This constructor set the iterator to the first incoming edge of
1.487 + /// the node.
1.488 + ///@param n the node
1.489 + ///@param g the graph
1.490 + InEdgeIt(const UGraph& g, const Node& n) {
1.491 + ignore_unused_variable_warning(n);
1.492 + ignore_unused_variable_warning(g);
1.493 + }
1.494 + /// Edge -> InEdgeIt conversion
1.495 +
1.496 + /// Sets the iterator to the value of the trivial iterator \c e.
1.497 + /// This feature necessitates that each time we
1.498 + /// iterate the edge-set, the iteration order is the same.
1.499 + InEdgeIt(const UGraph&, const Edge&) { }
1.500 + /// Next incoming edge
1.501 +
1.502 + /// Assign the iterator to the next inedge of the corresponding node.
1.503 + ///
1.504 + InEdgeIt& operator++() { return *this; }
1.505 + };
1.506 +
1.507 + /// \brief Read write map of the nodes to type \c T.
1.508 + ///
1.509 + /// ReadWrite map of the nodes to type \c T.
1.510 + /// \sa Reference
1.511 + /// \warning Making maps that can handle bool type (NodeMap<bool>)
1.512 + /// needs some extra attention!
1.513 + template<class T>
1.514 + class NodeMap : public ReadWriteMap< Node, T >
1.515 + {
1.516 + public:
1.517 +
1.518 + ///\e
1.519 + NodeMap(const UGraph&) { }
1.520 + ///\e
1.521 + NodeMap(const UGraph&, T) { }
1.522 +
1.523 + ///Copy constructor
1.524 + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
1.525 + ///Assignment operator
1.526 + template <typename CMap>
1.527 + NodeMap& operator=(const CMap&) {
1.528 + checkConcept<ReadMap<Node, T>, CMap>();
1.529 + return *this;
1.530 + }
1.531 + };
1.532 +
1.533 + /// \brief Read write map of the directed edges to type \c T.
1.534 + ///
1.535 + /// Reference map of the directed edges to type \c T.
1.536 + /// \sa Reference
1.537 + /// \warning Making maps that can handle bool type (EdgeMap<bool>)
1.538 + /// needs some extra attention!
1.539 + template<class T>
1.540 + class EdgeMap : public ReadWriteMap<Edge,T>
1.541 + {
1.542 + public:
1.543 +
1.544 + ///\e
1.545 + EdgeMap(const UGraph&) { }
1.546 + ///\e
1.547 + EdgeMap(const UGraph&, T) { }
1.548 + ///Copy constructor
1.549 + EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
1.550 + ///Assignment operator
1.551 + template <typename CMap>
1.552 + EdgeMap& operator=(const CMap&) {
1.553 + checkConcept<ReadMap<Edge, T>, CMap>();
1.554 + return *this;
1.555 + }
1.556 + };
1.557 +
1.558 + /// Read write map of the undirected edges to type \c T.
1.559 +
1.560 + /// Reference map of the edges to type \c T.
1.561 + /// \sa Reference
1.562 + /// \warning Making maps that can handle bool type (UEdgeMap<bool>)
1.563 + /// needs some extra attention!
1.564 + template<class T>
1.565 + class UEdgeMap : public ReadWriteMap<UEdge,T>
1.566 + {
1.567 + public:
1.568 +
1.569 + ///\e
1.570 + UEdgeMap(const UGraph&) { }
1.571 + ///\e
1.572 + UEdgeMap(const UGraph&, T) { }
1.573 + ///Copy constructor
1.574 + UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
1.575 + ///Assignment operator
1.576 + template <typename CMap>
1.577 + UEdgeMap& operator=(const CMap&) {
1.578 + checkConcept<ReadMap<UEdge, T>, CMap>();
1.579 + return *this;
1.580 + }
1.581 + };
1.582 +
1.583 + /// \brief Direct the given undirected edge.
1.584 + ///
1.585 + /// Direct the given undirected edge. The returned edge source
1.586 + /// will be the given node.
1.587 + Edge direct(const UEdge&, const Node&) const {
1.588 + return INVALID;
1.589 + }
1.590 +
1.591 + /// \brief Direct the given undirected edge.
1.592 + ///
1.593 + /// Direct the given undirected edge. The returned edge
1.594 + /// represents the given undireted edge and the direction comes
1.595 + /// from the given bool. The source of the undirected edge and
1.596 + /// the directed edge is the same when the given bool is true.
1.597 + Edge direct(const UEdge&, bool) const {
1.598 + return INVALID;
1.599 + }
1.600 +
1.601 + /// \brief Returns true if the edge has default orientation.
1.602 + ///
1.603 + /// Returns whether the given directed edge is same orientation as
1.604 + /// the corresponding undirected edge's default orientation.
1.605 + bool direction(Edge) const { return true; }
1.606 +
1.607 + /// \brief Returns the opposite directed edge.
1.608 + ///
1.609 + /// Returns the opposite directed edge.
1.610 + Edge oppositeEdge(Edge) const { return INVALID; }
1.611 +
1.612 + /// \brief Opposite node on an edge
1.613 + ///
1.614 + /// \return the opposite of the given Node on the given UEdge
1.615 + Node oppositeNode(Node, UEdge) const { return INVALID; }
1.616 +
1.617 + /// \brief First node of the undirected edge.
1.618 + ///
1.619 + /// \return the first node of the given UEdge.
1.620 + ///
1.621 + /// Naturally undirected edges don't have direction and thus
1.622 + /// don't have source and target node. But we use these two methods
1.623 + /// to query the two nodes of the edge. The direction of the edge
1.624 + /// which arises this way is called the inherent direction of the
1.625 + /// undirected edge, and is used to define the "default" direction
1.626 + /// of the directed versions of the edges.
1.627 + /// \sa direction
1.628 + Node source(UEdge) const { return INVALID; }
1.629 +
1.630 + /// \brief Second node of the undirected edge.
1.631 + Node target(UEdge) const { return INVALID; }
1.632 +
1.633 + /// \brief Source node of the directed edge.
1.634 + Node source(Edge) const { return INVALID; }
1.635 +
1.636 + /// \brief Target node of the directed edge.
1.637 + Node target(Edge) const { return INVALID; }
1.638 +
1.639 + void first(Node&) const {}
1.640 + void next(Node&) const {}
1.641 +
1.642 + void first(UEdge&) const {}
1.643 + void next(UEdge&) const {}
1.644 +
1.645 + void first(Edge&) const {}
1.646 + void next(Edge&) const {}
1.647 +
1.648 + void firstOut(Edge&, Node) const {}
1.649 + void nextOut(Edge&) const {}
1.650 +
1.651 + void firstIn(Edge&, Node) const {}
1.652 + void nextIn(Edge&) const {}
1.653 +
1.654 +
1.655 + void firstInc(UEdge &, bool &, const Node &) const {}
1.656 + void nextInc(UEdge &, bool &) const {}
1.657 +
1.658 + /// \brief Base node of the iterator
1.659 + ///
1.660 + /// Returns the base node (the source in this case) of the iterator
1.661 + Node baseNode(OutEdgeIt e) const {
1.662 + return source(e);
1.663 + }
1.664 + /// \brief Running node of the iterator
1.665 + ///
1.666 + /// Returns the running node (the target in this case) of the
1.667 + /// iterator
1.668 + Node runningNode(OutEdgeIt e) const {
1.669 + return target(e);
1.670 + }
1.671 +
1.672 + /// \brief Base node of the iterator
1.673 + ///
1.674 + /// Returns the base node (the target in this case) of the iterator
1.675 + Node baseNode(InEdgeIt e) const {
1.676 + return target(e);
1.677 + }
1.678 + /// \brief Running node of the iterator
1.679 + ///
1.680 + /// Returns the running node (the source in this case) of the
1.681 + /// iterator
1.682 + Node runningNode(InEdgeIt e) const {
1.683 + return source(e);
1.684 + }
1.685 +
1.686 + /// \brief Base node of the iterator
1.687 + ///
1.688 + /// Returns the base node of the iterator
1.689 + Node baseNode(IncEdgeIt) const {
1.690 + return INVALID;
1.691 + }
1.692 +
1.693 + /// \brief Running node of the iterator
1.694 + ///
1.695 + /// Returns the running node of the iterator
1.696 + Node runningNode(IncEdgeIt) const {
1.697 + return INVALID;
1.698 + }
1.699 +
1.700 + template <typename Graph>
1.701 + struct Constraints {
1.702 + void constraints() {
1.703 + checkConcept<IterableUGraphComponent<>, Graph>();
1.704 + checkConcept<MappableUGraphComponent<>, Graph>();
1.705 + }
1.706 + };
1.707 +
1.708 + };
1.709 +
1.710 + /// @}
1.711 +
1.712 + }
1.713 +
1.714 +}
1.715 +
1.716 +#endif