alpar@2260: /* -*- C++ -*- alpar@2260: * alpar@2260: * This file is a part of LEMON, a generic C++ optimization library alpar@2260: * alpar@2260: * Copyright (C) 2003-2006 alpar@2260: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@2260: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@2260: * alpar@2260: * Permission to use, modify and distribute this software is granted alpar@2260: * provided that this copyright notice appears in all copies. For alpar@2260: * precise terms see the accompanying LICENSE file. alpar@2260: * alpar@2260: * This software is provided "AS IS" with no warranty of any kind, alpar@2260: * express or implied, and with no claim as to its suitability for any alpar@2260: * purpose. alpar@2260: * alpar@2260: */ alpar@2260: alpar@2260: ///\ingroup graph_concepts alpar@2260: ///\file alpar@2260: ///\brief The concept of the undirected graphs. alpar@2260: alpar@2260: alpar@2260: #ifndef LEMON_CONCEPT_UGRAPH_H alpar@2260: #define LEMON_CONCEPT_UGRAPH_H alpar@2260: alpar@2260: #include alpar@2260: #include alpar@2260: #include alpar@2260: alpar@2260: namespace lemon { alpar@2260: namespace concepts { alpar@2260: alpar@2260: /// \addtogroup graph_concepts alpar@2260: /// @{ alpar@2260: alpar@2260: alpar@2260: /// \brief Class describing the concept of Undirected Graphs. alpar@2260: /// alpar@2260: /// This class describes the common interface of all Undirected alpar@2260: /// Graphs. alpar@2260: /// alpar@2260: /// As all concept describing classes it provides only interface alpar@2260: /// without any sensible implementation. So any algorithm for alpar@2260: /// undirected graph should compile with this class, but it will not alpar@2260: /// run properly, of course. alpar@2260: /// alpar@2260: /// The LEMON undirected graphs also fulfill the concept of alpar@2260: /// directed graphs (\ref lemon::concepts::Graph "Graph alpar@2260: /// Concept"). Each undirected edges can be seen as two opposite alpar@2260: /// directed edge and consequently the undirected graph can be alpar@2260: /// seen as the direceted graph of these directed edges. The alpar@2260: /// UGraph has the UEdge inner class for the undirected edges and alpar@2260: /// the Edge type for the directed edges. The Edge type is alpar@2260: /// convertible to UEdge or inherited from it so from a directed alpar@2260: /// edge we can get the represented undirected edge. alpar@2260: /// alpar@2260: /// In the sense of the LEMON each undirected edge has a default alpar@2260: /// direction (it should be in every computer implementation, alpar@2260: /// because the order of undirected edge's nodes defines an alpar@2260: /// orientation). With the default orientation we can define that alpar@2260: /// the directed edge is forward or backward directed. With the \c alpar@2260: /// direction() and \c direct() function we can get the direction alpar@2260: /// of the directed edge and we can direct an undirected edge. alpar@2260: /// alpar@2260: /// The UEdgeIt is an iterator for the undirected edges. We can use alpar@2260: /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and alpar@2260: /// OutEdgeIt iterates on the same undirected edges but with opposite alpar@2260: /// direction. The IncEdgeIt iterates also on the same undirected edges alpar@2260: /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just alpar@2260: /// to UEdge. alpar@2260: class UGraph { alpar@2260: public: alpar@2260: /// \brief The undirected graph should be tagged by the alpar@2260: /// UndirectedTag. alpar@2260: /// alpar@2260: /// The undirected graph should be tagged by the UndirectedTag. This alpar@2260: /// tag helps the enable_if technics to make compile time alpar@2260: /// specializations for undirected graphs. alpar@2260: typedef True UndirectedTag; alpar@2260: alpar@2260: /// \brief The base type of node iterators, alpar@2260: /// or in other words, the trivial node iterator. alpar@2260: /// alpar@2260: /// This is the base type of each node iterator, alpar@2260: /// thus each kind of node iterator converts to this. alpar@2260: /// More precisely each kind of node iterator should be inherited alpar@2260: /// from the trivial node iterator. alpar@2260: class Node { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: Node() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: Node(const Node&) { } alpar@2260: alpar@2260: /// Invalid constructor \& conversion. alpar@2260: alpar@2260: /// This constructor initializes the iterator to be invalid. alpar@2260: /// \sa Invalid for more details. alpar@2260: Node(Invalid) { } alpar@2260: /// Equality operator alpar@2260: alpar@2260: /// Two iterators are equal if and only if they point to the alpar@2260: /// same object or both are invalid. alpar@2260: bool operator==(Node) const { return true; } alpar@2260: alpar@2260: /// Inequality operator alpar@2260: alpar@2260: /// \sa operator==(Node n) alpar@2260: /// alpar@2260: bool operator!=(Node) const { return true; } alpar@2260: alpar@2260: /// Artificial ordering operator. alpar@2260: alpar@2260: /// To allow the use of graph descriptors as key type in std::map or alpar@2260: /// similar associative container we require this. alpar@2260: /// alpar@2260: /// \note This operator only have to define some strict ordering of alpar@2260: /// the items; this order has nothing to do with the iteration alpar@2260: /// ordering of the items. alpar@2260: bool operator<(Node) const { return false; } alpar@2260: alpar@2260: }; alpar@2260: alpar@2260: /// This iterator goes through each node. alpar@2260: alpar@2260: /// This iterator goes through each node. alpar@2260: /// Its usage is quite simple, for example you can count the number alpar@2260: /// of nodes in graph \c g of type \c Graph like this: alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; alpar@2260: ///\endcode alpar@2260: class NodeIt : public Node { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: NodeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: NodeIt(const NodeIt& n) : Node(n) { } alpar@2260: /// Invalid constructor \& conversion. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// \sa Invalid for more details. alpar@2260: NodeIt(Invalid) { } alpar@2260: /// Sets the iterator to the first node. alpar@2260: alpar@2260: /// Sets the iterator to the first node of \c g. alpar@2260: /// alpar@2260: NodeIt(const UGraph&) { } alpar@2260: /// Node -> NodeIt conversion. alpar@2260: alpar@2260: /// Sets the iterator to the node of \c the graph pointed by alpar@2260: /// the trivial iterator. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the edge-set, the iteration order is the same. alpar@2260: NodeIt(const UGraph&, const Node&) { } alpar@2260: /// Next node. alpar@2260: alpar@2260: /// Assign the iterator to the next node. alpar@2260: /// alpar@2260: NodeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: alpar@2260: /// The base type of the undirected edge iterators. alpar@2260: alpar@2260: /// The base type of the undirected edge iterators. alpar@2260: /// alpar@2260: class UEdge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: UEdge() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: UEdge(const UEdge&) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: UEdge(Invalid) { } alpar@2260: /// Equality operator alpar@2260: alpar@2260: /// Two iterators are equal if and only if they point to the alpar@2260: /// same object or both are invalid. alpar@2260: bool operator==(UEdge) const { return true; } alpar@2260: /// Inequality operator alpar@2260: alpar@2260: /// \sa operator==(UEdge n) alpar@2260: /// alpar@2260: bool operator!=(UEdge) const { return true; } alpar@2260: alpar@2260: /// Artificial ordering operator. alpar@2260: alpar@2260: /// To allow the use of graph descriptors as key type in std::map or alpar@2260: /// similar associative container we require this. alpar@2260: /// alpar@2260: /// \note This operator only have to define some strict ordering of alpar@2260: /// the items; this order has nothing to do with the iteration alpar@2260: /// ordering of the items. alpar@2260: bool operator<(UEdge) const { return false; } alpar@2260: }; alpar@2260: alpar@2260: /// This iterator goes through each undirected edge. alpar@2260: alpar@2260: /// This iterator goes through each undirected edge of a graph. alpar@2260: /// Its usage is quite simple, for example you can count the number alpar@2260: /// of undirected edges in a graph \c g of type \c Graph as follows: alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; alpar@2260: ///\endcode alpar@2260: class UEdgeIt : public UEdge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: UEdgeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: UEdgeIt(const UEdgeIt& e) : UEdge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: UEdgeIt(Invalid) { } alpar@2260: /// This constructor sets the iterator to the first undirected edge. alpar@2260: alpar@2260: /// This constructor sets the iterator to the first undirected edge. alpar@2260: UEdgeIt(const UGraph&) { } alpar@2260: /// UEdge -> UEdgeIt conversion alpar@2260: alpar@2260: /// Sets the iterator to the value of the trivial iterator. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the undirected edge-set, the iteration order is the alpar@2260: /// same. alpar@2260: UEdgeIt(const UGraph&, const UEdge&) { } alpar@2260: /// Next undirected edge alpar@2260: alpar@2260: /// Assign the iterator to the next undirected edge. alpar@2260: UEdgeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: /// \brief This iterator goes trough the incident undirected alpar@2260: /// edges of a node. alpar@2260: /// alpar@2260: /// This iterator goes trough the incident undirected edges alpar@2260: /// of a certain node of a graph. You should assume that the alpar@2260: /// loop edges will be iterated twice. alpar@2260: /// alpar@2260: /// Its usage is quite simple, for example you can compute the alpar@2260: /// degree (i.e. count the number of incident edges of a node \c n alpar@2260: /// in graph \c g of type \c Graph as follows. alpar@2260: /// alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; alpar@2260: ///\endcode alpar@2260: class IncEdgeIt : public UEdge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: IncEdgeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: IncEdgeIt(Invalid) { } alpar@2260: /// This constructor sets the iterator to first incident edge. alpar@2260: alpar@2260: /// This constructor set the iterator to the first incident edge of alpar@2260: /// the node. alpar@2260: IncEdgeIt(const UGraph&, const Node&) { } alpar@2260: /// UEdge -> IncEdgeIt conversion alpar@2260: alpar@2260: /// Sets the iterator to the value of the trivial iterator \c e. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the edge-set, the iteration order is the same. alpar@2260: IncEdgeIt(const UGraph&, const UEdge&) { } alpar@2260: /// Next incident edge alpar@2260: alpar@2260: /// Assign the iterator to the next incident edge alpar@2260: /// of the corresponding node. alpar@2260: IncEdgeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: /// The directed edge type. alpar@2260: alpar@2260: /// The directed edge type. It can be converted to the alpar@2260: /// undirected edge or it should be inherited from the undirected alpar@2260: /// edge. alpar@2260: class Edge : public UEdge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: Edge() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: Edge(const Edge& e) : UEdge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: Edge(Invalid) { } alpar@2260: /// Equality operator alpar@2260: alpar@2260: /// Two iterators are equal if and only if they point to the alpar@2260: /// same object or both are invalid. alpar@2260: bool operator==(Edge) const { return true; } alpar@2260: /// Inequality operator alpar@2260: alpar@2260: /// \sa operator==(Edge n) alpar@2260: /// alpar@2260: bool operator!=(Edge) const { return true; } alpar@2260: alpar@2260: /// Artificial ordering operator. alpar@2260: alpar@2260: /// To allow the use of graph descriptors as key type in std::map or alpar@2260: /// similar associative container we require this. alpar@2260: /// alpar@2260: /// \note This operator only have to define some strict ordering of alpar@2260: /// the items; this order has nothing to do with the iteration alpar@2260: /// ordering of the items. alpar@2260: bool operator<(Edge) const { return false; } alpar@2260: alpar@2260: }; alpar@2260: /// This iterator goes through each directed edge. alpar@2260: alpar@2260: /// This iterator goes through each edge of a graph. alpar@2260: /// Its usage is quite simple, for example you can count the number alpar@2260: /// of edges in a graph \c g of type \c Graph as follows: alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; alpar@2260: ///\endcode alpar@2260: class EdgeIt : public Edge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: EdgeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: EdgeIt(const EdgeIt& e) : Edge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: EdgeIt(Invalid) { } alpar@2260: /// This constructor sets the iterator to the first edge. alpar@2260: alpar@2260: /// This constructor sets the iterator to the first edge of \c g. alpar@2260: ///@param g the graph alpar@2260: EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); } alpar@2260: /// Edge -> EdgeIt conversion alpar@2260: alpar@2260: /// Sets the iterator to the value of the trivial iterator \c e. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the edge-set, the iteration order is the same. alpar@2260: EdgeIt(const UGraph&, const Edge&) { } alpar@2260: ///Next edge alpar@2260: alpar@2260: /// Assign the iterator to the next edge. alpar@2260: EdgeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: /// This iterator goes trough the outgoing directed edges of a node. alpar@2260: alpar@2260: /// This iterator goes trough the \e outgoing edges of a certain node alpar@2260: /// of a graph. alpar@2260: /// Its usage is quite simple, for example you can count the number alpar@2260: /// of outgoing edges of a node \c n alpar@2260: /// in graph \c g of type \c Graph as follows. alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; alpar@2260: ///\endcode alpar@2260: alpar@2260: class OutEdgeIt : public Edge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: OutEdgeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: OutEdgeIt(Invalid) { } alpar@2260: /// This constructor sets the iterator to the first outgoing edge. alpar@2260: alpar@2260: /// This constructor sets the iterator to the first outgoing edge of alpar@2260: /// the node. alpar@2260: ///@param n the node alpar@2260: ///@param g the graph alpar@2260: OutEdgeIt(const UGraph& n, const Node& g) { alpar@2260: ignore_unused_variable_warning(n); alpar@2260: ignore_unused_variable_warning(g); alpar@2260: } alpar@2260: /// Edge -> OutEdgeIt conversion alpar@2260: alpar@2260: /// Sets the iterator to the value of the trivial iterator. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the edge-set, the iteration order is the same. alpar@2260: OutEdgeIt(const UGraph&, const Edge&) { } alpar@2260: ///Next outgoing edge alpar@2260: alpar@2260: /// Assign the iterator to the next alpar@2260: /// outgoing edge of the corresponding node. alpar@2260: OutEdgeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: /// This iterator goes trough the incoming directed edges of a node. alpar@2260: alpar@2260: /// This iterator goes trough the \e incoming edges of a certain node alpar@2260: /// of a graph. alpar@2260: /// Its usage is quite simple, for example you can count the number alpar@2260: /// of outgoing edges of a node \c n alpar@2260: /// in graph \c g of type \c Graph as follows. alpar@2260: ///\code alpar@2260: /// int count=0; alpar@2260: /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; alpar@2260: ///\endcode alpar@2260: alpar@2260: class InEdgeIt : public Edge { alpar@2260: public: alpar@2260: /// Default constructor alpar@2260: alpar@2260: /// @warning The default constructor sets the iterator alpar@2260: /// to an undefined value. alpar@2260: InEdgeIt() { } alpar@2260: /// Copy constructor. alpar@2260: alpar@2260: /// Copy constructor. alpar@2260: /// alpar@2260: InEdgeIt(const InEdgeIt& e) : Edge(e) { } alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: alpar@2260: /// Initialize the iterator to be invalid. alpar@2260: /// alpar@2260: InEdgeIt(Invalid) { } alpar@2260: /// This constructor sets the iterator to first incoming edge. alpar@2260: alpar@2260: /// This constructor set the iterator to the first incoming edge of alpar@2260: /// the node. alpar@2260: ///@param n the node alpar@2260: ///@param g the graph alpar@2260: InEdgeIt(const UGraph& g, const Node& n) { alpar@2260: ignore_unused_variable_warning(n); alpar@2260: ignore_unused_variable_warning(g); alpar@2260: } alpar@2260: /// Edge -> InEdgeIt conversion alpar@2260: alpar@2260: /// Sets the iterator to the value of the trivial iterator \c e. alpar@2260: /// This feature necessitates that each time we alpar@2260: /// iterate the edge-set, the iteration order is the same. alpar@2260: InEdgeIt(const UGraph&, const Edge&) { } alpar@2260: /// Next incoming edge alpar@2260: alpar@2260: /// Assign the iterator to the next inedge of the corresponding node. alpar@2260: /// alpar@2260: InEdgeIt& operator++() { return *this; } alpar@2260: }; alpar@2260: alpar@2260: /// \brief Read write map of the nodes to type \c T. alpar@2260: /// alpar@2260: /// ReadWrite map of the nodes to type \c T. alpar@2260: /// \sa Reference alpar@2260: /// \warning Making maps that can handle bool type (NodeMap) alpar@2260: /// needs some extra attention! alpar@2260: template alpar@2260: class NodeMap : public ReadWriteMap< Node, T > alpar@2260: { alpar@2260: public: alpar@2260: alpar@2260: ///\e alpar@2260: NodeMap(const UGraph&) { } alpar@2260: ///\e alpar@2260: NodeMap(const UGraph&, T) { } alpar@2260: alpar@2260: ///Copy constructor alpar@2260: NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } alpar@2260: ///Assignment operator alpar@2260: template alpar@2260: NodeMap& operator=(const CMap&) { alpar@2260: checkConcept, CMap>(); alpar@2260: return *this; alpar@2260: } alpar@2260: }; alpar@2260: alpar@2260: /// \brief Read write map of the directed edges to type \c T. alpar@2260: /// alpar@2260: /// Reference map of the directed edges to type \c T. alpar@2260: /// \sa Reference alpar@2260: /// \warning Making maps that can handle bool type (EdgeMap) alpar@2260: /// needs some extra attention! alpar@2260: template alpar@2260: class EdgeMap : public ReadWriteMap alpar@2260: { alpar@2260: public: alpar@2260: alpar@2260: ///\e alpar@2260: EdgeMap(const UGraph&) { } alpar@2260: ///\e alpar@2260: EdgeMap(const UGraph&, T) { } alpar@2260: ///Copy constructor alpar@2260: EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } alpar@2260: ///Assignment operator alpar@2260: template alpar@2260: EdgeMap& operator=(const CMap&) { alpar@2260: checkConcept, CMap>(); alpar@2260: return *this; alpar@2260: } alpar@2260: }; alpar@2260: alpar@2260: /// Read write map of the undirected edges to type \c T. alpar@2260: alpar@2260: /// Reference map of the edges to type \c T. alpar@2260: /// \sa Reference alpar@2260: /// \warning Making maps that can handle bool type (UEdgeMap) alpar@2260: /// needs some extra attention! alpar@2260: template alpar@2260: class UEdgeMap : public ReadWriteMap alpar@2260: { alpar@2260: public: alpar@2260: alpar@2260: ///\e alpar@2260: UEdgeMap(const UGraph&) { } alpar@2260: ///\e alpar@2260: UEdgeMap(const UGraph&, T) { } alpar@2260: ///Copy constructor alpar@2260: UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} alpar@2260: ///Assignment operator alpar@2260: template alpar@2260: UEdgeMap& operator=(const CMap&) { alpar@2260: checkConcept, CMap>(); alpar@2260: return *this; alpar@2260: } alpar@2260: }; alpar@2260: alpar@2260: /// \brief Direct the given undirected edge. alpar@2260: /// alpar@2260: /// Direct the given undirected edge. The returned edge source alpar@2260: /// will be the given node. alpar@2260: Edge direct(const UEdge&, const Node&) const { alpar@2260: return INVALID; alpar@2260: } alpar@2260: alpar@2260: /// \brief Direct the given undirected edge. alpar@2260: /// alpar@2260: /// Direct the given undirected edge. The returned edge alpar@2260: /// represents the given undireted edge and the direction comes alpar@2260: /// from the given bool. The source of the undirected edge and alpar@2260: /// the directed edge is the same when the given bool is true. alpar@2260: Edge direct(const UEdge&, bool) const { alpar@2260: return INVALID; alpar@2260: } alpar@2260: alpar@2260: /// \brief Returns true if the edge has default orientation. alpar@2260: /// alpar@2260: /// Returns whether the given directed edge is same orientation as alpar@2260: /// the corresponding undirected edge's default orientation. alpar@2260: bool direction(Edge) const { return true; } alpar@2260: alpar@2260: /// \brief Returns the opposite directed edge. alpar@2260: /// alpar@2260: /// Returns the opposite directed edge. alpar@2260: Edge oppositeEdge(Edge) const { return INVALID; } alpar@2260: alpar@2260: /// \brief Opposite node on an edge alpar@2260: /// alpar@2260: /// \return the opposite of the given Node on the given UEdge alpar@2260: Node oppositeNode(Node, UEdge) const { return INVALID; } alpar@2260: alpar@2260: /// \brief First node of the undirected edge. alpar@2260: /// alpar@2260: /// \return the first node of the given UEdge. alpar@2260: /// alpar@2260: /// Naturally undirected edges don't have direction and thus alpar@2260: /// don't have source and target node. But we use these two methods alpar@2260: /// to query the two nodes of the edge. The direction of the edge alpar@2260: /// which arises this way is called the inherent direction of the alpar@2260: /// undirected edge, and is used to define the "default" direction alpar@2260: /// of the directed versions of the edges. alpar@2260: /// \sa direction alpar@2260: Node source(UEdge) const { return INVALID; } alpar@2260: alpar@2260: /// \brief Second node of the undirected edge. alpar@2260: Node target(UEdge) const { return INVALID; } alpar@2260: alpar@2260: /// \brief Source node of the directed edge. alpar@2260: Node source(Edge) const { return INVALID; } alpar@2260: alpar@2260: /// \brief Target node of the directed edge. alpar@2260: Node target(Edge) const { return INVALID; } alpar@2260: alpar@2260: void first(Node&) const {} alpar@2260: void next(Node&) const {} alpar@2260: alpar@2260: void first(UEdge&) const {} alpar@2260: void next(UEdge&) const {} alpar@2260: alpar@2260: void first(Edge&) const {} alpar@2260: void next(Edge&) const {} alpar@2260: alpar@2260: void firstOut(Edge&, Node) const {} alpar@2260: void nextOut(Edge&) const {} alpar@2260: alpar@2260: void firstIn(Edge&, Node) const {} alpar@2260: void nextIn(Edge&) const {} alpar@2260: alpar@2260: alpar@2260: void firstInc(UEdge &, bool &, const Node &) const {} alpar@2260: void nextInc(UEdge &, bool &) const {} alpar@2260: alpar@2260: /// \brief Base node of the iterator alpar@2260: /// alpar@2260: /// Returns the base node (the source in this case) of the iterator alpar@2260: Node baseNode(OutEdgeIt e) const { alpar@2260: return source(e); alpar@2260: } alpar@2260: /// \brief Running node of the iterator alpar@2260: /// alpar@2260: /// Returns the running node (the target in this case) of the alpar@2260: /// iterator alpar@2260: Node runningNode(OutEdgeIt e) const { alpar@2260: return target(e); alpar@2260: } alpar@2260: alpar@2260: /// \brief Base node of the iterator alpar@2260: /// alpar@2260: /// Returns the base node (the target in this case) of the iterator alpar@2260: Node baseNode(InEdgeIt e) const { alpar@2260: return target(e); alpar@2260: } alpar@2260: /// \brief Running node of the iterator alpar@2260: /// alpar@2260: /// Returns the running node (the source in this case) of the alpar@2260: /// iterator alpar@2260: Node runningNode(InEdgeIt e) const { alpar@2260: return source(e); alpar@2260: } alpar@2260: alpar@2260: /// \brief Base node of the iterator alpar@2260: /// alpar@2260: /// Returns the base node of the iterator alpar@2260: Node baseNode(IncEdgeIt) const { alpar@2260: return INVALID; alpar@2260: } alpar@2260: alpar@2260: /// \brief Running node of the iterator alpar@2260: /// alpar@2260: /// Returns the running node of the iterator alpar@2260: Node runningNode(IncEdgeIt) const { alpar@2260: return INVALID; alpar@2260: } alpar@2260: alpar@2260: template alpar@2260: struct Constraints { alpar@2260: void constraints() { alpar@2260: checkConcept, Graph>(); alpar@2260: checkConcept, Graph>(); alpar@2260: } alpar@2260: }; alpar@2260: alpar@2260: }; alpar@2260: alpar@2260: /// @} alpar@2260: alpar@2260: } alpar@2260: alpar@2260: } alpar@2260: alpar@2260: #endif