Changeset 285:0bc5f7f66bfa in lemon-0.x for src/include
- Timestamp:
- 04/03/04 20:42:39 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@399
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/include/smart_graph.h
r253 r285 80 80 class InEdgeIt; 81 81 82 // class Node { int n; };83 // class NodeIt : public Node { };84 // class Edge { int n; };85 // class EdgeIt : public Edge {};86 // class OutEdgeIt : public Edge {};87 // class InEdgeIt : public Edge {};88 // class SymEdge;89 90 82 template <typename T> class NodeMap; 91 83 template <typename T> class EdgeMap; 92 84 93 85 public: 94 95 /* default constructor */96 86 97 87 SmartGraph() : nodes(), edges() { } … … 119 109 Node head(Edge e) const { return edges[e.n].head; } 120 110 121 // Marci122 111 Node aNode(OutEdgeIt e) const { return edges[e.n].tail; } 123 112 Node aNode(InEdgeIt e) const { return edges[e.n].head; } 124 // //Node aNode(const SymEdge& e) const { return e.aNode(); } 125 126 // Marci 113 127 114 Node bNode(OutEdgeIt e) const { return edges[e.n].head; } 128 115 Node bNode(InEdgeIt e) const { return edges[e.n].tail; } 129 // //Node bNode(const SymEdge& e) const { return e.bNode(); }130 116 131 117 NodeIt& first(NodeIt& v) const { … … 273 259 InEdgeIt(const SmartGraph& G,Node v) :Edge(G.nodes[v.n].first_in){} 274 260 }; 275 276 // Map types277 278 // // Static Maps are not necessary.279 // template <typename T>280 // class NodeMap {281 // const SmartGraph& G;282 // std::vector<T> container;283 // public:284 // typedef T ValueType;285 // typedef Node KeyType;286 // NodeMap(const SmartGraph& _G) : G(_G), container(G.maxNodeId()) { }287 // NodeMap(const SmartGraph& _G, T a) :288 // G(_G), container(G.maxNodeId(), a) { }289 // void set(Node n, T a) { container[n.n]=a; }290 // T get(Node n) const { return container[n.n]; }291 // T& operator[](Node n) { return container[n.n]; }292 // const T& operator[](Node n) const { return container[n.n]; }293 // void update() { container.resize(G.maxNodeId()); }294 // void update(T a) { container.resize(G.maxNodeId(), a); }295 // };296 297 // template <typename T>298 // class EdgeMap {299 // const SmartGraph& G;300 // std::vector<T> container;301 // public:302 // typedef T ValueType;303 // typedef Edge KeyType;304 // EdgeMap(const SmartGraph& _G) : G(_G), container(G.maxEdgeId()) { }305 // EdgeMap(const SmartGraph& _G, T a) :306 // G(_G), container(G.maxEdgeId(), a) { }307 // void set(Edge e, T a) { container[e.n]=a; }308 // T get(Edge e) const { return container[e.n]; }309 // T& operator[](Edge e) { return container[e.n]; }310 // const T& operator[](Edge e) const { return container[e.n]; }311 // void update() { container.resize(G.maxEdgeId()); }312 // void update(T a) { container.resize(G.maxEdgeId(), a); }313 // };314 261 315 262 template <typename T> class NodeMap : public DynMapBase<Node> … … 375 322 376 323 void set(Node n, T a) { container[n.n]=a; } 377 //T get(Node n) const { return container[n.n]; } 378 //Hajjaj: 379 //T& operator[](Node n) { return container[n.n]; } 324 //'T& operator[](Node n)' would be wrong here 380 325 typename std::vector<T>::reference 381 326 operator[](Node n) { return container[n.n]; } 382 // const T& operator[](Node n) const { return container[n.n]; }327 //'const T& operator[](Node n)' would be wrong here 383 328 typename std::vector<T>::const_reference 384 329 operator[](Node n) const { return container[n.n]; } … … 401 346 } 402 347 403 void update() {} //Useless for Dyn Maps404 void update(T a) {} //Useless for Dyn Maps348 void update() {} //Useless for Dynamic Maps 349 void update(T a) {} //Useless for Dynamic Maps 405 350 }; 406 351
Note: See TracChangeset
for help on using the changeset viewer.