# HG changeset patch # User Balazs Dezso # Date 1201264792 -3600 # Node ID d718974f12900e407079a17c0e5371396cdcaa19 # Parent 6ec5dbed8f1896434ffca37a48bd75d60ca0505d Digraph and Graph concept should be conform to the IDable... concepts diff -r 6ec5dbed8f18 -r d718974f1290 lemon/concepts/digraph.h --- a/lemon/concepts/digraph.h Wed Jan 23 16:26:41 2008 +0100 +++ b/lemon/concepts/digraph.h Fri Jan 25 13:39:52 2008 +0100 @@ -348,6 +348,28 @@ /// Node source(Arc) const { return INVALID; } + /// \brief Returns the ID of the node. + int id(Node) const { return -1; } + + /// \brief Returns the ID of the arc. + int id(Arc) const { return -1; } + + /// \brief Returns the node with the given ID. + /// + /// \pre The argument should be a valid node ID in the graph. + Node nodeFromId(int) const { return INVALID; } + + /// \brief Returns the arc with the given ID. + /// + /// \pre The argument should be a valid arc ID in the graph. + Arc arcFromId(int) const { return INVALID; } + + /// \brief Returns an upper bound on the node IDs. + int maxNodeId() const { return -1; } + + /// \brief Returns an upper bound on the arc IDs. + int maxArcId() const { return -1; } + void first(Node&) const {} void next(Node&) const {} @@ -361,6 +383,16 @@ void firstOut(Arc&, const Node&) const {} void nextOut(Arc&) const {} + // The second parameter is dummy. + Node fromId(int, Node) const { return INVALID; } + // The second parameter is dummy. + Arc fromId(int, Arc) const { return INVALID; } + + // Dummy parameter. + int maxId(Node) const { return -1; } + // Dummy parameter. + int maxId(Arc) const { return -1; } + /// \brief The base node of the iterator. /// /// Gives back the base node of the iterator. @@ -439,6 +471,7 @@ struct Constraints { void constraints() { checkConcept, Digraph>(); + checkConcept, Digraph>(); checkConcept, Digraph>(); } }; diff -r 6ec5dbed8f18 -r d718974f1290 lemon/concepts/graph.h --- a/lemon/concepts/graph.h Wed Jan 23 16:26:41 2008 +0100 +++ b/lemon/concepts/graph.h Fri Jan 25 13:39:52 2008 +0100 @@ -624,6 +624,39 @@ /// \brief Target node of the directed arc. Node target(Arc) const { return INVALID; } + /// \brief Returns the id of the node. + int id(Node) const { return -1; } + + /// \brief Returns the id of the edge. + int id(Edge) const { return -1; } + + /// \brief Returns the id of the arc. + int id(Arc) const { return -1; } + + /// \brief Returns the node with the given id. + /// + /// \pre The argument should be a valid node id in the graph. + Node nodeFromId(int) const { return INVALID; } + + /// \brief Returns the edge with the given id. + /// + /// \pre The argument should be a valid edge id in the graph. + Edge edgeFromId(int) const { return INVALID; } + + /// \brief Returns the arc with the given id. + /// + /// \pre The argument should be a valid arc id in the graph. + Arc arcFromId(int) const { return INVALID; } + + /// \brief Returns an upper bound on the node IDs. + int maxNodeId() const { return -1; } + + /// \brief Returns an upper bound on the edge IDs. + int maxEdgeId() const { return -1; } + + /// \brief Returns an upper bound on the arc IDs. + int maxArcId() const { return -1; } + void first(Node&) const {} void next(Node&) const {} @@ -639,10 +672,23 @@ void firstIn(Arc&, Node) const {} void nextIn(Arc&) const {} - void firstInc(Edge &, bool &, const Node &) const {} void nextInc(Edge &, bool &) const {} + // The second parameter is dummy. + Node fromId(int, Node) const { return INVALID; } + // The second parameter is dummy. + Edge fromId(int, Edge) const { return INVALID; } + // The second parameter is dummy. + Arc fromId(int, Arc) const { return INVALID; } + + // Dummy parameter. + int maxId(Node) const { return -1; } + // Dummy parameter. + int maxId(Edge) const { return -1; } + // Dummy parameter. + int maxId(Arc) const { return -1; } + /// \brief Base node of the iterator /// /// Returns the base node (the source in this case) of the iterator @@ -689,6 +735,7 @@ struct Constraints { void constraints() { checkConcept, Graph>(); + checkConcept, Graph>(); checkConcept, Graph>(); } };