lemon/maps.h
changeset 788 c92296660262
parent 726 3fc2a801c39e
child 792 a2d5fd4c309a
equal deleted inserted replaced
44:50dbf6892c00 45:b3d7d2637835
   228   /// \brief Map for storing values for integer keys from the range
   228   /// \brief Map for storing values for integer keys from the range
   229   /// <tt>[0..size-1]</tt>.
   229   /// <tt>[0..size-1]</tt>.
   230   ///
   230   ///
   231   /// This map is essentially a wrapper for \c std::vector. It assigns
   231   /// This map is essentially a wrapper for \c std::vector. It assigns
   232   /// values to integer keys from the range <tt>[0..size-1]</tt>.
   232   /// values to integer keys from the range <tt>[0..size-1]</tt>.
   233   /// It can be used with some data structures, for example
   233   /// It can be used together with some data structures, e.g.
   234   /// \c UnionFind, \c BinHeap, when the used items are small
   234   /// heap types and \c UnionFind, when the used items are small
   235   /// integers. This map conforms to the \ref concepts::ReferenceMap
   235   /// integers. This map conforms to the \ref concepts::ReferenceMap
   236   /// "ReferenceMap" concept.
   236   /// "ReferenceMap" concept. 
   237   ///
   237   ///
   238   /// The simplest way of using this map is through the rangeMap()
   238   /// The simplest way of using this map is through the rangeMap()
   239   /// function.
   239   /// function.
   240   template <typename V>
   240   template <typename V>
   241   class RangeMap : public MapBase<int, V> {
   241   class RangeMap : public MapBase<int, V> {
   346   /// This map is useful if a default value should be assigned to most of
   346   /// This map is useful if a default value should be assigned to most of
   347   /// the keys and different values should be assigned only to a few
   347   /// the keys and different values should be assigned only to a few
   348   /// keys (i.e. the map is "sparse").
   348   /// keys (i.e. the map is "sparse").
   349   /// The name of this type also refers to this important usage.
   349   /// The name of this type also refers to this important usage.
   350   ///
   350   ///
   351   /// Apart form that this map can be used in many other cases since it
   351   /// Apart form that, this map can be used in many other cases since it
   352   /// is based on \c std::map, which is a general associative container.
   352   /// is based on \c std::map, which is a general associative container.
   353   /// However keep in mind that it is usually not as efficient as other
   353   /// However, keep in mind that it is usually not as efficient as other
   354   /// maps.
   354   /// maps.
   355   ///
   355   ///
   356   /// The simplest way of using this map is through the sparseMap()
   356   /// The simplest way of using this map is through the sparseMap()
   357   /// function.
   357   /// function.
   358   template <typename K, typename V, typename Comp = std::less<K> >
   358   template <typename K, typename V, typename Comp = std::less<K> >
  1783 
  1783 
  1784   /// This function just returns a \c LoggerBoolMap class.
  1784   /// This function just returns a \c LoggerBoolMap class.
  1785   ///
  1785   ///
  1786   /// The most important usage of it is storing certain nodes or arcs
  1786   /// The most important usage of it is storing certain nodes or arcs
  1787   /// that were marked \c true by an algorithm.
  1787   /// that were marked \c true by an algorithm.
  1788   /// For example it makes easier to store the nodes in the processing
  1788   /// For example, it makes easier to store the nodes in the processing
  1789   /// order of Dfs algorithm, as the following examples show.
  1789   /// order of Dfs algorithm, as the following examples show.
  1790   /// \code
  1790   /// \code
  1791   ///   std::vector<Node> v;
  1791   ///   std::vector<Node> v;
  1792   ///   dfs(g).processedMap(loggerBoolMap(std::back_inserter(v))).run(s);
  1792   ///   dfs(g).processedMap(loggerBoolMap(std::back_inserter(v))).run(s);
  1793   /// \endcode
  1793   /// \endcode
  1798   ///
  1798   ///
  1799   /// \note The container of the iterator must contain enough space
  1799   /// \note The container of the iterator must contain enough space
  1800   /// for the elements or the iterator should be an inserter iterator.
  1800   /// for the elements or the iterator should be an inserter iterator.
  1801   ///
  1801   ///
  1802   /// \note LoggerBoolMap is just \ref concepts::WriteMap "writable", so
  1802   /// \note LoggerBoolMap is just \ref concepts::WriteMap "writable", so
  1803   /// it cannot be used when a readable map is needed, for example as
  1803   /// it cannot be used when a readable map is needed, for example, as
  1804   /// \c ReachedMap for \c Bfs, \c Dfs and \c Dijkstra algorithms.
  1804   /// \c ReachedMap for \c Bfs, \c Dfs and \c Dijkstra algorithms.
  1805   ///
  1805   ///
  1806   /// \relates LoggerBoolMap
  1806   /// \relates LoggerBoolMap
  1807   template<typename Iterator>
  1807   template<typename Iterator>
  1808   inline LoggerBoolMap<Iterator> loggerBoolMap(Iterator it) {
  1808   inline LoggerBoolMap<Iterator> loggerBoolMap(Iterator it) {
  1920   /// This map is intended to be used when all associated values are
  1920   /// This map is intended to be used when all associated values are
  1921   /// different (the map is actually invertable) or there are only a few
  1921   /// different (the map is actually invertable) or there are only a few
  1922   /// items with the same value.
  1922   /// items with the same value.
  1923   /// Otherwise consider to use \c IterableValueMap, which is more 
  1923   /// Otherwise consider to use \c IterableValueMap, which is more 
  1924   /// suitable and more efficient for such cases. It provides iterators
  1924   /// suitable and more efficient for such cases. It provides iterators
  1925   /// to traverse the items with the same associated value, however
  1925   /// to traverse the items with the same associated value, but
  1926   /// it does not have \c InverseMap.
  1926   /// it does not have \c InverseMap.
  1927   ///
  1927   ///
  1928   /// This type is not reference map, so it cannot be modified with
  1928   /// This type is not reference map, so it cannot be modified with
  1929   /// the subscript operator.
  1929   /// the subscript operator.
  1930   ///
  1930   ///
  3464   /// whenever the digraph changes.
  3464   /// whenever the digraph changes.
  3465   ///
  3465   ///
  3466   /// \warning Besides \c addNode() and \c addArc(), a digraph structure
  3466   /// \warning Besides \c addNode() and \c addArc(), a digraph structure
  3467   /// may provide alternative ways to modify the digraph.
  3467   /// may provide alternative ways to modify the digraph.
  3468   /// The correct behavior of InDegMap is not guarantied if these additional
  3468   /// The correct behavior of InDegMap is not guarantied if these additional
  3469   /// features are used. For example the functions
  3469   /// features are used. For example, the functions
  3470   /// \ref ListDigraph::changeSource() "changeSource()",
  3470   /// \ref ListDigraph::changeSource() "changeSource()",
  3471   /// \ref ListDigraph::changeTarget() "changeTarget()" and
  3471   /// \ref ListDigraph::changeTarget() "changeTarget()" and
  3472   /// \ref ListDigraph::reverseArc() "reverseArc()"
  3472   /// \ref ListDigraph::reverseArc() "reverseArc()"
  3473   /// of \ref ListDigraph will \e not update the degree values correctly.
  3473   /// of \ref ListDigraph will \e not update the degree values correctly.
  3474   ///
  3474   ///
  3594   /// whenever the digraph changes.
  3594   /// whenever the digraph changes.
  3595   ///
  3595   ///
  3596   /// \warning Besides \c addNode() and \c addArc(), a digraph structure
  3596   /// \warning Besides \c addNode() and \c addArc(), a digraph structure
  3597   /// may provide alternative ways to modify the digraph.
  3597   /// may provide alternative ways to modify the digraph.
  3598   /// The correct behavior of OutDegMap is not guarantied if these additional
  3598   /// The correct behavior of OutDegMap is not guarantied if these additional
  3599   /// features are used. For example the functions
  3599   /// features are used. For example, the functions
  3600   /// \ref ListDigraph::changeSource() "changeSource()",
  3600   /// \ref ListDigraph::changeSource() "changeSource()",
  3601   /// \ref ListDigraph::changeTarget() "changeTarget()" and
  3601   /// \ref ListDigraph::changeTarget() "changeTarget()" and
  3602   /// \ref ListDigraph::reverseArc() "reverseArc()"
  3602   /// \ref ListDigraph::reverseArc() "reverseArc()"
  3603   /// of \ref ListDigraph will \e not update the degree values correctly.
  3603   /// of \ref ListDigraph will \e not update the degree values correctly.
  3604   ///
  3604   ///