Changes in / [573:37216ca5b9c6:571:d5c39e9d1a4e] in lemon-main
- Files:
-
- 2 edited
-
lemon/maps.h (modified) (14 diffs)
-
test/graph_utils_test.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lemon/maps.h
r572 r559 1833 1833 /// \c GR::Edge). 1834 1834 /// 1835 /// \see RangeIdMap1835 /// \see DescriptorMap 1836 1836 template <typename GR, typename K> 1837 1837 class IdMap : public MapBase<K, int> { … … 1899 1899 1900 1900 1901 /// \brief General cross reference graph map type.1901 /// \brief General invertable graph map type. 1902 1902 1903 1903 /// This class provides simple invertable graph maps. … … 1916 1916 /// \see IterableValueMap 1917 1917 template <typename GR, typename K, typename V> 1918 class CrossRefMap1918 class InvertableMap 1919 1919 : protected ItemSetTraits<GR, K>::template Map<V>::Type { 1920 1920 private: … … 1928 1928 public: 1929 1929 1930 /// The graph type of CrossRefMap.1930 /// The graph type of InvertableMap. 1931 1931 typedef GR Graph; 1932 /// The key type of CrossRefMap (\c Node, \c Arc or \c Edge).1932 /// The key type of InvertableMap (\c Node, \c Arc or \c Edge). 1933 1933 typedef K Item; 1934 /// The key type of CrossRefMap (\c Node, \c Arc or \c Edge).1934 /// The key type of InvertableMap (\c Node, \c Arc or \c Edge). 1935 1935 typedef K Key; 1936 /// The value type of CrossRefMap.1936 /// The value type of InvertableMap. 1937 1937 typedef V Value; 1938 1938 1939 1939 /// \brief Constructor. 1940 1940 /// 1941 /// Construct a new CrossRefMap for the given graph.1942 explicit CrossRefMap(const Graph& graph) : Map(graph) {}1941 /// Construct a new InvertableMap for the given graph. 1942 explicit InvertableMap(const Graph& graph) : Map(graph) {} 1943 1943 1944 1944 /// \brief Forward iterator for values. … … 1949 1949 class ValueIterator 1950 1950 : public std::iterator<std::forward_iterator_tag, Value> { 1951 friend class CrossRefMap;1951 friend class InvertableMap; 1952 1952 private: 1953 1953 ValueIterator(typename Container::const_iterator _it) … … 2073 2073 /// 2074 2074 /// Constructor of the InverseMap. 2075 explicit InverseMap(const CrossRefMap& inverted)2075 explicit InverseMap(const InvertableMap& inverted) 2076 2076 : _inverted(inverted) {} 2077 2077 2078 2078 /// The value type of the InverseMap. 2079 typedef typename CrossRefMap::Key Value;2079 typedef typename InvertableMap::Key Value; 2080 2080 /// The key type of the InverseMap. 2081 typedef typename CrossRefMap::Value Key;2081 typedef typename InvertableMap::Value Key; 2082 2082 2083 2083 /// \brief Subscript operator. … … 2090 2090 2091 2091 private: 2092 const CrossRefMap& _inverted;2092 const InvertableMap& _inverted; 2093 2093 }; 2094 2094 … … 2102 2102 }; 2103 2103 2104 /// \brief Provides continuous and unique ID for the2105 /// item s ofa graph.2106 /// 2107 /// RangeIdMap provides a unique and continuous2108 /// ID for each item of a giventype (\c Node, \c Arc or2104 /// \brief Provides a mutable, continuous and unique descriptor for each 2105 /// item in a graph. 2106 /// 2107 /// DescriptorMap provides a unique and continuous (but mutable) 2108 /// descriptor (id) for each item of the same type (\c Node, \c Arc or 2109 2109 /// \c Edge) in a graph. This id is 2110 2110 /// - \b unique: different items get different ids, 2111 2111 /// - \b continuous: the range of the ids is the set of integers 2112 2112 /// between 0 and \c n-1, where \c n is the number of the items of 2113 /// this type (\c Node, \c Arc or \c Edge). 2114 /// - So, the ids can change when deleting an item of the same type. 2113 /// this type (\c Node, \c Arc or \c Edge). So the id of an item can 2114 /// change if you delete an other item of the same type, i.e. this 2115 /// id is mutable. 2115 2116 /// 2116 2117 /// Thus this id is not (necessarily) the same as what can get using … … 2125 2126 /// \see IdMap 2126 2127 template <typename GR, typename K> 2127 class RangeIdMap2128 class DescriptorMap 2128 2129 : protected ItemSetTraits<GR, K>::template Map<int>::Type { 2129 2130 … … 2131 2132 2132 2133 public: 2133 /// The graph type of RangeIdMap.2134 /// The graph type of DescriptorMap. 2134 2135 typedef GR Graph; 2135 /// The key type of RangeIdMap (\c Node, \c Arc or \c Edge).2136 /// The key type of DescriptorMap (\c Node, \c Arc or \c Edge). 2136 2137 typedef K Item; 2137 /// The key type of RangeIdMap (\c Node, \c Arc or \c Edge).2138 /// The key type of DescriptorMap (\c Node, \c Arc or \c Edge). 2138 2139 typedef K Key; 2139 /// The value type of RangeIdMap.2140 /// The value type of DescriptorMap. 2140 2141 typedef int Value; 2141 2142 2142 2143 /// \brief Constructor. 2143 2144 /// 2144 /// Constructor .2145 explicit RangeIdMap(const Graph& gr) : Map(gr) {2145 /// Constructor for descriptor map. 2146 explicit DescriptorMap(const Graph& gr) : Map(gr) { 2146 2147 Item it; 2147 2148 const typename Map::Notifier* nf = Map::notifier(); … … 2244 2245 } 2245 2246 2246 /// \brief Gives back the \e RangeId of the item2247 /// 2248 /// Gives back the \e RangeId of the item.2247 /// \brief Gives back the \e descriptor of the item. 2248 /// 2249 /// Gives back the mutable and unique \e descriptor of the map. 2249 2250 int operator[](const Item& item) const { 2250 2251 return Map::operator[](item); 2251 2252 } 2252 2253 2253 /// \brief Gives back the item b elonging to a \e RangeId2254 /// 2255 /// Gives back th e item belonging to a \e RangeId.2254 /// \brief Gives back the item by its descriptor. 2255 /// 2256 /// Gives back th item by its descriptor. 2256 2257 Item operator()(int id) const { 2257 2258 return _inv_map[id]; … … 2265 2266 public: 2266 2267 2267 /// \brief The inverse map type of RangeIdMap.2268 /// 2269 /// The inverse map type of RangeIdMap.2268 /// \brief The inverse map type of DescriptorMap. 2269 /// 2270 /// The inverse map type of DescriptorMap. 2270 2271 class InverseMap { 2271 2272 public: … … 2273 2274 /// 2274 2275 /// Constructor of the InverseMap. 2275 explicit InverseMap(const RangeIdMap& inverted)2276 explicit InverseMap(const DescriptorMap& inverted) 2276 2277 : _inverted(inverted) {} 2277 2278 2278 2279 2279 2280 /// The value type of the InverseMap. 2280 typedef typename RangeIdMap::Key Value;2281 typedef typename DescriptorMap::Key Value; 2281 2282 /// The key type of the InverseMap. 2282 typedef typename RangeIdMap::Value Key;2283 typedef typename DescriptorMap::Value Key; 2283 2284 2284 2285 /// \brief Subscript operator. … … 2298 2299 2299 2300 private: 2300 const RangeIdMap& _inverted;2301 const DescriptorMap& _inverted; 2301 2302 }; 2302 2303 -
test/graph_utils_test.cc
r572 r440 39 39 digraph.addNode(); 40 40 } 41 RangeIdMap<Digraph, Node> nodes(digraph);42 typename RangeIdMap<Digraph, Node>::InverseMap invNodes(nodes);41 DescriptorMap<Digraph, Node> nodes(digraph); 42 typename DescriptorMap<Digraph, Node>::InverseMap invNodes(nodes); 43 43 for (int i = 0; i < 100; ++i) { 44 44 int src = rnd[invNodes.size()]; … … 47 47 } 48 48 typename Digraph::template ArcMap<bool> found(digraph, false); 49 RangeIdMap<Digraph, Arc> arcs(digraph);49 DescriptorMap<Digraph, Arc> arcs(digraph); 50 50 for (NodeIt src(digraph); src != INVALID; ++src) { 51 51 for (NodeIt trg(digraph); trg != INVALID; ++trg) { … … 114 114 graph.addNode(); 115 115 } 116 RangeIdMap<Graph, Node> nodes(graph);117 typename RangeIdMap<Graph, Node>::InverseMap invNodes(nodes);116 DescriptorMap<Graph, Node> nodes(graph); 117 typename DescriptorMap<Graph, Node>::InverseMap invNodes(nodes); 118 118 for (int i = 0; i < 100; ++i) { 119 119 int src = rnd[invNodes.size()]; … … 122 122 } 123 123 typename Graph::template EdgeMap<int> found(graph, 0); 124 RangeIdMap<Graph, Edge> edges(graph);124 DescriptorMap<Graph, Edge> edges(graph); 125 125 for (NodeIt src(graph); src != INVALID; ++src) { 126 126 for (NodeIt trg(graph); trg != INVALID; ++trg) {
Note: See TracChangeset
for help on using the changeset viewer.

