src/work/list_graph.h
changeset 235 aa50acc936dc
parent 232 cb87fb9d4c94
child 260 fb27d1c7036e
equal deleted inserted replaced
3:1398566c8c37 4:3d7472bb6051
    43       NodeMap(const ListGraph& _G) : G(_G), container(G.node_id) { }
    43       NodeMap(const ListGraph& _G) : G(_G), container(G.node_id) { }
    44       NodeMap(const ListGraph& _G, T a) : 
    44       NodeMap(const ListGraph& _G, T a) : 
    45 	G(_G), container(G.node_id, a) { }
    45 	G(_G), container(G.node_id, a) { }
    46       void set(Node n, T a) { container[/*G.id(n)*/n.node->id]=a; }
    46       void set(Node n, T a) { container[/*G.id(n)*/n.node->id]=a; }
    47       T get(Node n) const { return container[/*G.id(n)*/n.node->id]; }
    47       T get(Node n) const { return container[/*G.id(n)*/n.node->id]; }
    48       std::vector<T>::reference operator[](Node n) { 
    48       typename std::vector<T>::reference operator[](Node n) { 
    49 	return container[/*G.id(n)*/n.node->id]; }
    49 	return container[/*G.id(n)*/n.node->id]; }
    50       std::vector<T>::const_reference operator[](Node n) const { 
    50       typename std::vector<T>::const_reference operator[](Node n) const { 
    51 	return container[/*G.id(n)*/n.node->id]; 
    51 	return container[/*G.id(n)*/n.node->id]; 
    52       }
    52       }
    53       void update() { container.resize(G.node_id); }
    53       void update() { container.resize(G.node_id); }
    54       void update(T a) { container.resize(G.node_id, a); }
    54       void update(T a) { container.resize(G.node_id, a); }
    55     };
    55     };
    64       EdgeMap(const ListGraph& _G) : G(_G), container(G.edge_id) { }
    64       EdgeMap(const ListGraph& _G) : G(_G), container(G.edge_id) { }
    65       EdgeMap(const ListGraph& _G, T a) : 
    65       EdgeMap(const ListGraph& _G, T a) : 
    66 	G(_G), container(G.edge_id, a) { }
    66 	G(_G), container(G.edge_id, a) { }
    67       void set(Edge e, T a) { container[/*G.id(e)*/e.edge->id]=a; }
    67       void set(Edge e, T a) { container[/*G.id(e)*/e.edge->id]=a; }
    68       T get(Edge e) const { return container[/*G.id(e)*/e.edge->id]; }
    68       T get(Edge e) const { return container[/*G.id(e)*/e.edge->id]; }
    69       std::vector<T>::reference operator[](Edge e) { 
    69       typename std::vector<T>::reference operator[](Edge e) { 
    70 	return container[/*G.id(e)*/e.edge->id]; } 
    70 	return container[/*G.id(e)*/e.edge->id]; } 
    71       std::vector<T>::const_reference operator[](Edge e) const { 
    71       typename std::vector<T>::const_reference operator[](Edge e) const { 
    72 	return container[/*G.id(e)*/e.edge->id]; 
    72 	return container[/*G.id(e)*/e.edge->id]; 
    73       } 
    73       } 
    74       void update() { container.resize(G.edge_id); }
    74       void update() { container.resize(G.edge_id); }
    75       void update(T a) { container.resize(G.edge_id, a); }
    75       void update(T a) { container.resize(G.edge_id, a); }
    76     };
    76     };