UndirGraphAdaptor< _Graph > Class Template Reference
[Adaptor Classes for Graphs]


Detailed Description

template<typename _Graph>
class lemon::UndirGraphAdaptor< _Graph >

This adaptor makes an undirected graph from a directed graph. All edge of the underlying will be showed in the adaptor as an undirected edge. Let's see an informal example about using this adaptor:

There is a network of the streets of a town. Of course there are some one-way street in the town hence the network is a directed one. There is a crazy driver who go oppositely in the one-way street without moral sense. Of course he can pass this streets slower than the regular way, in fact his speed is half of the normal speed. How long should he drive to get from a source point to the target? Let see the example code which calculate it:

      typedef UndirGraphAdaptor<Graph> UGraph;
      UGraph ugraph(graph);
     
      typedef SimpleMap<LengthMap> FLengthMap;
      FLengthMap flength(length);
     
      typedef ScaleMap<LengthMap> RLengthMap;
      RLengthMap rlength(length, 2.0);
     
      typedef UGraph::CombinedEdgeMap<FLengthMap, RLengthMap > ULengthMap;
      ULengthMap ulength(flength, rlength);
      
      Dijkstra<UGraph, ULengthMap> dijkstra(ugraph, ulength);
      std::cout << "Driving time : " << dijkstra.run(src, trg) << std::endl;

The combined edge map makes the length map for the undirected graph. It is created from a forward and reverse map. The forward map is created from the original length map with a SimpleMap adaptor which just makes a read-write map from the reference map i.e. it forgets that it can be return reference to values. The reverse map is just the scaled original map with the ScaleMap adaptor. The combination solves that passing the reverse way takes double time than the original. To get the driving time we run the dijkstra algorithm on the undirected graph.

Author:
Marton Makai and Balazs Dezso
#include <lemon/graph_adaptor.h>

Inherits lemon::AlterableUndirGraphAdaptor<_Graph>.

List of all members.

Classes

class  CombinedEdgeMap
 EdgeMap combined from two original EdgeMap. More...

Public Member Functions

 UndirGraphAdaptor (_Graph &_graph)
 Constructor.


Constructor & Destructor Documentation

UndirGraphAdaptor ( _Graph &  _graph  )  [inline]

Constructor


Generated on Thu Jun 4 04:04:17 2009 for LEMON by  doxygen 1.5.9