[Lemon-commits] [lemon_svn] deba: r1505 - in hugo/trunk/src/lemon: . concept
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:45:55 CET 2006
Author: deba
Date: Fri Jan 28 16:37:08 2005
New Revision: 1505
Modified:
hugo/trunk/src/lemon/concept/graph_component.h
hugo/trunk/src/lemon/full_graph.h
hugo/trunk/src/lemon/list_graph.h
hugo/trunk/src/lemon/smart_graph.h
Log:
Concept modification to resolve the item by its ID.
Modified: hugo/trunk/src/lemon/concept/graph_component.h
==============================================================================
--- hugo/trunk/src/lemon/concept/graph_component.h (original)
+++ hugo/trunk/src/lemon/concept/graph_component.h Fri Jan 28 16:37:08 2005
@@ -297,12 +297,26 @@
///
int id(const Node&) const { return -1;}
- /// Gives back an unique integer id for the Edge.
+ /// \brief Gives back the node by the unique id.
+ ///
+ /// Gives back the node by the unique id.
+ /// If the graph does not contain node with the given id
+ /// then the result of the function is undetermined.
+ Node fromId(int id, Node) const { return INVALID;}
+ /// \brief Gives back an unique integer id for the Edge.
+ ///
/// Gives back an unique integer id for the Edge.
///
int id(const Edge&) const { return -1;}
+ /// \brief Gives back the edge by the unique id.
+ ///
+ /// Gives back the edge by the unique id.
+ /// If the graph does not contain edge with the given id
+ /// then the result of the function is undetermined.
+ Edge fromId(int id, Edge) const { return INVALID;}
+
template <typename _Graph>
struct Constraints {
@@ -311,9 +325,11 @@
typename _Graph::Node node;
int nid = graph.id(node);
nid = graph.id(node);
+ node = graph.fromId(nid, Node());
typename _Graph::Edge edge;
int eid = graph.id(edge);
eid = graph.id(edge);
+ edge = graph.fromId(eid, Edge());
}
const _Graph& graph;
Modified: hugo/trunk/src/lemon/full_graph.h
==============================================================================
--- hugo/trunk/src/lemon/full_graph.h (original)
+++ hugo/trunk/src/lemon/full_graph.h Fri Jan 28 16:37:08 2005
@@ -102,6 +102,10 @@
///\return The ID of the edge \c e.
static int id(Edge e) { return e.id; }
+ static Node fromId(int id, Node) { return Node(id);}
+
+ static Edge fromId(int id, Edge) { return Edge(id);}
+
/// Finds an edge between two nodes.
/// Finds an edge from node \c u to node \c v.
Modified: hugo/trunk/src/lemon/list_graph.h
==============================================================================
--- hugo/trunk/src/lemon/list_graph.h (original)
+++ hugo/trunk/src/lemon/list_graph.h Fri Jan 28 16:37:08 2005
@@ -162,6 +162,9 @@
static int id(Node v) { return v.id; }
static int id(Edge e) { return e.id; }
+ static Node fromId(int id, Node) { return Node(id);}
+ static Edge fromId(int id, Edge) { return Edge(id);}
+
/// Adds a new node to the graph.
/// \warning It adds the new node to the front of the list.
Modified: hugo/trunk/src/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/src/lemon/smart_graph.h (original)
+++ hugo/trunk/src/lemon/smart_graph.h Fri Jan 28 16:37:08 2005
@@ -121,6 +121,10 @@
///\return The ID of the edge \c e.
static int id(Edge e) { return e.n; }
+ static Node fromId(int id, Node) { return Node(id);}
+
+ static Edge fromId(int id, Edge) { return Edge(id);}
+
Node addNode() {
Node n; n.n=nodes.size();
nodes.push_back(NodeT()); //FIXME: Hmmm...
More information about the Lemon-commits
mailing list