src/work/deba/vector_edge_map.h
author beckerjc
Sat, 17 Apr 2004 19:19:57 +0000
changeset 349 42c660f58702
permissions -rw-r--r--
Kruskal lenyegeben kesz.
Kell meg dokumentalni, meg meg egy par jol hasznalhato wrapper fv.
Es valamit meg kene csinalni azzal, hogy nem const ref. a kimeno boolmap,
viszont sokszor "on-the-fly" akarjuk megkonstrualni (es ilyenkor persze a
const-os mapet is lehet set-elni...)
deba@262
     1
#ifndef VECTOR_EDGE_MAP_H
deba@262
     2
#define VECTOR_EDGE_MAP_H
deba@262
     3
deba@262
     4
#include <vector>
deba@262
     5
deba@262
     6
#include "edge_map_base.h"
deba@262
     7
deba@262
     8
template <typename G, typename E, typename V> 
deba@262
     9
class VectorEdgeMap : public EdgeMapBase<G, E>{
deba@262
    10
public:
deba@262
    11
	typedef V ValueType;
deba@262
    12
	
deba@262
    13
	VectorEdgeMap(Graph& g) : EdgeMapBase<G, E>(g) {}
deba@262
    14
	
deba@262
    15
	void add(const E& edge) {
deba@262
    16
		if (edge->id >= container.size()) {
deba@262
    17
			container.resize(edge->id);
deba@262
    18
		}
deba@262
    19
	}
deba@262
    20
	
deba@262
    21
	void erase(const E&) {}
deba@262
    22
deba@262
    23
private:
deba@262
    24
	typedef vector<ValueType> Container;
deba@262
    25
	
deba@262
    26
	Container container;
deba@262
    27
}
deba@262
    28
deba@262
    29
#endif