src/lemon/concept/graph_component.h
changeset 1106 0a7d604a9763
parent 1043 52a2201a88e9
child 1134 56b07afdbf8d
equal deleted inserted replaced
11:ab80242abcdf 12:8a8898986536
   295 
   295 
   296       /// Gives back an unique integer id for the Node. 
   296       /// Gives back an unique integer id for the Node. 
   297       ///
   297       ///
   298       int id(const Node&) const { return -1;}
   298       int id(const Node&) const { return -1;}
   299 
   299 
       
   300       /// \brief Gives back the node by the unique id.
       
   301       ///
       
   302       /// Gives back the node by the unique id.
       
   303       /// If the graph does not contain node with the given id
       
   304       /// then the result of the function is undetermined. 
       
   305       Node fromId(int id, Node) const { return INVALID;}
       
   306 
       
   307       /// \brief Gives back an unique integer id for the Edge. 
       
   308       ///
   300       /// Gives back an unique integer id for the Edge. 
   309       /// Gives back an unique integer id for the Edge. 
   301 
       
   302       /// Gives back an unique integer id for the Edge. 
       
   303       ///
   310       ///
   304       int id(const Edge&) const { return -1;}
   311       int id(const Edge&) const { return -1;}
       
   312 
       
   313       /// \brief Gives back the edge by the unique id.
       
   314       ///
       
   315       /// Gives back the edge by the unique id.
       
   316       /// If the graph does not contain edge with the given id
       
   317       /// then the result of the function is undetermined. 
       
   318       Edge fromId(int id, Edge) const { return INVALID;}
   305 
   319 
   306       template <typename _Graph>
   320       template <typename _Graph>
   307       struct Constraints {
   321       struct Constraints {
   308 
   322 
   309 	void constraints() {
   323 	void constraints() {
   310 	  checkConcept< BaseGraphComponent, _Graph >();
   324 	  checkConcept< BaseGraphComponent, _Graph >();
   311 	  typename _Graph::Node node;
   325 	  typename _Graph::Node node;
   312 	  int nid = graph.id(node);
   326 	  int nid = graph.id(node);
   313 	  nid = graph.id(node);
   327 	  nid = graph.id(node);
       
   328 	  node = graph.fromId(nid, Node());
   314 	  typename _Graph::Edge edge;
   329 	  typename _Graph::Edge edge;
   315 	  int eid = graph.id(edge);
   330 	  int eid = graph.id(edge);
   316 	  eid = graph.id(edge);
   331 	  eid = graph.id(edge);
       
   332 	  edge = graph.fromId(eid, Edge());
   317 	}
   333 	}
   318 
   334 
   319 	const _Graph& graph;
   335 	const _Graph& graph;
   320       };
   336       };
   321     };
   337     };