# HG changeset patch # User alpar # Date 1081017759 0 # Node ID 0bc5f7f66bfa3d95b6e8c7213aa3a96dfb7972fb # Parent 2d4684f76aac4a695cb6bd01e540f0981afd73d1 Many of the old stuffs has been finally removed. diff -r 2d4684f76aac -r 0bc5f7f66bfa src/include/smart_graph.h --- a/src/include/smart_graph.h Sat Apr 03 18:41:46 2004 +0000 +++ b/src/include/smart_graph.h Sat Apr 03 18:42:39 2004 +0000 @@ -79,21 +79,11 @@ class OutEdgeIt; class InEdgeIt; - // class Node { int n; }; - // class NodeIt : public Node { }; - // class Edge { int n; }; - // class EdgeIt : public Edge {}; - // class OutEdgeIt : public Edge {}; - // class InEdgeIt : public Edge {}; - // class SymEdge; - template class NodeMap; template class EdgeMap; public: - /* default constructor */ - SmartGraph() : nodes(), edges() { } SmartGraph(const SmartGraph &_g) : nodes(_g.nodes), edges(_g.edges) { } @@ -118,15 +108,11 @@ Node tail(Edge e) const { return edges[e.n].tail; } Node head(Edge e) const { return edges[e.n].head; } - // Marci Node aNode(OutEdgeIt e) const { return edges[e.n].tail; } Node aNode(InEdgeIt e) const { return edges[e.n].head; } -// //Node aNode(const SymEdge& e) const { return e.aNode(); } - // Marci Node bNode(OutEdgeIt e) const { return edges[e.n].head; } Node bNode(InEdgeIt e) const { return edges[e.n].tail; } -// //Node bNode(const SymEdge& e) const { return e.bNode(); } NodeIt& first(NodeIt& v) const { v=NodeIt(*this); return v; } @@ -273,45 +259,6 @@ InEdgeIt(const SmartGraph& G,Node v) :Edge(G.nodes[v.n].first_in){} }; - // Map types - -// // Static Maps are not necessary. -// template -// class NodeMap { -// const SmartGraph& G; -// std::vector container; -// public: -// typedef T ValueType; -// typedef Node KeyType; -// NodeMap(const SmartGraph& _G) : G(_G), container(G.maxNodeId()) { } -// NodeMap(const SmartGraph& _G, T a) : -// G(_G), container(G.maxNodeId(), a) { } -// void set(Node n, T a) { container[n.n]=a; } -// T get(Node n) const { return container[n.n]; } -// T& operator[](Node n) { return container[n.n]; } -// const T& operator[](Node n) const { return container[n.n]; } -// void update() { container.resize(G.maxNodeId()); } -// void update(T a) { container.resize(G.maxNodeId(), a); } -// }; - -// template -// class EdgeMap { -// const SmartGraph& G; -// std::vector container; -// public: -// typedef T ValueType; -// typedef Edge KeyType; -// EdgeMap(const SmartGraph& _G) : G(_G), container(G.maxEdgeId()) { } -// EdgeMap(const SmartGraph& _G, T a) : -// G(_G), container(G.maxEdgeId(), a) { } -// void set(Edge e, T a) { container[e.n]=a; } -// T get(Edge e) const { return container[e.n]; } -// T& operator[](Edge e) { return container[e.n]; } -// const T& operator[](Edge e) const { return container[e.n]; } -// void update() { container.resize(G.maxEdgeId()); } -// void update(T a) { container.resize(G.maxEdgeId(), a); } -// }; - template class NodeMap : public DynMapBase { std::vector container; @@ -374,12 +321,10 @@ void erase(const Node) { } void set(Node n, T a) { container[n.n]=a; } - //T get(Node n) const { return container[n.n]; } - //Hajjaj: - //T& operator[](Node n) { return container[n.n]; } + //'T& operator[](Node n)' would be wrong here typename std::vector::reference operator[](Node n) { return container[n.n]; } - //const T& operator[](Node n) const { return container[n.n]; } + //'const T& operator[](Node n)' would be wrong here typename std::vector::const_reference operator[](Node n) const { return container[n.n]; } @@ -400,8 +345,8 @@ return *this; } - void update() {} //Useless for DynMaps - void update(T a) {} //Useless for DynMaps + void update() {} //Useless for Dynamic Maps + void update(T a) {} //Useless for Dynamic Maps }; template class EdgeMap : public DynMapBase