lemon/graph_utils.h
changeset 2385 096d83158d41
parent 2350 eb371753e814
child 2386 81b47fc5c444
equal deleted inserted replaced
61:9c62d6730c63 62:29a1126e1ce3
  1871     /// \brief Constructor.
  1871     /// \brief Constructor.
  1872     ///
  1872     ///
  1873     /// Constructor for descriptor map.
  1873     /// Constructor for descriptor map.
  1874     explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
  1874     explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
  1875       Item it;
  1875       Item it;
  1876       const typename Map::Notifier* notifier = Map::getNotifier(); 
  1876       const typename Map::Notifier* notifier = Map::notifier(); 
  1877       for (notifier->first(it); it != INVALID; notifier->next(it)) {
  1877       for (notifier->first(it); it != INVALID; notifier->next(it)) {
  1878 	Map::set(it, invMap.size());
  1878 	Map::set(it, invMap.size());
  1879 	invMap.push_back(it);	
  1879 	invMap.push_back(it);	
  1880       }      
  1880       }      
  1881     }
  1881     }
  1933     /// Build the unique map. It is called by the
  1933     /// Build the unique map. It is called by the
  1934     /// \c AlterationNotifier.
  1934     /// \c AlterationNotifier.
  1935     virtual void build() {
  1935     virtual void build() {
  1936       Map::build();
  1936       Map::build();
  1937       Item it;
  1937       Item it;
  1938       const typename Map::Notifier* notifier = Map::getNotifier(); 
  1938       const typename Map::Notifier* notifier = Map::notifier(); 
  1939       for (notifier->first(it); it != INVALID; notifier->next(it)) {
  1939       for (notifier->first(it); it != INVALID; notifier->next(it)) {
  1940 	Map::set(it, invMap.size());
  1940 	Map::set(it, invMap.size());
  1941 	invMap.push_back(it);	
  1941 	invMap.push_back(it);	
  1942       }      
  1942       }      
  1943     }
  1943     }
  2290 
  2290 
  2291     /// \brief Constructor.
  2291     /// \brief Constructor.
  2292     ///
  2292     ///
  2293     /// Constructor for creating in-degree map.
  2293     /// Constructor for creating in-degree map.
  2294     explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
  2294     explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
  2295       Parent::attach(graph.getNotifier(typename _Graph::Edge()));
  2295       Parent::attach(graph.notifier(typename _Graph::Edge()));
  2296       
  2296       
  2297       for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
  2297       for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
  2298 	deg[it] = countInEdges(graph, it);
  2298 	deg[it] = countInEdges(graph, it);
  2299       }
  2299       }
  2300     }
  2300     }
  2402 
  2402 
  2403     /// \brief Constructor.
  2403     /// \brief Constructor.
  2404     ///
  2404     ///
  2405     /// Constructor for creating out-degree map.
  2405     /// Constructor for creating out-degree map.
  2406     explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
  2406     explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
  2407       Parent::attach(graph.getNotifier(typename _Graph::Edge()));
  2407       Parent::attach(graph.notifier(typename _Graph::Edge()));
  2408       
  2408       
  2409       for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
  2409       for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
  2410 	deg[it] = countOutEdges(graph, it);
  2410 	deg[it] = countOutEdges(graph, it);
  2411       }
  2411       }
  2412     }
  2412     }