SettingOrderBoolMap< Map > Class Template Reference
[Map Adaptors]


Detailed Description

template<typename Map>
class lemon::SettingOrderBoolMap< Map >

Writable bool map that stores for each true assigned elements the sequence number of this setting. It makes it easy to calculate the leaving order of the nodes in the Dfs algorithm.

      typedef Graph::NodeMap<int> OrderMap;
      OrderMap order(graph);
      typedef SettingOrderBoolMap<OrderMap> OrderSetterMap;
      OrderSetterMap setter(order);
      Dfs<Graph>::DefProcessedMap<OrderSetterMap>::Create dfs(graph);
      dfs.processedMap(setter);
      dfs.init();
      for (NodeIt it(graph); it != INVALID; ++it) {
        if (!dfs.reached(it)) {
          dfs.addSource(it);
          dfs.start();
        }
      }

The storing of the discovering order is more difficult because the ReachedMap should be readable in the dfs algorithm but the setting order map is not readable. Thus we must use the fork map:

      typedef Graph::NodeMap<int> OrderMap;
      OrderMap order(graph);
      typedef SettingOrderBoolMap<OrderMap> OrderSetterMap;
      OrderSetterMap setter(order);
      typedef Graph::NodeMap<bool> StoreMap;
      StoreMap store(graph);
     
      typedef ForkWriteMap<StoreMap, OrderSetterMap> ReachedMap;
      ReachedMap reached(store, setter);
     
      Dfs<Graph>::DefReachedMap<ReachedMap>::Create dfs(graph);
      dfs.reachedMap(reached);
      dfs.init();
      for (NodeIt it(graph); it != INVALID; ++it) {
        if (!dfs.reached(it)) {
          dfs.addSource(it);
          dfs.start();
        }
      }
#include <lemon/maps.h>

List of all members.

Public Member Functions

 SettingOrderBoolMap (Map &_map)
 Constructor.
int num () const
 Number of set operations.
void set (const Key &key, Value value)
 The set function of the map.


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