136 // It first(Node v) const { It e; first(e,v); return e; } |
137 // It first(Node v) const { It e; first(e,v); return e; } |
137 |
138 |
138 bool valid(Edge e) const { return e.n!=-1; } |
139 bool valid(Edge e) const { return e.n!=-1; } |
139 bool valid(Node n) const { return n.n!=-1; } |
140 bool valid(Node n) const { return n.n!=-1; } |
140 |
141 |
|
142 ///\deprecated Use |
|
143 ///\code |
|
144 /// e=INVALID; |
|
145 ///\endcode |
|
146 ///instead. |
141 void setInvalid(Edge &e) { e.n=-1; } |
147 void setInvalid(Edge &e) { e.n=-1; } |
|
148 ///\deprecated Use |
|
149 ///\code |
|
150 /// e=INVALID; |
|
151 ///\endcode |
|
152 ///instead. |
142 void setInvalid(Node &n) { n.n=-1; } |
153 void setInvalid(Node &n) { n.n=-1; } |
143 |
154 |
144 template <typename It> It getNext(It it) const |
155 template <typename It> It getNext(It it) const |
145 { It tmp(it); return next(tmp); } |
156 { It tmp(it); return next(tmp); } |
146 |
157 |
195 int n; |
206 int n; |
196 friend int SmartGraph::id(Node v) const; |
207 friend int SmartGraph::id(Node v) const; |
197 Node(int nn) {n=nn;} |
208 Node(int nn) {n=nn;} |
198 public: |
209 public: |
199 Node() {} |
210 Node() {} |
200 Node (Invalid i) { n=-1; } |
211 Node (Invalid) { n=-1; } |
201 bool operator==(const Node i) const {return n==i.n;} |
212 bool operator==(const Node i) const {return n==i.n;} |
202 bool operator!=(const Node i) const {return n!=i.n;} |
213 bool operator!=(const Node i) const {return n!=i.n;} |
203 bool operator<(const Node i) const {return n<i.n;} |
214 bool operator<(const Node i) const {return n<i.n;} |
204 }; |
215 }; |
205 |
216 |
377 G->dyn_edge_maps.push_back(this); |
388 G->dyn_edge_maps.push_back(this); |
378 } |
389 } |
379 EdgeMap(const EdgeMap<T> &m) : |
390 EdgeMap(const EdgeMap<T> &m) : |
380 DynMapBase<Edge>(*m.G), container(m.container) |
391 DynMapBase<Edge>(*m.G), container(m.container) |
381 { |
392 { |
382 G->dyn_node_maps.push_back(this); |
393 G->dyn_edge_maps.push_back(this); |
383 } |
394 } |
384 |
395 |
385 template<typename TT> friend class EdgeMap; |
396 template<typename TT> friend class EdgeMap; |
386 |
397 |
387 ///\todo It can copy between different types. |
398 ///\todo It can copy between different types. |
388 /// |
399 /// |
389 template<typename TT> EdgeMap(const EdgeMap<TT> &m) : |
400 template<typename TT> EdgeMap(const EdgeMap<TT> &m) : |
390 DynMapBase<Edge>(*m.G) |
401 DynMapBase<Edge>(*m.G) |
391 { |
402 { |
392 G->dyn_node_maps.push_back(this); |
403 G->dyn_edge_maps.push_back(this); |
393 typename std::vector<TT>::const_iterator i; |
404 typename std::vector<TT>::const_iterator i; |
394 for(typename std::vector<TT>::const_iterator i=m.container.begin(); |
405 for(typename std::vector<TT>::const_iterator i=m.container.begin(); |
395 i!=m.container.end(); |
406 i!=m.container.end(); |
396 i++) |
407 i++) |
397 container.push_back(*i); |
408 container.push_back(*i); |