Digraph and Graph concept should be conform to the IDable... concepts
authorBalazs Dezso <deba@inf.elte.hu>
Fri, 25 Jan 2008 13:39:52 +0100
changeset 61d718974f1290
parent 60 6ec5dbed8f18
child 63 1113f6d12c0c
Digraph and Graph concept should be conform to the IDable... concepts
lemon/concepts/digraph.h
lemon/concepts/graph.h
     1.1 --- a/lemon/concepts/digraph.h	Wed Jan 23 16:26:41 2008 +0100
     1.2 +++ b/lemon/concepts/digraph.h	Fri Jan 25 13:39:52 2008 +0100
     1.3 @@ -348,6 +348,28 @@
     1.4        ///
     1.5        Node source(Arc) const { return INVALID; }
     1.6  
     1.7 +      /// \brief Returns the ID of the node.
     1.8 +      int id(Node) const { return -1; } 
     1.9 +
    1.10 +      /// \brief Returns the ID of the arc.
    1.11 +      int id(Arc) const { return -1; } 
    1.12 +
    1.13 +      /// \brief Returns the node with the given ID.
    1.14 +      ///
    1.15 +      /// \pre The argument should be a valid node ID in the graph.
    1.16 +      Node nodeFromId(int) const { return INVALID; } 
    1.17 +
    1.18 +      /// \brief Returns the arc with the given ID.
    1.19 +      ///
    1.20 +      /// \pre The argument should be a valid arc ID in the graph.
    1.21 +      Arc arcFromId(int) const { return INVALID; } 
    1.22 +
    1.23 +      /// \brief Returns an upper bound on the node IDs.
    1.24 +      int maxNodeId() const { return -1; } 
    1.25 +
    1.26 +      /// \brief Returns an upper bound on the arc IDs.
    1.27 +      int maxArcId() const { return -1; } 
    1.28 +
    1.29        void first(Node&) const {}
    1.30        void next(Node&) const {}
    1.31  
    1.32 @@ -361,6 +383,16 @@
    1.33        void firstOut(Arc&, const Node&) const {}
    1.34        void nextOut(Arc&) const {}
    1.35  
    1.36 +      // The second parameter is dummy.
    1.37 +      Node fromId(int, Node) const { return INVALID; }
    1.38 +      // The second parameter is dummy.
    1.39 +      Arc fromId(int, Arc) const { return INVALID; }
    1.40 +
    1.41 +      // Dummy parameter.
    1.42 +      int maxId(Node) const { return -1; } 
    1.43 +      // Dummy parameter.
    1.44 +      int maxId(Arc) const { return -1; } 
    1.45 +
    1.46        /// \brief The base node of the iterator.
    1.47        ///
    1.48        /// Gives back the base node of the iterator.
    1.49 @@ -439,6 +471,7 @@
    1.50        struct Constraints {
    1.51          void constraints() {
    1.52            checkConcept<IterableDigraphComponent<>, Digraph>();
    1.53 +	  checkConcept<IDableDigraphComponent<>, Digraph>();
    1.54            checkConcept<MappableDigraphComponent<>, Digraph>();
    1.55          }
    1.56        };
     2.1 --- a/lemon/concepts/graph.h	Wed Jan 23 16:26:41 2008 +0100
     2.2 +++ b/lemon/concepts/graph.h	Fri Jan 25 13:39:52 2008 +0100
     2.3 @@ -624,6 +624,39 @@
     2.4        /// \brief Target node of the directed arc.
     2.5        Node target(Arc) const { return INVALID; }
     2.6  
     2.7 +      /// \brief Returns the id of the node.
     2.8 +      int id(Node) const { return -1; } 
     2.9 +
    2.10 +      /// \brief Returns the id of the edge.
    2.11 +      int id(Edge) const { return -1; } 
    2.12 +
    2.13 +      /// \brief Returns the id of the arc.
    2.14 +      int id(Arc) const { return -1; } 
    2.15 +
    2.16 +      /// \brief Returns the node with the given id.
    2.17 +      ///
    2.18 +      /// \pre The argument should be a valid node id in the graph.
    2.19 +      Node nodeFromId(int) const { return INVALID; } 
    2.20 +
    2.21 +      /// \brief Returns the edge with the given id.
    2.22 +      ///
    2.23 +      /// \pre The argument should be a valid edge id in the graph.
    2.24 +      Edge edgeFromId(int) const { return INVALID; } 
    2.25 +
    2.26 +      /// \brief Returns the arc with the given id.
    2.27 +      ///
    2.28 +      /// \pre The argument should be a valid arc id in the graph.
    2.29 +      Arc arcFromId(int) const { return INVALID; } 
    2.30 +
    2.31 +      /// \brief Returns an upper bound on the node IDs.
    2.32 +      int maxNodeId() const { return -1; } 
    2.33 +
    2.34 +      /// \brief Returns an upper bound on the edge IDs.
    2.35 +      int maxEdgeId() const { return -1; } 
    2.36 +
    2.37 +      /// \brief Returns an upper bound on the arc IDs.
    2.38 +      int maxArcId() const { return -1; } 
    2.39 +
    2.40        void first(Node&) const {}
    2.41        void next(Node&) const {}
    2.42  
    2.43 @@ -639,10 +672,23 @@
    2.44        void firstIn(Arc&, Node) const {}
    2.45        void nextIn(Arc&) const {}
    2.46  
    2.47 -
    2.48        void firstInc(Edge &, bool &, const Node &) const {}
    2.49        void nextInc(Edge &, bool &) const {}
    2.50  
    2.51 +      // The second parameter is dummy.
    2.52 +      Node fromId(int, Node) const { return INVALID; }
    2.53 +      // The second parameter is dummy.
    2.54 +      Edge fromId(int, Edge) const { return INVALID; }
    2.55 +      // The second parameter is dummy.
    2.56 +      Arc fromId(int, Arc) const { return INVALID; }
    2.57 +
    2.58 +      // Dummy parameter.
    2.59 +      int maxId(Node) const { return -1; } 
    2.60 +      // Dummy parameter.
    2.61 +      int maxId(Edge) const { return -1; } 
    2.62 +      // Dummy parameter.
    2.63 +      int maxId(Arc) const { return -1; } 
    2.64 +
    2.65        /// \brief Base node of the iterator
    2.66        ///
    2.67        /// Returns the base node (the source in this case) of the iterator
    2.68 @@ -689,6 +735,7 @@
    2.69        struct Constraints {
    2.70  	void constraints() {
    2.71  	  checkConcept<IterableGraphComponent<>, Graph>();
    2.72 +	  checkConcept<IDableGraphComponent<>, Graph>();
    2.73  	  checkConcept<MappableGraphComponent<>, Graph>();
    2.74  	}
    2.75        };