src/work/marci/experiment/list_graph.h
changeset 1319 6e277ba3fc76
parent 986 e997802b855c
equal deleted inserted replaced
2:2529624ce8cb 3:24e8994cf62f
    36     template <typename T>
    36     template <typename T>
    37     class NodeMap {
    37     class NodeMap {
    38       const ListGraph& G; 
    38       const ListGraph& G; 
    39       std::vector<T> container;
    39       std::vector<T> container;
    40     public:
    40     public:
    41       typedef T ValueType;
    41       typedef T Value;
    42       typedef Node KeyType;
    42       typedef Node Key;
    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]; }
    57     template <typename T>
    57     template <typename T>
    58     class EdgeMap {
    58     class EdgeMap {
    59       const ListGraph& G; 
    59       const ListGraph& G; 
    60       std::vector<T> container;
    60       std::vector<T> container;
    61     public:
    61     public:
    62       typedef T ValueType;
    62       typedef T Value;
    63       typedef Edge KeyType;
    63       typedef Edge Key;
    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]; }