COIN-OR::LEMON - Graph Library

Changeset 2251:37fa5f83251e in lemon-0.x for lemon


Ignore:
Timestamp:
10/17/06 13:02:05 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3001
Message:

Documentation for UndirGraphAdaptor?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_adaptor.h

    r2177 r2251  
    12771277  /// \brief An undirected graph is made from a directed graph by an adaptor
    12781278  ///
    1279   /// Undocumented, untested!!!
    1280   /// If somebody knows nice demo application, let's polulate it.
     1279  /// This adaptor makes an undirected graph from a directed
     1280  /// graph. All edge of the underlying will be showed in the adaptor
     1281  /// as an undirected edge. Let's see an informal example about using
     1282  /// this adaptor:
     1283  ///
     1284  /// There is a network of the streets of a town. Of course there are
     1285  /// some one-way street in the town hence the network is a directed
     1286  /// one. There is a crazy driver who go oppositely in the one-way
     1287  /// street without moral sense. Of course he can pass this streets
     1288  /// slower than the regular way, in fact his speed is half of the
     1289  /// normal speed. How long should he drive to get from a source
     1290  /// point to the target? Let see the example code which calculate it:
     1291  ///
     1292  ///\code
     1293  /// typedef UndirGraphAdaptor<Graph> UGraph;
     1294  /// UGraph ugraph(graph);
     1295  ///
     1296  /// typedef SimpleMap<LengthMap> FLengthMap;
     1297  /// FLengthMap flength(length);
     1298  ///
     1299  /// typedef ScaleMap<LengthMap> RLengthMap;
     1300  /// RLengthMap rlength(length, 2.0);
     1301  ///
     1302  /// typedef UGraph::CombinedEdgeMap<FLengthMap, RLengthMap > ULengthMap;
     1303  /// ULengthMap ulength(flength, rlength);
    12811304  ///
    1282   /// \author Marton Makai
     1305  /// Dijkstra<UGraph, ULengthMap> dijkstra(ugraph, ulength);
     1306  /// std::cout << "Driving time : " << dijkstra.run(src, trg) << std::endl;
     1307  ///\endcode
     1308  ///
     1309  /// The combined edge map makes the length map for the undirected
     1310  /// graph. It is created from a forward and reverse map. The forward
     1311  /// map is created from the original length map with a SimpleMap
     1312  /// adaptor which just makes a read-write map from the reference map
     1313  /// i.e. it forgets that it can be return reference to values. The
     1314  /// reverse map is just the scaled original map with the ScaleMap
     1315  /// adaptor. The combination solves that passing the reverse way
     1316  /// takes double time than the original. To get the driving time we
     1317  /// run the dijkstra algorithm on the undirected graph.
     1318  ///
     1319  /// \author Marton Makai and Balazs Dezso
    12831320  template<typename _Graph>
    12841321  class UndirGraphAdaptor : public AlterableUndirGraphAdaptor<_Graph> {
     
    12891326    UndirGraphAdaptor() { }
    12901327  public:
     1328
     1329    /// \brief Constructor
     1330    ///
     1331    /// Constructor
    12911332    UndirGraphAdaptor(_Graph& _graph) {
    12921333      setGraph(_graph);
    12931334    }
    12941335
     1336    /// \brief EdgeMap combined from two original EdgeMap
     1337    ///
     1338    /// This class adapts two original graph EdgeMap to
     1339    /// get an edge map on the adaptor.
    12951340    template <typename _ForwardMap, typename _BackwardMap>
    12961341    class CombinedEdgeMap {
     
    13041349      typedef typename ForwardMap::Value Value;
    13051350      typedef typename Parent::Edge Key;
    1306      
     1351
     1352      /// \brief Constructor     
     1353      ///
     1354      /// Constructor     
    13071355      CombinedEdgeMap() : forward_map(0), backward_map(0) {}
    13081356
     1357      /// \brief Constructor     
     1358      ///
     1359      /// Constructor     
    13091360      CombinedEdgeMap(ForwardMap& _forward_map, BackwardMap& _backward_map)
    13101361        : forward_map(&_forward_map), backward_map(&_backward_map) {}
    13111362     
     1363
     1364      /// \brief Sets the value associated with a key.
     1365      ///
     1366      /// Sets the value associated with a key.
    13121367      void set(const Key& e, const Value& a) {
    13131368        if (Parent::direction(e)) {
     
    13181373      }
    13191374
     1375      /// \brief Returns the value associated with a key.
     1376      ///
     1377      /// Returns the value associated with a key.
    13201378      typename MapTraits<ForwardMap>::ConstReturnValue
    13211379      operator[](const Key& e) const {
     
    13271385      }
    13281386
     1387      /// \brief Returns the value associated with a key.
     1388      ///
     1389      /// Returns the value associated with a key.
    13291390      typename MapTraits<ForwardMap>::ReturnValue
    13301391      operator[](const Key& e) {
     
    13361397      }
    13371398
     1399      /// \brief Sets the forward map
     1400      ///
     1401      /// Sets the forward map
    13381402      void setForwardMap(ForwardMap& _forward_map) {
    13391403        forward_map = &_forward_map;
    13401404      }
    13411405
     1406      /// \brief Sets the backward map
     1407      ///
     1408      /// Sets the backward map
    13421409      void setBackwardMap(BackwardMap& _backward_map) {
    13431410        backward_map = &_backward_map;
Note: See TracChangeset for help on using the changeset viewer.