alpar@209: /* -*- mode: C++; indent-tabs-mode: nil; -*- deba@57: * alpar@209: * This file is a part of LEMON, a generic C++ optimization library. deba@57: * alpar@877: * Copyright (C) 2003-2010 deba@57: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport deba@57: * (Egervary Research Group on Combinatorial Optimization, EGRES). deba@57: * deba@57: * Permission to use, modify and distribute this software is granted deba@57: * provided that this copyright notice appears in all copies. For deba@57: * precise terms see the accompanying LICENSE file. deba@57: * deba@57: * This software is provided "AS IS" with no warranty of any kind, deba@57: * express or implied, and with no claim as to its suitability for any deba@57: * purpose. deba@57: * deba@57: */ deba@57: deba@57: ///\ingroup graph_concepts deba@57: ///\file kpeter@734: ///\brief The concept of undirected graphs. deba@57: deba@529: #ifndef LEMON_CONCEPTS_GRAPH_H deba@529: #define LEMON_CONCEPTS_GRAPH_H deba@57: deba@57: #include kpeter@734: #include kpeter@734: #include deba@220: #include deba@57: deba@57: namespace lemon { deba@57: namespace concepts { deba@57: deba@57: /// \ingroup graph_concepts deba@57: /// kpeter@734: /// \brief Class describing the concept of undirected graphs. deba@57: /// kpeter@734: /// This class describes the common interface of all undirected kpeter@734: /// graphs. deba@57: /// kpeter@734: /// Like all concept classes, it only provides an interface kpeter@734: /// without any sensible implementation. So any general algorithm for kpeter@734: /// undirected graphs should compile with this class, but it will not deba@57: /// run properly, of course. kpeter@734: /// An actual graph implementation like \ref ListGraph or alpar@877: /// \ref SmartGraph may have additional functionality. deba@57: /// kpeter@734: /// The undirected graphs also fulfill the concept of \ref Digraph kpeter@734: /// "directed graphs", since each edge can also be regarded as two kpeter@734: /// oppositely directed arcs. kpeter@734: /// Undirected graphs provide an Edge type for the undirected edges and kpeter@734: /// an Arc type for the directed arcs. The Arc type is convertible to kpeter@734: /// Edge or inherited from it, i.e. the corresponding edge can be kpeter@734: /// obtained from an arc. kpeter@734: /// EdgeIt and EdgeMap classes can be used for the edges, while ArcIt kpeter@734: /// and ArcMap classes can be used for the arcs (just like in digraphs). kpeter@734: /// Both InArcIt and OutArcIt iterates on the same edges but with kpeter@734: /// opposite direction. IncEdgeIt also iterates on the same edges kpeter@734: /// as OutArcIt and InArcIt, but it is not convertible to Arc, kpeter@734: /// only to Edge. deba@57: /// kpeter@734: /// In LEMON, each undirected edge has an inherent orientation. kpeter@734: /// Thus it can defined if an arc is forward or backward oriented in kpeter@734: /// an undirected graph with respect to this default oriantation of kpeter@734: /// the represented edge. kpeter@734: /// With the direction() and direct() functions the direction kpeter@734: /// of an arc can be obtained and set, respectively. deba@57: /// kpeter@734: /// Only nodes and edges can be added to or removed from an undirected kpeter@734: /// graph and the corresponding arcs are added or removed automatically. kpeter@734: /// kpeter@734: /// \sa Digraph deba@57: class Graph { kpeter@734: private: kpeter@734: /// Graphs are \e not copy constructible. Use DigraphCopy instead. kpeter@734: Graph(const Graph&) {} kpeter@734: /// \brief Assignment of a graph to another one is \e not allowed. kpeter@734: /// Use DigraphCopy instead. kpeter@734: void operator=(const Graph&) {} kpeter@734: deba@57: public: kpeter@734: /// Default constructor. kpeter@734: Graph() {} kpeter@734: kpeter@734: /// \brief Undirected graphs should be tagged with \c UndirectedTag. deba@57: /// kpeter@734: /// Undirected graphs should be tagged with \c UndirectedTag. alpar@877: /// kpeter@734: /// This tag helps the \c enable_if technics to make compile time alpar@209: /// specializations for undirected graphs. deba@57: typedef True UndirectedTag; deba@57: kpeter@734: /// The node type of the graph kpeter@734: kpeter@734: /// This class identifies a node of the graph. It also serves kpeter@734: /// as a base class of the node iterators, kpeter@734: /// thus they convert to this type. deba@57: class Node { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the object to an undefined value. deba@57: Node() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: Node(const Node&) { } deba@57: kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the object to be invalid. deba@57: /// \sa Invalid for more details. deba@57: Node(Invalid) { } deba@57: /// Equality operator deba@57: kpeter@734: /// Equality operator. kpeter@734: /// deba@57: /// Two iterators are equal if and only if they point to the kpeter@734: /// same object or both are \c INVALID. deba@57: bool operator==(Node) const { return true; } deba@57: deba@57: /// Inequality operator alpar@209: kpeter@734: /// Inequality operator. deba@57: bool operator!=(Node) const { return true; } deba@57: alpar@209: /// Artificial ordering operator. alpar@209: kpeter@734: /// Artificial ordering operator. alpar@209: /// kpeter@734: /// \note This operator only has to define some strict ordering of alpar@209: /// the items; this order has nothing to do with the iteration alpar@209: /// ordering of the items. alpar@209: bool operator<(Node) const { return false; } deba@57: deba@57: }; alpar@209: kpeter@734: /// Iterator class for the nodes. deba@57: kpeter@734: /// This iterator goes through each node of the graph. kpeter@786: /// Its usage is quite simple, for example, you can count the number kpeter@734: /// of nodes in a graph \c g of type \c %Graph like this: deba@57: ///\code deba@57: /// int count=0; deba@57: /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; deba@57: ///\endcode deba@57: class NodeIt : public Node { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@57: NodeIt() { } deba@57: /// Copy constructor. alpar@209: deba@57: /// Copy constructor. deba@57: /// deba@57: NodeIt(const NodeIt& n) : Node(n) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. deba@57: /// \sa Invalid for more details. deba@57: NodeIt(Invalid) { } deba@57: /// Sets the iterator to the first node. deba@57: kpeter@734: /// Sets the iterator to the first node of the given digraph. deba@57: /// kpeter@734: explicit NodeIt(const Graph&) { } kpeter@734: /// Sets the iterator to the given node. deba@57: kpeter@734: /// Sets the iterator to the given node of the given digraph. kpeter@734: /// deba@57: NodeIt(const Graph&, const Node&) { } deba@57: /// Next node. deba@57: deba@57: /// Assign the iterator to the next node. deba@57: /// deba@57: NodeIt& operator++() { return *this; } deba@57: }; alpar@209: alpar@209: kpeter@734: /// The edge type of the graph deba@57: kpeter@734: /// This class identifies an edge of the graph. It also serves kpeter@734: /// as a base class of the edge iterators, kpeter@734: /// thus they will convert to this type. deba@57: class Edge { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the object to an undefined value. deba@57: Edge() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: Edge(const Edge&) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the object to be invalid. kpeter@734: /// \sa Invalid for more details. deba@57: Edge(Invalid) { } deba@57: /// Equality operator deba@57: kpeter@734: /// Equality operator. kpeter@734: /// deba@57: /// Two iterators are equal if and only if they point to the kpeter@734: /// same object or both are \c INVALID. deba@57: bool operator==(Edge) const { return true; } deba@57: /// Inequality operator deba@57: kpeter@734: /// Inequality operator. deba@57: bool operator!=(Edge) const { return true; } deba@57: alpar@209: /// Artificial ordering operator. alpar@209: kpeter@734: /// Artificial ordering operator. alpar@209: /// kpeter@734: /// \note This operator only has to define some strict ordering of kpeter@734: /// the edges; this order has nothing to do with the iteration kpeter@734: /// ordering of the edges. alpar@209: bool operator<(Edge) const { return false; } deba@57: }; deba@57: kpeter@734: /// Iterator class for the edges. deba@57: kpeter@734: /// This iterator goes through each edge of the graph. kpeter@786: /// Its usage is quite simple, for example, you can count the number kpeter@734: /// of edges in a graph \c g of type \c %Graph as follows: deba@57: ///\code deba@57: /// int count=0; deba@57: /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; deba@57: ///\endcode deba@57: class EdgeIt : public Edge { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@57: EdgeIt() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: EdgeIt(const EdgeIt& e) : Edge(e) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. kpeter@734: /// \sa Invalid for more details. kpeter@734: EdgeIt(Invalid) { } kpeter@734: /// Sets the iterator to the first edge. kpeter@734: kpeter@734: /// Sets the iterator to the first edge of the given graph. deba@57: /// kpeter@734: explicit EdgeIt(const Graph&) { } kpeter@734: /// Sets the iterator to the given edge. alpar@209: kpeter@734: /// Sets the iterator to the given edge of the given graph. kpeter@734: /// alpar@209: EdgeIt(const Graph&, const Edge&) { } deba@57: /// Next edge alpar@209: deba@57: /// Assign the iterator to the next edge. kpeter@734: /// deba@57: EdgeIt& operator++() { return *this; } deba@57: }; deba@57: kpeter@734: /// Iterator class for the incident edges of a node. kpeter@734: kpeter@734: /// This iterator goes trough the incident undirected edges kpeter@734: /// of a certain node of a graph. kpeter@786: /// Its usage is quite simple, for example, you can compute the kpeter@734: /// degree (i.e. the number of incident edges) of a node \c n kpeter@734: /// in a graph \c g of type \c %Graph as follows. deba@57: /// deba@57: ///\code deba@57: /// int count=0; deba@78: /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; deba@57: ///\endcode kpeter@734: /// kpeter@734: /// \warning Loop edges will be iterated twice. deba@78: class IncEdgeIt : public Edge { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@78: IncEdgeIt() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@78: IncEdgeIt(const IncEdgeIt& e) : Edge(e) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. kpeter@734: /// \sa Invalid for more details. kpeter@734: IncEdgeIt(Invalid) { } kpeter@734: /// Sets the iterator to the first incident edge. kpeter@734: kpeter@734: /// Sets the iterator to the first incident edge of the given node. deba@57: /// kpeter@734: IncEdgeIt(const Graph&, const Node&) { } kpeter@734: /// Sets the iterator to the given edge. alpar@209: kpeter@734: /// Sets the iterator to the given edge of the given graph. kpeter@734: /// kpeter@734: IncEdgeIt(const Graph&, const Edge&) { } kpeter@734: /// Next incident edge deba@57: kpeter@734: /// Assign the iterator to the next incident edge alpar@209: /// of the corresponding node. deba@78: IncEdgeIt& operator++() { return *this; } deba@57: }; deba@57: kpeter@734: /// The arc type of the graph deba@57: kpeter@734: /// This class identifies a directed arc of the graph. It also serves kpeter@734: /// as a base class of the arc iterators, kpeter@734: /// thus they will convert to this type. kpeter@657: class Arc { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the object to an undefined value. deba@57: Arc() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// kpeter@657: Arc(const Arc&) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the object to be invalid. kpeter@734: /// \sa Invalid for more details. deba@57: Arc(Invalid) { } deba@57: /// Equality operator deba@57: kpeter@734: /// Equality operator. kpeter@734: /// deba@57: /// Two iterators are equal if and only if they point to the kpeter@734: /// same object or both are \c INVALID. deba@57: bool operator==(Arc) const { return true; } deba@57: /// Inequality operator deba@57: kpeter@734: /// Inequality operator. deba@57: bool operator!=(Arc) const { return true; } deba@57: alpar@209: /// Artificial ordering operator. alpar@209: kpeter@734: /// Artificial ordering operator. alpar@209: /// kpeter@734: /// \note This operator only has to define some strict ordering of kpeter@734: /// the arcs; this order has nothing to do with the iteration kpeter@734: /// ordering of the arcs. alpar@209: bool operator<(Arc) const { return false; } alpar@209: kpeter@734: /// Converison to \c Edge alpar@877: kpeter@734: /// Converison to \c Edge. kpeter@734: /// kpeter@657: operator Edge() const { return Edge(); } alpar@209: }; deba@57: kpeter@734: /// Iterator class for the arcs. kpeter@734: kpeter@734: /// This iterator goes through each directed arc of the graph. kpeter@786: /// Its usage is quite simple, for example, you can count the number kpeter@734: /// of arcs in a graph \c g of type \c %Graph as follows: deba@57: ///\code deba@57: /// int count=0; kpeter@734: /// for(Graph::ArcIt a(g); a!=INVALID; ++a) ++count; deba@57: ///\endcode deba@57: class ArcIt : public Arc { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@57: ArcIt() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: ArcIt(const ArcIt& e) : Arc(e) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. kpeter@734: /// \sa Invalid for more details. kpeter@734: ArcIt(Invalid) { } kpeter@734: /// Sets the iterator to the first arc. kpeter@734: kpeter@734: /// Sets the iterator to the first arc of the given graph. deba@57: /// alpar@983: explicit ArcIt(const Graph &g) { ::lemon::ignore_unused_variable_warning(g); } kpeter@734: /// Sets the iterator to the given arc. alpar@209: kpeter@734: /// Sets the iterator to the given arc of the given graph. kpeter@734: /// alpar@209: ArcIt(const Graph&, const Arc&) { } kpeter@734: /// Next arc alpar@209: deba@57: /// Assign the iterator to the next arc. kpeter@734: /// deba@57: ArcIt& operator++() { return *this; } deba@57: }; alpar@209: kpeter@734: /// Iterator class for the outgoing arcs of a node. deba@57: kpeter@734: /// This iterator goes trough the \e outgoing directed arcs of a kpeter@734: /// certain node of a graph. kpeter@786: /// Its usage is quite simple, for example, you can count the number deba@57: /// of outgoing arcs of a node \c n kpeter@734: /// in a graph \c g of type \c %Graph as follows. deba@57: ///\code deba@57: /// int count=0; kpeter@734: /// for (Digraph::OutArcIt a(g, n); a!=INVALID; ++a) ++count; deba@57: ///\endcode deba@57: class OutArcIt : public Arc { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@57: OutArcIt() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: OutArcIt(const OutArcIt& e) : Arc(e) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. kpeter@734: /// \sa Invalid for more details. kpeter@734: OutArcIt(Invalid) { } kpeter@734: /// Sets the iterator to the first outgoing arc. kpeter@734: kpeter@734: /// Sets the iterator to the first outgoing arc of the given node. deba@57: /// deba@57: OutArcIt(const Graph& n, const Node& g) { alpar@982: ::lemon::ignore_unused_variable_warning(n); alpar@982: ::lemon::ignore_unused_variable_warning(g); alpar@209: } kpeter@734: /// Sets the iterator to the given arc. deba@57: kpeter@734: /// Sets the iterator to the given arc of the given graph. kpeter@734: /// deba@57: OutArcIt(const Graph&, const Arc&) { } kpeter@734: /// Next outgoing arc alpar@209: alpar@209: /// Assign the iterator to the next deba@57: /// outgoing arc of the corresponding node. deba@57: OutArcIt& operator++() { return *this; } deba@57: }; deba@57: kpeter@734: /// Iterator class for the incoming arcs of a node. deba@57: kpeter@734: /// This iterator goes trough the \e incoming directed arcs of a kpeter@734: /// certain node of a graph. kpeter@786: /// Its usage is quite simple, for example, you can count the number kpeter@734: /// of incoming arcs of a node \c n kpeter@734: /// in a graph \c g of type \c %Graph as follows. deba@57: ///\code deba@57: /// int count=0; kpeter@734: /// for (Digraph::InArcIt a(g, n); a!=INVALID; ++a) ++count; deba@57: ///\endcode deba@57: class InArcIt : public Arc { deba@57: public: deba@57: /// Default constructor deba@57: kpeter@734: /// Default constructor. kpeter@734: /// \warning It sets the iterator to an undefined value. deba@57: InArcIt() { } deba@57: /// Copy constructor. deba@57: deba@57: /// Copy constructor. deba@57: /// deba@57: InArcIt(const InArcIt& e) : Arc(e) { } kpeter@734: /// %Invalid constructor \& conversion. deba@57: kpeter@734: /// Initializes the iterator to be invalid. kpeter@734: /// \sa Invalid for more details. kpeter@734: InArcIt(Invalid) { } kpeter@734: /// Sets the iterator to the first incoming arc. kpeter@734: kpeter@734: /// Sets the iterator to the first incoming arc of the given node. deba@57: /// alpar@209: InArcIt(const Graph& g, const Node& n) { alpar@982: ::lemon::ignore_unused_variable_warning(n); alpar@982: ::lemon::ignore_unused_variable_warning(g); alpar@209: } kpeter@734: /// Sets the iterator to the given arc. deba@57: kpeter@734: /// Sets the iterator to the given arc of the given graph. kpeter@734: /// deba@57: InArcIt(const Graph&, const Arc&) { } deba@57: /// Next incoming arc deba@57: kpeter@734: /// Assign the iterator to the next kpeter@734: /// incoming arc of the corresponding node. deba@57: InArcIt& operator++() { return *this; } deba@57: }; deba@57: kpeter@734: /// \brief Standard graph map type for the nodes. alpar@209: /// kpeter@734: /// Standard graph map type for the nodes. kpeter@734: /// It conforms to the ReferenceMap concept. alpar@209: template kpeter@580: class NodeMap : public ReferenceMap deba@57: { deba@57: public: deba@57: kpeter@734: /// Constructor kpeter@734: explicit NodeMap(const Graph&) { } kpeter@734: /// Constructor with given initial value deba@57: NodeMap(const Graph&, T) { } deba@57: kpeter@263: private: deba@57: ///Copy constructor kpeter@580: NodeMap(const NodeMap& nm) : kpeter@580: ReferenceMap(nm) { } deba@57: ///Assignment operator deba@57: template alpar@209: NodeMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); alpar@209: return *this; deba@57: } deba@57: }; deba@57: kpeter@734: /// \brief Standard graph map type for the arcs. deba@57: /// kpeter@734: /// Standard graph map type for the arcs. kpeter@734: /// It conforms to the ReferenceMap concept. alpar@209: template kpeter@580: class ArcMap : public ReferenceMap deba@57: { deba@57: public: deba@57: kpeter@734: /// Constructor kpeter@734: explicit ArcMap(const Graph&) { } kpeter@734: /// Constructor with given initial value deba@57: ArcMap(const Graph&, T) { } kpeter@734: kpeter@263: private: deba@57: ///Copy constructor kpeter@580: ArcMap(const ArcMap& em) : kpeter@580: ReferenceMap(em) { } deba@57: ///Assignment operator deba@57: template alpar@209: ArcMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); alpar@209: return *this; deba@57: } deba@57: }; deba@57: kpeter@734: /// \brief Standard graph map type for the edges. kpeter@734: /// kpeter@734: /// Standard graph map type for the edges. kpeter@734: /// It conforms to the ReferenceMap concept. alpar@209: template kpeter@580: class EdgeMap : public ReferenceMap deba@57: { deba@57: public: deba@57: kpeter@734: /// Constructor kpeter@734: explicit EdgeMap(const Graph&) { } kpeter@734: /// Constructor with given initial value deba@57: EdgeMap(const Graph&, T) { } kpeter@734: kpeter@263: private: deba@57: ///Copy constructor kpeter@580: EdgeMap(const EdgeMap& em) : kpeter@580: ReferenceMap(em) {} deba@57: ///Assignment operator deba@57: template alpar@209: EdgeMap& operator=(const CMap&) { deba@57: checkConcept, CMap>(); alpar@209: return *this; deba@57: } deba@57: }; deba@57: kpeter@734: /// \brief The first node of the edge. deba@57: /// kpeter@734: /// Returns the first node of the given edge. deba@57: /// kpeter@786: /// Edges don't have source and target nodes, however, methods kpeter@734: /// u() and v() are used to query the two end-nodes of an edge. kpeter@734: /// The orientation of an edge that arises this way is called kpeter@734: /// the inherent direction, it is used to define the default kpeter@734: /// direction for the corresponding arcs. kpeter@559: /// \sa v() kpeter@559: /// \sa direction() deba@57: Node u(Edge) const { return INVALID; } deba@57: kpeter@734: /// \brief The second node of the edge. kpeter@559: /// kpeter@734: /// Returns the second node of the given edge. kpeter@559: /// kpeter@786: /// Edges don't have source and target nodes, however, methods kpeter@734: /// u() and v() are used to query the two end-nodes of an edge. kpeter@734: /// The orientation of an edge that arises this way is called kpeter@734: /// the inherent direction, it is used to define the default kpeter@734: /// direction for the corresponding arcs. kpeter@559: /// \sa u() kpeter@559: /// \sa direction() deba@57: Node v(Edge) const { return INVALID; } deba@57: kpeter@734: /// \brief The source node of the arc. kpeter@734: /// kpeter@734: /// Returns the source node of the given arc. deba@57: Node source(Arc) const { return INVALID; } deba@57: kpeter@734: /// \brief The target node of the arc. kpeter@734: /// kpeter@734: /// Returns the target node of the given arc. deba@57: Node target(Arc) const { return INVALID; } deba@57: kpeter@734: /// \brief The ID of the node. kpeter@734: /// kpeter@734: /// Returns the ID of the given node. alpar@209: int id(Node) const { return -1; } deba@61: kpeter@734: /// \brief The ID of the edge. kpeter@734: /// kpeter@734: /// Returns the ID of the given edge. alpar@209: int id(Edge) const { return -1; } deba@61: kpeter@734: /// \brief The ID of the arc. kpeter@734: /// kpeter@734: /// Returns the ID of the given arc. alpar@209: int id(Arc) const { return -1; } deba@61: kpeter@734: /// \brief The node with the given ID. deba@61: /// kpeter@734: /// Returns the node with the given ID. kpeter@734: /// \pre The argument should be a valid node ID in the graph. alpar@209: Node nodeFromId(int) const { return INVALID; } deba@61: kpeter@734: /// \brief The edge with the given ID. deba@61: /// kpeter@734: /// Returns the edge with the given ID. kpeter@734: /// \pre The argument should be a valid edge ID in the graph. alpar@209: Edge edgeFromId(int) const { return INVALID; } deba@61: kpeter@734: /// \brief The arc with the given ID. deba@61: /// kpeter@734: /// Returns the arc with the given ID. kpeter@734: /// \pre The argument should be a valid arc ID in the graph. alpar@209: Arc arcFromId(int) const { return INVALID; } deba@61: kpeter@734: /// \brief An upper bound on the node IDs. kpeter@734: /// kpeter@734: /// Returns an upper bound on the node IDs. alpar@209: int maxNodeId() const { return -1; } deba@61: kpeter@734: /// \brief An upper bound on the edge IDs. kpeter@734: /// kpeter@734: /// Returns an upper bound on the edge IDs. alpar@209: int maxEdgeId() const { return -1; } deba@61: kpeter@734: /// \brief An upper bound on the arc IDs. kpeter@734: /// kpeter@734: /// Returns an upper bound on the arc IDs. alpar@209: int maxArcId() const { return -1; } deba@61: kpeter@734: /// \brief The direction of the arc. kpeter@734: /// kpeter@734: /// Returns \c true if the direction of the given arc is the same as kpeter@734: /// the inherent orientation of the represented edge. kpeter@734: bool direction(Arc) const { return true; } kpeter@734: kpeter@734: /// \brief Direct the edge. kpeter@734: /// kpeter@734: /// Direct the given edge. The returned arc kpeter@734: /// represents the given edge and its direction comes kpeter@734: /// from the bool parameter. If it is \c true, then the direction kpeter@734: /// of the arc is the same as the inherent orientation of the edge. kpeter@734: Arc direct(Edge, bool) const { kpeter@734: return INVALID; kpeter@734: } kpeter@734: kpeter@734: /// \brief Direct the edge. kpeter@734: /// kpeter@734: /// Direct the given edge. The returned arc represents the given kpeter@734: /// edge and its source node is the given node. kpeter@734: Arc direct(Edge, Node) const { kpeter@734: return INVALID; kpeter@734: } kpeter@734: kpeter@734: /// \brief The oppositely directed arc. kpeter@734: /// kpeter@734: /// Returns the oppositely directed arc representing the same edge. kpeter@734: Arc oppositeArc(Arc) const { return INVALID; } kpeter@734: kpeter@734: /// \brief The opposite node on the edge. kpeter@734: /// kpeter@734: /// Returns the opposite node on the given edge. kpeter@734: Node oppositeNode(Node, Edge) const { return INVALID; } kpeter@734: deba@57: void first(Node&) const {} deba@57: void next(Node&) const {} deba@57: deba@57: void first(Edge&) const {} deba@57: void next(Edge&) const {} deba@57: deba@57: void first(Arc&) const {} deba@57: void next(Arc&) const {} deba@57: deba@57: void firstOut(Arc&, Node) const {} deba@57: void nextOut(Arc&) const {} deba@57: deba@57: void firstIn(Arc&, Node) const {} deba@57: void nextIn(Arc&) const {} deba@57: deba@57: void firstInc(Edge &, bool &, const Node &) const {} deba@57: void nextInc(Edge &, bool &) const {} deba@57: deba@61: // The second parameter is dummy. deba@61: Node fromId(int, Node) const { return INVALID; } deba@61: // The second parameter is dummy. deba@61: Edge fromId(int, Edge) const { return INVALID; } deba@61: // The second parameter is dummy. deba@61: Arc fromId(int, Arc) const { return INVALID; } deba@61: deba@61: // Dummy parameter. alpar@209: int maxId(Node) const { return -1; } deba@61: // Dummy parameter. alpar@209: int maxId(Edge) const { return -1; } deba@61: // Dummy parameter. alpar@209: int maxId(Arc) const { return -1; } deba@61: kpeter@734: /// \brief The base node of the iterator. deba@57: /// kpeter@734: /// Returns the base node of the given incident edge iterator. kpeter@734: Node baseNode(IncEdgeIt) const { return INVALID; } kpeter@734: kpeter@734: /// \brief The running node of the iterator. deba@57: /// kpeter@734: /// Returns the running node of the given incident edge iterator. kpeter@734: Node runningNode(IncEdgeIt) const { return INVALID; } deba@57: kpeter@734: /// \brief The base node of the iterator. deba@57: /// kpeter@734: /// Returns the base node of the given outgoing arc iterator kpeter@734: /// (i.e. the source node of the corresponding arc). kpeter@734: Node baseNode(OutArcIt) const { return INVALID; } kpeter@734: kpeter@734: /// \brief The running node of the iterator. deba@57: /// kpeter@734: /// Returns the running node of the given outgoing arc iterator kpeter@734: /// (i.e. the target node of the corresponding arc). kpeter@734: Node runningNode(OutArcIt) const { return INVALID; } deba@57: kpeter@734: /// \brief The base node of the iterator. deba@57: /// kpeter@734: /// Returns the base node of the given incomming arc iterator kpeter@734: /// (i.e. the target node of the corresponding arc). kpeter@734: Node baseNode(InArcIt) const { return INVALID; } alpar@209: kpeter@734: /// \brief The running node of the iterator. deba@57: /// kpeter@734: /// Returns the running node of the given incomming arc iterator kpeter@734: /// (i.e. the source node of the corresponding arc). kpeter@734: Node runningNode(InArcIt) const { return INVALID; } deba@57: deba@125: template deba@57: struct Constraints { alpar@209: void constraints() { kpeter@580: checkConcept(); alpar@209: checkConcept, _Graph>(); alpar@209: checkConcept, _Graph>(); alpar@209: checkConcept, _Graph>(); alpar@209: } deba@57: }; deba@57: deba@57: }; deba@57: deba@57: } deba@57: deba@57: } deba@57: deba@57: #endif