[Lemon-commits] Balazs Dezso: Digraph and Graph concept should b...
Lemon HG
hg at lemon.cs.elte.hu
Fri Jan 25 15:18:03 CET 2008
details: http://lemon.cs.elte.hu/hg/lemon/rev/d718974f1290
changeset: 61:d718974f1290
user: Balazs Dezso <deba [at] inf.elte.hu>
date: Fri Jan 25 13:39:52 2008 +0100
description:
Digraph and Graph concept should be conform to the IDable...
concepts
diffstat:
2 files changed, 81 insertions(+), 1 deletion(-)
lemon/concepts/digraph.h | 33 ++++++++++++++++++++++++++++++
lemon/concepts/graph.h | 49 +++++++++++++++++++++++++++++++++++++++++++++-
diffs (132 lines):
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 @@ namespace lemon {
///
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 {}
@@ -360,6 +382,16 @@ namespace lemon {
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.
///
@@ -439,6 +471,7 @@ namespace lemon {
struct Constraints {
void constraints() {
checkConcept<IterableDigraphComponent<>, Digraph>();
+ checkConcept<IDableDigraphComponent<>, Digraph>();
checkConcept<MappableDigraphComponent<>, 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 @@ namespace lemon {
/// \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,9 +672,22 @@ namespace lemon {
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
///
@@ -689,6 +735,7 @@ namespace lemon {
struct Constraints {
void constraints() {
checkConcept<IterableGraphComponent<>, Graph>();
+ checkConcept<IDableGraphComponent<>, Graph>();
checkConcept<MappableGraphComponent<>, Graph>();
}
};
More information about the Lemon-commits
mailing list