7 ///\brief Graph maps that construates and destruates
8 ///their elements dynamically.
12 /// \addtogroup graphmaps
15 /** The SymEdgeIt is wrapper class for the EdgeIt. It can be used to
16 * iterate on the symmetric maps when all of the edge - reverse edge pair
17 * has different parity.
21 template <typename Graph, typename Edge, typename EdgeIt>
22 class SymEdgeIt : public EdgeIt {
25 /** Default constructor.
30 /** Graph initialized constructor.
32 SymEdgeIt(const Graph& graph)
34 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
39 /** Creating invelid SymEdgeIt.
41 SymEdgeIt(Invalid invalid)
44 /** SymEdgeIt from the given Edge.
46 SymEdgeIt(const Graph& graph, const Edge& edge)
47 : EdgeIt(graph, edge) {
48 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
53 /** Increase operator.
55 SymEdgeIt& operator++() {
57 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
64 /** The SymMap template class is graph map structure what
65 * wraps an other map structure to use as symmetric map structure.
67 * The template parameter is the MapRegistry that the maps
68 * will belong to and the ValueType.
70 template <template <typename, typename> class DynMap,
71 typename MapRegistry, typename Value>
72 class SymMap : public DynMap<MapRegistry, Value>{
76 typedef DynMap<MapRegistry, Value> MapImpl;
80 /// The graph type of the maps.
81 typedef typename MapRegistry::Graph Graph;
83 typedef typename MapImpl::KeyType KeyType;
88 /** Default constructor for the map.
90 SymMap() : MapImpl() {}
92 /** Graph and Registry initialized map constructor.
94 SymMap(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
96 /** Constructor to use default value to initialize the map.
98 SymMap(const Graph& g, MapRegistry& r, const Value& v)
101 /** Constructor to copy a map of the same map type.
103 SymMap(const SymMap& copy)
104 : MapImpl(static_cast<const MapImpl&>(copy)) {}
106 /** Constructor to copy a map of an other map type.
108 template <typename CMap> SymMap(const CMap& copy)
111 /** Assign operator to copy a map of the same map type.
113 SymMap& operator=(const SymMap& copy) {
114 MapImpl::operator=(static_cast<const MapImpl&>(copy));
118 /** Assign operator to copy a map of an other map type.
120 template <typename CMap> SymMap& operator=(const CMap& copy) {
121 MapImpl::operator=(copy);
125 /** Add a new key to the map. It called by the map registry.
127 void add(const KeyType& key) {
128 int id = MapImpl::getGraph()->id(key);
133 /** Erase a key from the map. It called by the map registry.
135 void erase(const KeyType& key) {
136 int id = MapImpl::getGraph()->id(key);