COIN-OR::LEMON - Graph Library

Changeset 606:c5fd2d996909 in lemon for lemon/maps.h


Ignore:
Timestamp:
03/29/09 23:08:20 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Various doc improvements (#248)

  • Rename all the ugly template parameters (too long and/or starting with an underscore).
  • Rename function parameters starting with an underscore.
  • Extend the doc for many classes.
  • Use LaTeX-style O(...) expressions only for the complicated ones.
  • A lot of small unification changes.
  • Small fixes.
  • Some other improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/maps.h

    r463 r606  
    6464  class NullMap : public MapBase<K, V> {
    6565  public:
    66     typedef MapBase<K, V> Parent;
    67     typedef typename Parent::Key Key;
    68     typedef typename Parent::Value Value;
     66    ///\e
     67    typedef K Key;
     68    ///\e
     69    typedef V Value;
    6970
    7071    /// Gives back a default constructed element.
     
    103104    V _value;
    104105  public:
    105     typedef MapBase<K, V> Parent;
    106     typedef typename Parent::Key Key;
    107     typedef typename Parent::Value Value;
     106    ///\e
     107    typedef K Key;
     108    ///\e
     109    typedef V Value;
    108110
    109111    /// Default constructor
     
    169171  class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
    170172  public:
    171     typedef MapBase<K, V> Parent;
    172     typedef typename Parent::Key Key;
    173     typedef typename Parent::Value Value;
     173    ///\e
     174    typedef K Key;
     175    ///\e
     176    typedef V Value;
    174177
    175178    /// Constructor.
     
    203206  class IdentityMap : public MapBase<T, T> {
    204207  public:
    205     typedef MapBase<T, T> Parent;
    206     typedef typename Parent::Key Key;
    207     typedef typename Parent::Value Value;
     208    ///\e
     209    typedef T Key;
     210    ///\e
     211    typedef T Value;
    208212
    209213    /// Gives back the given value without any modification.
     
    246250  public:
    247251
    248     typedef MapBase<int, V> Parent;
    249252    /// Key type
    250     typedef typename Parent::Key Key;
     253    typedef int Key;
    251254    /// Value type
    252     typedef typename Parent::Value Value;
     255    typedef V Value;
    253256    /// Reference type
    254257    typedef typename Vector::reference Reference;
     
    354357  /// The simplest way of using this map is through the sparseMap()
    355358  /// function.
    356   template <typename K, typename V, typename Compare = std::less<K> >
     359  template <typename K, typename V, typename Comp = std::less<K> >
    357360  class SparseMap : public MapBase<K, V> {
    358361    template <typename K1, typename V1, typename C1>
     
    360363  public:
    361364
    362     typedef MapBase<K, V> Parent;
    363365    /// Key type
    364     typedef typename Parent::Key Key;
     366    typedef K Key;
    365367    /// Value type
    366     typedef typename Parent::Value Value;
     368    typedef V Value;
    367369    /// Reference type
    368370    typedef Value& Reference;
     
    374376  private:
    375377
    376     typedef std::map<K, V, Compare> Map;
     378    typedef std::map<K, V, Comp> Map;
    377379    Map _map;
    378380    Value _value;
     
    490492    const M2 &_m2;
    491493  public:
    492     typedef MapBase<typename M2::Key, typename M1::Value> Parent;
    493     typedef typename Parent::Key Key;
    494     typedef typename Parent::Value Value;
     494    ///\e
     495    typedef typename M2::Key Key;
     496    ///\e
     497    typedef typename M1::Value Value;
    495498
    496499    /// Constructor
    497500    ComposeMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    498501
    499     /// \e
     502    ///\e
    500503    typename MapTraits<M1>::ConstReturnValue
    501504    operator[](const Key &k) const { return _m1[_m2[k]]; }
     
    546549    F _f;
    547550  public:
    548     typedef MapBase<typename M1::Key, V> Parent;
    549     typedef typename Parent::Key Key;
    550     typedef typename Parent::Value Value;
     551    ///\e
     552    typedef typename M1::Key Key;
     553    ///\e
     554    typedef V Value;
    551555
    552556    /// Constructor
    553557    CombineMap(const M1 &m1, const M2 &m2, const F &f = F())
    554558      : _m1(m1), _m2(m2), _f(f) {}
    555     /// \e
     559    ///\e
    556560    Value operator[](const Key &k) const { return _f(_m1[k],_m2[k]); }
    557561  };
     
    616620    F _f;
    617621  public:
    618     typedef MapBase<K, V> Parent;
    619     typedef typename Parent::Key Key;
    620     typedef typename Parent::Value Value;
     622    ///\e
     623    typedef K Key;
     624    ///\e
     625    typedef V Value;
    621626
    622627    /// Constructor
    623628    FunctorToMap(const F &f = F()) : _f(f) {}
    624     /// \e
     629    ///\e
    625630    Value operator[](const Key &k) const { return _f(k); }
    626631  };
     
    670675    const M &_m;
    671676  public:
    672     typedef MapBase<typename M::Key, typename M::Value> Parent;
    673     typedef typename Parent::Key Key;
    674     typedef typename Parent::Value Value;
    675 
    676     typedef typename Parent::Key argument_type;
    677     typedef typename Parent::Value result_type;
     677    ///\e
     678    typedef typename M::Key Key;
     679    ///\e
     680    typedef typename M::Value Value;
     681
     682    typedef typename M::Key argument_type;
     683    typedef typename M::Value result_type;
    678684
    679685    /// Constructor
    680686    MapToFunctor(const M &m) : _m(m) {}
    681     /// \e
     687    ///\e
    682688    Value operator()(const Key &k) const { return _m[k]; }
    683     /// \e
     689    ///\e
    684690    Value operator[](const Key &k) const { return _m[k]; }
    685691  };
     
    710716    const M &_m;
    711717  public:
    712     typedef MapBase<typename M::Key, V> Parent;
    713     typedef typename Parent::Key Key;
    714     typedef typename Parent::Value Value;
     718    ///\e
     719    typedef typename M::Key Key;
     720    ///\e
     721    typedef V Value;
    715722
    716723    /// Constructor
     
    720727    ConvertMap(const M &m) : _m(m) {}
    721728
    722     /// \e
     729    ///\e
    723730    Value operator[](const Key &k) const { return _m[k]; }
    724731  };
     
    752759    M2 &_m2;
    753760  public:
    754     typedef MapBase<typename M1::Key, typename M1::Value> Parent;
    755     typedef typename Parent::Key Key;
    756     typedef typename Parent::Value Value;
     761    ///\e
     762    typedef typename M1::Key Key;
     763    ///\e
     764    typedef typename M1::Value Value;
    757765
    758766    /// Constructor
     
    798806    const M2 &_m2;
    799807  public:
    800     typedef MapBase<typename M1::Key, typename M1::Value> Parent;
    801     typedef typename Parent::Key Key;
    802     typedef typename Parent::Value Value;
     808    ///\e
     809    typedef typename M1::Key Key;
     810    ///\e
     811    typedef typename M1::Value Value;
    803812
    804813    /// Constructor
    805814    AddMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    806     /// \e
     815    ///\e
    807816    Value operator[](const Key &k) const { return _m1[k]+_m2[k]; }
    808817  };
     
    846855    const M2 &_m2;
    847856  public:
    848     typedef MapBase<typename M1::Key, typename M1::Value> Parent;
    849     typedef typename Parent::Key Key;
    850     typedef typename Parent::Value Value;
     857    ///\e
     858    typedef typename M1::Key Key;
     859    ///\e
     860    typedef typename M1::Value Value;
    851861
    852862    /// Constructor
    853863    SubMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    854     /// \e
     864    ///\e
    855865    Value operator[](const Key &k) const { return _m1[k]-_m2[k]; }
    856866  };
     
    895905    const M2 &_m2;
    896906  public:
    897     typedef MapBase<typename M1::Key, typename M1::Value> Parent;
    898     typedef typename Parent::Key Key;
    899     typedef typename Parent::Value Value;
     907    ///\e
     908    typedef typename M1::Key Key;
     909    ///\e
     910    typedef typename M1::Value Value;
    900911
    901912    /// Constructor
    902913    MulMap(const M1 &m1,const M2 &m2) : _m1(m1), _m2(m2) {}
    903     /// \e
     914    ///\e
    904915    Value operator[](const Key &k) const { return _m1[k]*_m2[k]; }
    905916  };
     
    943954    const M2 &_m2;
    944955  public:
    945     typedef MapBase<typename M1::Key, typename M1::Value> Parent;
    946     typedef typename Parent::Key Key;
    947     typedef typename Parent::Value Value;
     956    ///\e
     957    typedef typename M1::Key Key;
     958    ///\e
     959    typedef typename M1::Value Value;
    948960
    949961    /// Constructor
    950962    DivMap(const M1 &m1,const M2 &m2) : _m1(m1), _m2(m2) {}
    951     /// \e
     963    ///\e
    952964    Value operator[](const Key &k) const { return _m1[k]/_m2[k]; }
    953965  };
     
    9931005    C _v;
    9941006  public:
    995     typedef MapBase<typename M::Key, typename M::Value> Parent;
    996     typedef typename Parent::Key Key;
    997     typedef typename Parent::Value Value;
     1007    ///\e
     1008    typedef typename M::Key Key;
     1009    ///\e
     1010    typedef typename M::Value Value;
    9981011
    9991012    /// Constructor
     
    10031016    /// \param v The constant value.
    10041017    ShiftMap(const M &m, const C &v) : _m(m), _v(v) {}
    1005     /// \e
     1018    ///\e
    10061019    Value operator[](const Key &k) const { return _m[k]+_v; }
    10071020  };
     
    10231036    C _v;
    10241037  public:
    1025     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1026     typedef typename Parent::Key Key;
    1027     typedef typename Parent::Value Value;
     1038    ///\e
     1039    typedef typename M::Key Key;
     1040    ///\e
     1041    typedef typename M::Value Value;
    10281042
    10291043    /// Constructor
     
    10331047    /// \param v The constant value.
    10341048    ShiftWriteMap(M &m, const C &v) : _m(m), _v(v) {}
    1035     /// \e
     1049    ///\e
    10361050    Value operator[](const Key &k) const { return _m[k]+_v; }
    1037     /// \e
     1051    ///\e
    10381052    void set(const Key &k, const Value &v) { _m.set(k, v-_v); }
    10391053  };
     
    10941108    C _v;
    10951109  public:
    1096     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1097     typedef typename Parent::Key Key;
    1098     typedef typename Parent::Value Value;
     1110    ///\e
     1111    typedef typename M::Key Key;
     1112    ///\e
     1113    typedef typename M::Value Value;
    10991114
    11001115    /// Constructor
     
    11041119    /// \param v The constant value.
    11051120    ScaleMap(const M &m, const C &v) : _m(m), _v(v) {}
    1106     /// \e
     1121    ///\e
    11071122    Value operator[](const Key &k) const { return _v*_m[k]; }
    11081123  };
     
    11251140    C _v;
    11261141  public:
    1127     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1128     typedef typename Parent::Key Key;
    1129     typedef typename Parent::Value Value;
     1142    ///\e
     1143    typedef typename M::Key Key;
     1144    ///\e
     1145    typedef typename M::Value Value;
    11301146
    11311147    /// Constructor
     
    11351151    /// \param v The constant value.
    11361152    ScaleWriteMap(M &m, const C &v) : _m(m), _v(v) {}
    1137     /// \e
     1153    ///\e
    11381154    Value operator[](const Key &k) const { return _v*_m[k]; }
    1139     /// \e
     1155    ///\e
    11401156    void set(const Key &k, const Value &v) { _m.set(k, v/_v); }
    11411157  };
     
    11941210    const M& _m;
    11951211  public:
    1196     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1197     typedef typename Parent::Key Key;
    1198     typedef typename Parent::Value Value;
     1212    ///\e
     1213    typedef typename M::Key Key;
     1214    ///\e
     1215    typedef typename M::Value Value;
    11991216
    12001217    /// Constructor
    12011218    NegMap(const M &m) : _m(m) {}
    1202     /// \e
     1219    ///\e
    12031220    Value operator[](const Key &k) const { return -_m[k]; }
    12041221  };
     
    12291246    M &_m;
    12301247  public:
    1231     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1232     typedef typename Parent::Key Key;
    1233     typedef typename Parent::Value Value;
     1248    ///\e
     1249    typedef typename M::Key Key;
     1250    ///\e
     1251    typedef typename M::Value Value;
    12341252
    12351253    /// Constructor
    12361254    NegWriteMap(M &m) : _m(m) {}
    1237     /// \e
     1255    ///\e
    12381256    Value operator[](const Key &k) const { return -_m[k]; }
    1239     /// \e
     1257    ///\e
    12401258    void set(const Key &k, const Value &v) { _m.set(k, -v); }
    12411259  };
     
    12831301    const M &_m;
    12841302  public:
    1285     typedef MapBase<typename M::Key, typename M::Value> Parent;
    1286     typedef typename Parent::Key Key;
    1287     typedef typename Parent::Value Value;
     1303    ///\e
     1304    typedef typename M::Key Key;
     1305    ///\e
     1306    typedef typename M::Value Value;
    12881307
    12891308    /// Constructor
    12901309    AbsMap(const M &m) : _m(m) {}
    1291     /// \e
     1310    ///\e
    12921311    Value operator[](const Key &k) const {
    12931312      Value tmp = _m[k];
     
    13381357  class TrueMap : public MapBase<K, bool> {
    13391358  public:
    1340     typedef MapBase<K, bool> Parent;
    1341     typedef typename Parent::Key Key;
    1342     typedef typename Parent::Value Value;
     1359    ///\e
     1360    typedef K Key;
     1361    ///\e
     1362    typedef bool Value;
    13431363
    13441364    /// Gives back \c true.
     
    13751395  class FalseMap : public MapBase<K, bool> {
    13761396  public:
    1377     typedef MapBase<K, bool> Parent;
    1378     typedef typename Parent::Key Key;
    1379     typedef typename Parent::Value Value;
     1397    ///\e
     1398    typedef K Key;
     1399    ///\e
     1400    typedef bool Value;
    13801401
    13811402    /// Gives back \c false.
     
    14201441    const M2 &_m2;
    14211442  public:
    1422     typedef MapBase<typename M1::Key, bool> Parent;
    1423     typedef typename Parent::Key Key;
    1424     typedef typename Parent::Value Value;
     1443    ///\e
     1444    typedef typename M1::Key Key;
     1445    ///\e
     1446    typedef bool Value;
    14251447
    14261448    /// Constructor
    14271449    AndMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    1428     /// \e
     1450    ///\e
    14291451    Value operator[](const Key &k) const { return _m1[k]&&_m2[k]; }
    14301452  };
     
    14681490    const M2 &_m2;
    14691491  public:
    1470     typedef MapBase<typename M1::Key, bool> Parent;
    1471     typedef typename Parent::Key Key;
    1472     typedef typename Parent::Value Value;
     1492    ///\e
     1493    typedef typename M1::Key Key;
     1494    ///\e
     1495    typedef bool Value;
    14731496
    14741497    /// Constructor
    14751498    OrMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    1476     /// \e
     1499    ///\e
    14771500    Value operator[](const Key &k) const { return _m1[k]||_m2[k]; }
    14781501  };
     
    15071530    const M &_m;
    15081531  public:
    1509     typedef MapBase<typename M::Key, bool> Parent;
    1510     typedef typename Parent::Key Key;
    1511     typedef typename Parent::Value Value;
     1532    ///\e
     1533    typedef typename M::Key Key;
     1534    ///\e
     1535    typedef bool Value;
    15121536
    15131537    /// Constructor
    15141538    NotMap(const M &m) : _m(m) {}
    1515     /// \e
     1539    ///\e
    15161540    Value operator[](const Key &k) const { return !_m[k]; }
    15171541  };
     
    15331557    M &_m;
    15341558  public:
    1535     typedef MapBase<typename M::Key, bool> Parent;
    1536     typedef typename Parent::Key Key;
    1537     typedef typename Parent::Value Value;
     1559    ///\e
     1560    typedef typename M::Key Key;
     1561    ///\e
     1562    typedef bool Value;
    15381563
    15391564    /// Constructor
    15401565    NotWriteMap(M &m) : _m(m) {}
    1541     /// \e
     1566    ///\e
    15421567    Value operator[](const Key &k) const { return !_m[k]; }
    1543     /// \e
     1568    ///\e
    15441569    void set(const Key &k, bool v) { _m.set(k, !v); }
    15451570  };
     
    15961621    const M2 &_m2;
    15971622  public:
    1598     typedef MapBase<typename M1::Key, bool> Parent;
    1599     typedef typename Parent::Key Key;
    1600     typedef typename Parent::Value Value;
     1623    ///\e
     1624    typedef typename M1::Key Key;
     1625    ///\e
     1626    typedef bool Value;
    16011627
    16021628    /// Constructor
    16031629    EqualMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    1604     /// \e
     1630    ///\e
    16051631    Value operator[](const Key &k) const { return _m1[k]==_m2[k]; }
    16061632  };
     
    16441670    const M2 &_m2;
    16451671  public:
    1646     typedef MapBase<typename M1::Key, bool> Parent;
    1647     typedef typename Parent::Key Key;
    1648     typedef typename Parent::Value Value;
     1672    ///\e
     1673    typedef typename M1::Key Key;
     1674    ///\e
     1675    typedef bool Value;
    16491676
    16501677    /// Constructor
    16511678    LessMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {}
    1652     /// \e
     1679    ///\e
    16531680    Value operator[](const Key &k) const { return _m1[k]<_m2[k]; }
    16541681  };
     
    17061733  /// function.
    17071734  ///
    1708   /// \tparam It The type of the iterator.
    1709   /// \tparam Ke The key type of the map. The default value set
     1735  /// \tparam IT The type of the iterator.
     1736  /// \tparam KEY The key type of the map. The default value set
    17101737  /// according to the iterator type should work in most cases.
    17111738  ///
     
    17131740  /// for the elements or the iterator should be an inserter iterator.
    17141741#ifdef DOXYGEN
    1715   template <typename It, typename Ke>
     1742  template <typename IT, typename KEY>
    17161743#else
    1717   template <typename It,
    1718             typename Ke=typename _maps_bits::IteratorTraits<It>::Value>
     1744  template <typename IT,
     1745            typename KEY = typename _maps_bits::IteratorTraits<IT>::Value>
    17191746#endif
    1720   class LoggerBoolMap {
    1721   public:
    1722     typedef It Iterator;
    1723 
    1724     typedef Ke Key;
     1747  class LoggerBoolMap : public MapBase<KEY, bool> {
     1748  public:
     1749
     1750    ///\e
     1751    typedef KEY Key;
     1752    ///\e
    17251753    typedef bool Value;
     1754    ///\e
     1755    typedef IT Iterator;
    17261756
    17271757    /// Constructor
     
    17861816  /// @{
    17871817
    1788   /// Provides an immutable and unique id for each item in the graph.
    1789 
    1790   /// The IdMap class provides a unique and immutable id for each item of the
    1791   /// same type (e.g. node) in the graph. This id is <ul><li>\b unique:
    1792   /// different items (nodes) get different ids <li>\b immutable: the id of an
    1793   /// item (node) does not change (even if you delete other nodes).  </ul>
    1794   /// Through this map you get access (i.e. can read) the inner id values of
    1795   /// the items stored in the graph. This map can be inverted with its member
     1818  /// \brief Provides an immutable and unique id for each item in a graph.
     1819  ///
     1820  /// IdMap provides a unique and immutable id for each item of the
     1821  /// same type (\c Node, \c Arc or \c Edge) in a graph. This id is
     1822  ///  - \b unique: different items get different ids,
     1823  ///  - \b immutable: the id of an item does not change (even if you
     1824  ///    delete other nodes).
     1825  ///
     1826  /// Using this map you get access (i.e. can read) the inner id values of
     1827  /// the items stored in the graph, which is returned by the \c id()
     1828  /// function of the graph. This map can be inverted with its member
    17961829  /// class \c InverseMap or with the \c operator() member.
    17971830  ///
    1798   template <typename _Graph, typename _Item>
    1799   class IdMap {
    1800   public:
    1801     typedef _Graph Graph;
     1831  /// \tparam GR The graph type.
     1832  /// \tparam K The key type of the map (\c GR::Node, \c GR::Arc or
     1833  /// \c GR::Edge).
     1834  ///
     1835  /// \see DescriptorMap
     1836  template <typename GR, typename K>
     1837  class IdMap : public MapBase<K, int> {
     1838  public:
     1839    /// The graph type of IdMap.
     1840    typedef GR Graph;
     1841    /// The key type of IdMap (\c Node, \c Arc or \c Edge).
     1842    typedef K Item;
     1843    /// The key type of IdMap (\c Node, \c Arc or \c Edge).
     1844    typedef K Key;
     1845    /// The value type of IdMap.
    18021846    typedef int Value;
    1803     typedef _Item Item;
    1804     typedef _Item Key;
    18051847
    18061848    /// \brief Constructor.
     
    18141856    int operator[](const Item& item) const { return _graph->id(item);}
    18151857
    1816     /// \brief Gives back the item by its id.
    1817     ///
    1818     /// Gives back the item by its id.
     1858    /// \brief Gives back the \e item by its id.
     1859    ///
     1860    /// Gives back the \e item by its id.
    18191861    Item operator()(int id) { return _graph->fromId(id, Item()); }
    18201862
     
    18241866  public:
    18251867
    1826     /// \brief The class represents the inverse of its owner (IdMap).
    1827     ///
    1828     /// The class represents the inverse of its owner (IdMap).
     1868    /// \brief This class represents the inverse of its owner (IdMap).
     1869    ///
     1870    /// This class represents the inverse of its owner (IdMap).
    18291871    /// \see inverse()
    18301872    class InverseMap {
     
    18441886      ///
    18451887      /// Gives back the given item from its id.
    1846       ///
    18471888      Item operator[](int id) const { return _graph->fromId(id, Item());}
    18481889
     
    18551896    /// Gives back the inverse of the IdMap.
    18561897    InverseMap inverse() const { return InverseMap(*_graph);}
    1857 
    1858   };
    1859 
    1860 
    1861   /// \brief General invertable graph-map type.
    1862 
    1863   /// This type provides simple invertable graph-maps.
    1864   /// The InvertableMap wraps an arbitrary ReadWriteMap
     1898  };
     1899
     1900
     1901  /// \brief General invertable graph map type.
     1902
     1903  /// This class provides simple invertable graph maps.
     1904  /// It wraps an arbitrary \ref concepts::ReadWriteMap "ReadWriteMap"
    18651905  /// and if a key is set to a new value then store it
    18661906  /// in the inverse map.
     
    18691909  /// with stl compatible forward iterator.
    18701910  ///
    1871   /// \tparam _Graph The graph type.
    1872   /// \tparam _Item The item type of the graph.
    1873   /// \tparam _Value The value type of the map.
     1911  /// \tparam GR The graph type.
     1912  /// \tparam K The key type of the map (\c GR::Node, \c GR::Arc or
     1913  /// \c GR::Edge).
     1914  /// \tparam V The value type of the map.
    18741915  ///
    18751916  /// \see IterableValueMap
    1876   template <typename _Graph, typename _Item, typename _Value>
     1917  template <typename GR, typename K, typename V>
    18771918  class InvertableMap
    1878     : protected ItemSetTraits<_Graph, _Item>::template Map<_Value>::Type {
     1919    : protected ItemSetTraits<GR, K>::template Map<V>::Type {
    18791920  private:
    18801921
    1881     typedef typename ItemSetTraits<_Graph, _Item>::
    1882     template Map<_Value>::Type Map;
    1883     typedef _Graph Graph;
    1884 
    1885     typedef std::map<_Value, _Item> Container;
     1922    typedef typename ItemSetTraits<GR, K>::
     1923      template Map<V>::Type Map;
     1924
     1925    typedef std::map<V, K> Container;
    18861926    Container _inv_map;
    18871927
    18881928  public:
    18891929
    1890     /// The key type of InvertableMap (Node, Arc, Edge).
    1891     typedef typename Map::Key Key;
    1892     /// The value type of the InvertableMap.
    1893     typedef typename Map::Value Value;
     1930    /// The graph type of InvertableMap.
     1931    typedef GR Graph;
     1932    /// The key type of InvertableMap (\c Node, \c Arc or \c Edge).
     1933    typedef K Item;
     1934    /// The key type of InvertableMap (\c Node, \c Arc or \c Edge).
     1935    typedef K Key;
     1936    /// The value type of InvertableMap.
     1937    typedef V Value;
    18941938
    18951939    /// \brief Constructor.
    18961940    ///
    1897     /// Construct a new InvertableMap for the graph.
    1898     ///
     1941    /// Construct a new InvertableMap for the given graph.
    18991942    explicit InvertableMap(const Graph& graph) : Map(graph) {}
    19001943
     
    19031946    /// This iterator is an stl compatible forward
    19041947    /// iterator on the values of the map. The values can
    1905     /// be accessed in the [beginValue, endValue) range.
    1906     ///
     1948    /// be accessed in the <tt>[beginValue, endValue)</tt> range.
    19071949    class ValueIterator
    19081950      : public std::iterator<std::forward_iterator_tag, Value> {
     
    19361978    /// Returns an stl compatible iterator to the
    19371979    /// first value of the map. The values of the
    1938     /// map can be accessed in the [beginValue, endValue)
     1980    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    19391981    /// range.
    19401982    ValueIterator beginValue() const {
     
    19461988    /// Returns an stl compatible iterator after the
    19471989    /// last value of the map. The values of the
    1948     /// map can be accessed in the [beginValue, endValue)
     1990    /// map can be accessed in the <tt>[beginValue, endValue)</tt>
    19491991    /// range.
    19501992    ValueIterator endValue() const {
     
    19521994    }
    19531995
    1954     /// \brief The setter function of the map.
    1955     ///
    1956     /// Sets the mapped value.
     1996    /// \brief Sets the value associated with the given key.
     1997    ///
     1998    /// Sets the value associated with the given key.
    19571999    void set(const Key& key, const Value& val) {
    19582000      Value oldval = Map::operator[](key);
     
    19652007    }
    19662008
    1967     /// \brief The getter function of the map.
    1968     ///
    1969     /// It gives back the value associated with the key.
     2009    /// \brief Returns the value associated with the given key.
     2010    ///
     2011    /// Returns the value associated with the given key.
    19702012    typename MapTraits<Map>::ConstReturnValue
    19712013    operator[](const Key& key) const {
     
    19832025  protected:
    19842026
    1985     /// \brief Erase the key from the map.
    1986     ///
    1987     /// Erase the key to the map. It is called by the
     2027    /// \brief Erase the key from the map and the inverse map.
     2028    ///
     2029    /// Erase the key from the map and the inverse map. It is called by the
    19882030    /// \c AlterationNotifier.
    19892031    virtual void erase(const Key& key) {
     
    19962038    }
    19972039
    1998     /// \brief Erase more keys from the map.
    1999     ///
    2000     /// Erase more keys from the map. It is called by the
     2040    /// \brief Erase more keys from the map and the inverse map.
     2041    ///
     2042    /// Erase more keys from the map and the inverse map. It is called by the
    20012043    /// \c AlterationNotifier.
    20022044    virtual void erase(const std::vector<Key>& keys) {
     
    20112053    }
    20122054
    2013     /// \brief Clear the keys from the map and inverse map.
    2014     ///
    2015     /// Clear the keys from the map and inverse map. It is called by the
     2055    /// \brief Clear the keys from the map and the inverse map.
     2056    ///
     2057    /// Clear the keys from the map and the inverse map. It is called by the
    20162058    /// \c AlterationNotifier.
    20172059    virtual void clear() {
     
    20252067    ///
    20262068    /// The inverse of this map. The subscript operator of the map
    2027     /// gives back always the item what was last assigned to the value.
     2069    /// gives back the item that was last assigned to the value.
    20282070    class InverseMap {
    20292071    public:
    2030       /// \brief Constructor of the InverseMap.
     2072      /// \brief Constructor
    20312073      ///
    20322074      /// Constructor of the InverseMap.
     
    20412083      /// \brief Subscript operator.
    20422084      ///
    2043       /// Subscript operator. It gives back always the item
    2044       /// what was last assigned to the value.
     2085      /// Subscript operator. It gives back the item
     2086      /// that was last assigned to the given value.
    20452087      Value operator[](const Key& key) const {
    20462088        return _inverted(key);
     
    20512093    };
    20522094
    2053     /// \brief It gives back the just readable inverse map.
    2054     ///
    2055     /// It gives back the just readable inverse map.
     2095    /// \brief It gives back the read-only inverse map.
     2096    ///
     2097    /// It gives back the read-only inverse map.
    20562098    InverseMap inverse() const {
    20572099      return InverseMap(*this);
     
    20612103
    20622104  /// \brief Provides a mutable, continuous and unique descriptor for each
    2063   /// item in the graph.
    2064   ///
    2065   /// The DescriptorMap class provides a unique and continuous (but mutable)
    2066   /// descriptor (id) for each item of the same type (e.g. node) in the
    2067   /// graph. This id is <ul><li>\b unique: different items (nodes) get
    2068   /// different ids <li>\b continuous: the range of the ids is the set of
    2069   /// integers between 0 and \c n-1, where \c n is the number of the items of
    2070   /// this type (e.g. nodes) (so the id of a node can change if you delete an
    2071   /// other node, i.e. this id is mutable).  </ul> This map can be inverted
    2072   /// with its member class \c InverseMap, or with the \c operator() member.
    2073   ///
    2074   /// \tparam _Graph The graph class the \c DescriptorMap belongs to.
    2075   /// \tparam _Item The Item is the Key of the Map. It may be Node, Arc or
    2076   /// Edge.
    2077   template <typename _Graph, typename _Item>
     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  /// \c Edge) in a graph. This id is
     2110  ///  - \b unique: different items get different ids,
     2111  ///  - \b continuous: the range of the ids is the set of integers
     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). 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.
     2116  ///
     2117  /// Thus this id is not (necessarily) the same as what can get using
     2118  /// the \c id() function of the graph or \ref IdMap.
     2119  /// This map can be inverted with its member class \c InverseMap,
     2120  /// or with the \c operator() member.
     2121  ///
     2122  /// \tparam GR The graph type.
     2123  /// \tparam K The key type of the map (\c GR::Node, \c GR::Arc or
     2124  /// \c GR::Edge).
     2125  ///
     2126  /// \see IdMap
     2127  template <typename GR, typename K>
    20782128  class DescriptorMap
    2079     : protected ItemSetTraits<_Graph, _Item>::template Map<int>::Type {
    2080 
    2081     typedef _Item Item;
    2082     typedef typename ItemSetTraits<_Graph, _Item>::template Map<int>::Type Map;
    2083 
    2084   public:
    2085     /// The graph class of DescriptorMap.
    2086     typedef _Graph Graph;
    2087 
    2088     /// The key type of DescriptorMap (Node, Arc, Edge).
    2089     typedef typename Map::Key Key;
     2129    : protected ItemSetTraits<GR, K>::template Map<int>::Type {
     2130
     2131    typedef typename ItemSetTraits<GR, K>::template Map<int>::Type Map;
     2132
     2133  public:
     2134    /// The graph type of DescriptorMap.
     2135    typedef GR Graph;
     2136    /// The key type of DescriptorMap (\c Node, \c Arc or \c Edge).
     2137    typedef K Item;
     2138    /// The key type of DescriptorMap (\c Node, \c Arc or \c Edge).
     2139    typedef K Key;
    20902140    /// The value type of DescriptorMap.
    2091     typedef typename Map::Value Value;
     2141    typedef int Value;
    20922142
    20932143    /// \brief Constructor.
    20942144    ///
    20952145    /// Constructor for descriptor map.
    2096     explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
     2146    explicit DescriptorMap(const Graph& gr) : Map(gr) {
    20972147      Item it;
    20982148      const typename Map::Notifier* nf = Map::notifier();
     
    21052155  protected:
    21062156
    2107     /// \brief Add a new key to the map.
     2157    /// \brief Adds a new key to the map.
    21082158    ///
    21092159    /// Add a new key to the map. It is called by the
     
    22152265
    22162266  public:
     2267
    22172268    /// \brief The inverse map type of DescriptorMap.
    22182269    ///
     
    22202271    class InverseMap {
    22212272    public:
    2222       /// \brief Constructor of the InverseMap.
     2273      /// \brief Constructor
    22232274      ///
    22242275      /// Constructor of the InverseMap.
     
    22352286      ///
    22362287      /// Subscript operator. It gives back the item
    2237       /// that the descriptor belongs to currently.
     2288      /// that the descriptor currently belongs to.
    22382289      Value operator[](const Key& key) const {
    22392290        return _inverted(key);
     
    22592310  };
    22602311
    2261   /// \brief Returns the source of the given arc.
    2262   ///
    2263   /// The SourceMap gives back the source Node of the given arc.
     2312  /// \brief Map of the source nodes of arcs in a digraph.
     2313  ///
     2314  /// SourceMap provides access for the source node of each arc in a digraph,
     2315  /// which is returned by the \c source() function of the digraph.
     2316  /// \tparam GR The digraph type.
    22642317  /// \see TargetMap
    2265   template <typename Digraph>
     2318  template <typename GR>
    22662319  class SourceMap {
    22672320  public:
    22682321
    2269     typedef typename Digraph::Node Value;
    2270     typedef typename Digraph::Arc Key;
     2322    ///\e
     2323    typedef typename GR::Arc Key;
     2324    ///\e
     2325    typedef typename GR::Node Value;
    22712326
    22722327    /// \brief Constructor
    22732328    ///
    2274     /// Constructor
     2329    /// Constructor.
    22752330    /// \param digraph The digraph that the map belongs to.
    2276     explicit SourceMap(const Digraph& digraph) : _digraph(digraph) {}
    2277 
    2278     /// \brief The subscript operator.
    2279     ///
    2280     /// The subscript operator.
    2281     /// \param arc The arc
    2282     /// \return The source of the arc
     2331    explicit SourceMap(const GR& digraph) : _graph(digraph) {}
     2332
     2333    /// \brief Returns the source node of the given arc.
     2334    ///
     2335    /// Returns the source node of the given arc.
    22832336    Value operator[](const Key& arc) const {
    2284       return _digraph.source(arc);
     2337      return _graph.source(arc);
    22852338    }
    22862339
    22872340  private:
    2288     const Digraph& _digraph;
     2341    const GR& _graph;
    22892342  };
    22902343
     
    22932346  /// This function just returns an \c SourceMap class.
    22942347  /// \relates SourceMap
    2295   template <typename Digraph>
    2296   inline SourceMap<Digraph> sourceMap(const Digraph& digraph) {
    2297     return SourceMap<Digraph>(digraph);
    2298   }
    2299 
    2300   /// \brief Returns the target of the given arc.
    2301   ///
    2302   /// The TargetMap gives back the target Node of the given arc.
     2348  template <typename GR>
     2349  inline SourceMap<GR> sourceMap(const GR& graph) {
     2350    return SourceMap<GR>(graph);
     2351  }
     2352
     2353  /// \brief Map of the target nodes of arcs in a digraph.
     2354  ///
     2355  /// TargetMap provides access for the target node of each arc in a digraph,
     2356  /// which is returned by the \c target() function of the digraph.
     2357  /// \tparam GR The digraph type.
    23032358  /// \see SourceMap
    2304   template <typename Digraph>
     2359  template <typename GR>
    23052360  class TargetMap {
    23062361  public:
    23072362
    2308     typedef typename Digraph::Node Value;
    2309     typedef typename Digraph::Arc Key;
     2363    ///\e
     2364    typedef typename GR::Arc Key;
     2365    ///\e
     2366    typedef typename GR::Node Value;
    23102367
    23112368    /// \brief Constructor
    23122369    ///
    2313     /// Constructor
     2370    /// Constructor.
    23142371    /// \param digraph The digraph that the map belongs to.
    2315     explicit TargetMap(const Digraph& digraph) : _digraph(digraph) {}
    2316 
    2317     /// \brief The subscript operator.
    2318     ///
    2319     /// The subscript operator.
    2320     /// \param e The arc
    2321     /// \return The target of the arc
     2372    explicit TargetMap(const GR& digraph) : _graph(digraph) {}
     2373
     2374    /// \brief Returns the target node of the given arc.
     2375    ///
     2376    /// Returns the target node of the given arc.
    23222377    Value operator[](const Key& e) const {
    2323       return _digraph.target(e);
     2378      return _graph.target(e);
    23242379    }
    23252380
    23262381  private:
    2327     const Digraph& _digraph;
     2382    const GR& _graph;
    23282383  };
    23292384
     
    23322387  /// This function just returns a \c TargetMap class.
    23332388  /// \relates TargetMap
    2334   template <typename Digraph>
    2335   inline TargetMap<Digraph> targetMap(const Digraph& digraph) {
    2336     return TargetMap<Digraph>(digraph);
    2337   }
    2338 
    2339   /// \brief Returns the "forward" directed arc view of an edge.
    2340   ///
    2341   /// Returns the "forward" directed arc view of an edge.
     2389  template <typename GR>
     2390  inline TargetMap<GR> targetMap(const GR& graph) {
     2391    return TargetMap<GR>(graph);
     2392  }
     2393
     2394  /// \brief Map of the "forward" directed arc view of edges in a graph.
     2395  ///
     2396  /// ForwardMap provides access for the "forward" directed arc view of
     2397  /// each edge in a graph, which is returned by the \c direct() function
     2398  /// of the graph with \c true parameter.
     2399  /// \tparam GR The graph type.
    23422400  /// \see BackwardMap
    2343   template <typename Graph>
     2401  template <typename GR>
    23442402  class ForwardMap {
    23452403  public:
    23462404
    2347     typedef typename Graph::Arc Value;
    2348     typedef typename Graph::Edge Key;
     2405    typedef typename GR::Arc Value;
     2406    typedef typename GR::Edge Key;
    23492407
    23502408    /// \brief Constructor
    23512409    ///
    2352     /// Constructor
     2410    /// Constructor.
    23532411    /// \param graph The graph that the map belongs to.
    2354     explicit ForwardMap(const Graph& graph) : _graph(graph) {}
    2355 
    2356     /// \brief The subscript operator.
    2357     ///
    2358     /// The subscript operator.
    2359     /// \param key An edge
    2360     /// \return The "forward" directed arc view of edge
     2412    explicit ForwardMap(const GR& graph) : _graph(graph) {}
     2413
     2414    /// \brief Returns the "forward" directed arc view of the given edge.
     2415    ///
     2416    /// Returns the "forward" directed arc view of the given edge.
    23612417    Value operator[](const Key& key) const {
    23622418      return _graph.direct(key, true);
     
    23642420
    23652421  private:
    2366     const Graph& _graph;
     2422    const GR& _graph;
    23672423  };
    23682424
     
    23712427  /// This function just returns an \c ForwardMap class.
    23722428  /// \relates ForwardMap
    2373   template <typename Graph>
    2374   inline ForwardMap<Graph> forwardMap(const Graph& graph) {
    2375     return ForwardMap<Graph>(graph);
    2376   }
    2377 
    2378   /// \brief Returns the "backward" directed arc view of an edge.
    2379   ///
    2380   /// Returns the "backward" directed arc view of an edge.
     2429  template <typename GR>
     2430  inline ForwardMap<GR> forwardMap(const GR& graph) {
     2431    return ForwardMap<GR>(graph);
     2432  }
     2433
     2434  /// \brief Map of the "backward" directed arc view of edges in a graph.
     2435  ///
     2436  /// BackwardMap provides access for the "backward" directed arc view of
     2437  /// each edge in a graph, which is returned by the \c direct() function
     2438  /// of the graph with \c false parameter.
     2439  /// \tparam GR The graph type.
    23812440  /// \see ForwardMap
    2382   template <typename Graph>
     2441  template <typename GR>
    23832442  class BackwardMap {
    23842443  public:
    23852444
    2386     typedef typename Graph::Arc Value;
    2387     typedef typename Graph::Edge Key;
     2445    typedef typename GR::Arc Value;
     2446    typedef typename GR::Edge Key;
    23882447
    23892448    /// \brief Constructor
    23902449    ///
    2391     /// Constructor
     2450    /// Constructor.
    23922451    /// \param graph The graph that the map belongs to.
    2393     explicit BackwardMap(const Graph& graph) : _graph(graph) {}
    2394 
    2395     /// \brief The subscript operator.
    2396     ///
    2397     /// The subscript operator.
    2398     /// \param key An edge
    2399     /// \return The "backward" directed arc view of edge
     2452    explicit BackwardMap(const GR& graph) : _graph(graph) {}
     2453
     2454    /// \brief Returns the "backward" directed arc view of the given edge.
     2455    ///
     2456    /// Returns the "backward" directed arc view of the given edge.
    24002457    Value operator[](const Key& key) const {
    24012458      return _graph.direct(key, false);
     
    24032460
    24042461  private:
    2405     const Graph& _graph;
     2462    const GR& _graph;
    24062463  };
    24072464
     
    24102467  /// This function just returns a \c BackwardMap class.
    24112468  /// \relates BackwardMap
    2412   template <typename Graph>
    2413   inline BackwardMap<Graph> backwardMap(const Graph& graph) {
    2414     return BackwardMap<Graph>(graph);
    2415   }
    2416 
    2417   /// \brief Potential difference map
    2418   ///
    2419   /// If there is an potential map on the nodes then we
    2420   /// can get an arc map as we get the substraction of the
    2421   /// values of the target and source.
    2422   template <typename Digraph, typename NodeMap>
    2423   class PotentialDifferenceMap {
    2424   public:
    2425     typedef typename Digraph::Arc Key;
    2426     typedef typename NodeMap::Value Value;
    2427 
    2428     /// \brief Constructor
    2429     ///
    2430     /// Contructor of the map
    2431     explicit PotentialDifferenceMap(const Digraph& digraph,
    2432                                     const NodeMap& potential)
    2433       : _digraph(digraph), _potential(potential) {}
    2434 
    2435     /// \brief Const subscription operator
    2436     ///
    2437     /// Const subscription operator
    2438     Value operator[](const Key& arc) const {
    2439       return _potential[_digraph.target(arc)] -
    2440         _potential[_digraph.source(arc)];
    2441     }
    2442 
    2443   private:
    2444     const Digraph& _digraph;
    2445     const NodeMap& _potential;
    2446   };
    2447 
    2448   /// \brief Returns a PotentialDifferenceMap.
    2449   ///
    2450   /// This function just returns a PotentialDifferenceMap.
    2451   /// \relates PotentialDifferenceMap
    2452   template <typename Digraph, typename NodeMap>
    2453   PotentialDifferenceMap<Digraph, NodeMap>
    2454   potentialDifferenceMap(const Digraph& digraph, const NodeMap& potential) {
    2455     return PotentialDifferenceMap<Digraph, NodeMap>(digraph, potential);
    2456   }
    2457 
    2458   /// \brief Map of the node in-degrees.
     2469  template <typename GR>
     2470  inline BackwardMap<GR> backwardMap(const GR& graph) {
     2471    return BackwardMap<GR>(graph);
     2472  }
     2473
     2474  /// \brief Map of the in-degrees of nodes in a digraph.
    24592475  ///
    24602476  /// This map returns the in-degree of a node. Once it is constructed,
    2461   /// the degrees are stored in a standard NodeMap, so each query is done
     2477  /// the degrees are stored in a standard \c NodeMap, so each query is done
    24622478  /// in constant time. On the other hand, the values are updated automatically
    24632479  /// whenever the digraph changes.
    24642480  ///
    2465   /// \warning Besides addNode() and addArc(), a digraph structure may provide
    2466   /// alternative ways to modify the digraph. The correct behavior of InDegMap
    2467   /// is not guarantied if these additional features are used. For example
    2468   /// the functions \ref ListDigraph::changeSource() "changeSource()",
     2481  /// \warning Besides \c addNode() and \c addArc(), a digraph structure
     2482  /// may provide alternative ways to modify the digraph.
     2483  /// The correct behavior of InDegMap is not guarantied if these additional
     2484  /// features are used. For example the functions
     2485  /// \ref ListDigraph::changeSource() "changeSource()",
    24692486  /// \ref ListDigraph::changeTarget() "changeTarget()" and
    24702487  /// \ref ListDigraph::reverseArc() "reverseArc()"
     
    24722489  ///
    24732490  /// \sa OutDegMap
    2474 
    2475   template <typename _Digraph>
     2491  template <typename GR>
    24762492  class InDegMap
    2477     : protected ItemSetTraits<_Digraph, typename _Digraph::Arc>
     2493    : protected ItemSetTraits<GR, typename GR::Arc>
    24782494      ::ItemNotifier::ObserverBase {
    24792495
    24802496  public:
    2481 
    2482     typedef _Digraph Digraph;
     2497   
     2498    /// The digraph type
     2499    typedef GR Digraph;
     2500    /// The key type
     2501    typedef typename Digraph::Node Key;
     2502    /// The value type
    24832503    typedef int Value;
    2484     typedef typename Digraph::Node Key;
    24852504
    24862505    typedef typename ItemSetTraits<Digraph, typename Digraph::Arc>
     
    25242543    /// \brief Constructor.
    25252544    ///
    2526     /// Constructor for creating in-degree map.
    2527     explicit InDegMap(const Digraph& digraph)
    2528       : _digraph(digraph), _deg(digraph) {
     2545    /// Constructor for creating an in-degree map.
     2546    explicit InDegMap(const Digraph& graph)
     2547      : _digraph(graph), _deg(graph) {
    25292548      Parent::attach(_digraph.notifier(typename Digraph::Arc()));
    25302549
     
    25342553    }
    25352554
     2555    /// \brief Gives back the in-degree of a Node.
     2556    ///
    25362557    /// Gives back the in-degree of a Node.
    25372558    int operator[](const Key& key) const {
     
    25802601  };
    25812602
    2582   /// \brief Map of the node out-degrees.
     2603  /// \brief Map of the out-degrees of nodes in a digraph.
    25832604  ///
    25842605  /// This map returns the out-degree of a node. Once it is constructed,
    2585   /// the degrees are stored in a standard NodeMap, so each query is done
     2606  /// the degrees are stored in a standard \c NodeMap, so each query is done
    25862607  /// in constant time. On the other hand, the values are updated automatically
    25872608  /// whenever the digraph changes.
    25882609  ///
    2589   /// \warning Besides addNode() and addArc(), a digraph structure may provide
    2590   /// alternative ways to modify the digraph. The correct behavior of OutDegMap
    2591   /// is not guarantied if these additional features are used. For example
    2592   /// the functions \ref ListDigraph::changeSource() "changeSource()",
     2610  /// \warning Besides \c addNode() and \c addArc(), a digraph structure
     2611  /// may provide alternative ways to modify the digraph.
     2612  /// The correct behavior of OutDegMap is not guarantied if these additional
     2613  /// features are used. For example the functions
     2614  /// \ref ListDigraph::changeSource() "changeSource()",
    25932615  /// \ref ListDigraph::changeTarget() "changeTarget()" and
    25942616  /// \ref ListDigraph::reverseArc() "reverseArc()"
     
    25962618  ///
    25972619  /// \sa InDegMap
    2598 
    2599   template <typename _Digraph>
     2620  template <typename GR>
    26002621  class OutDegMap
    2601     : protected ItemSetTraits<_Digraph, typename _Digraph::Arc>
     2622    : protected ItemSetTraits<GR, typename GR::Arc>
    26022623      ::ItemNotifier::ObserverBase {
    26032624
    26042625  public:
    26052626
    2606     typedef _Digraph Digraph;
     2627    /// The digraph type
     2628    typedef GR Digraph;
     2629    /// The key type
     2630    typedef typename Digraph::Node Key;
     2631    /// The value type
    26072632    typedef int Value;
    2608     typedef typename Digraph::Node Key;
    26092633
    26102634    typedef typename ItemSetTraits<Digraph, typename Digraph::Arc>
     
    26462670    /// \brief Constructor.
    26472671    ///
    2648     /// Constructor for creating out-degree map.
    2649     explicit OutDegMap(const Digraph& digraph)
    2650       : _digraph(digraph), _deg(digraph) {
     2672    /// Constructor for creating an out-degree map.
     2673    explicit OutDegMap(const Digraph& graph)
     2674      : _digraph(graph), _deg(graph) {
    26512675      Parent::attach(_digraph.notifier(typename Digraph::Arc()));
    26522676
     
    26562680    }
    26572681
     2682    /// \brief Gives back the out-degree of a Node.
     2683    ///
    26582684    /// Gives back the out-degree of a Node.
    26592685    int operator[](const Key& key) const {
     
    27022728  };
    27032729
     2730  /// \brief Potential difference map
     2731  ///
     2732  /// PotentialMap returns the difference between the potentials of the
     2733  /// source and target nodes of each arc in a digraph, i.e. it returns
     2734  /// \code
     2735  ///   potential[gr.target(arc)] - potential[gr.source(arc)].
     2736  /// \endcode
     2737  /// \tparam GR The digraph type.
     2738  /// \tparam POT A node map storing the potentials.
     2739  template <typename GR, typename POT>
     2740  class PotentialDifferenceMap {
     2741  public:
     2742    /// Key type
     2743    typedef typename GR::Arc Key;
     2744    /// Value type
     2745    typedef typename POT::Value Value;
     2746
     2747    /// \brief Constructor
     2748    ///
     2749    /// Contructor of the map.
     2750    explicit PotentialDifferenceMap(const GR& gr,
     2751                                    const POT& potential)
     2752      : _digraph(gr), _potential(potential) {}
     2753
     2754    /// \brief Returns the potential difference for the given arc.
     2755    ///
     2756    /// Returns the potential difference for the given arc, i.e.
     2757    /// \code
     2758    ///   potential[gr.target(arc)] - potential[gr.source(arc)].
     2759    /// \endcode
     2760    Value operator[](const Key& arc) const {
     2761      return _potential[_digraph.target(arc)] -
     2762        _potential[_digraph.source(arc)];
     2763    }
     2764
     2765  private:
     2766    const GR& _digraph;
     2767    const POT& _potential;
     2768  };
     2769
     2770  /// \brief Returns a PotentialDifferenceMap.
     2771  ///
     2772  /// This function just returns a PotentialDifferenceMap.
     2773  /// \relates PotentialDifferenceMap
     2774  template <typename GR, typename POT>
     2775  PotentialDifferenceMap<GR, POT>
     2776  potentialDifferenceMap(const GR& gr, const POT& potential) {
     2777    return PotentialDifferenceMap<GR, POT>(gr, potential);
     2778  }
     2779
    27042780  /// @}
    27052781}
Note: See TracChangeset for help on using the changeset viewer.