lemon/bfs.h
changeset 280 e7f8647ce760
parent 258 0310c8984732
child 281 e9b4fbe163f5
equal deleted inserted replaced
10:8b8b64daffd7 12:37f6b65014b8
    51     ///Instantiates a \ref PredMap.
    51     ///Instantiates a \ref PredMap.
    52 
    52 
    53     ///This function instantiates a \ref PredMap.
    53     ///This function instantiates a \ref PredMap.
    54     ///\param g is the digraph, to which we would like to define the
    54     ///\param g is the digraph, to which we would like to define the
    55     ///\ref PredMap.
    55     ///\ref PredMap.
    56     ///\todo The digraph alone may be insufficient to initialize
       
    57     static PredMap *createPredMap(const Digraph &g)
    56     static PredMap *createPredMap(const Digraph &g)
    58     {
    57     {
    59       return new PredMap(g);
    58       return new PredMap(g);
    60     }
    59     }
    61 
    60 
    62     ///The type of the map that indicates which nodes are processed.
    61     ///The type of the map that indicates which nodes are processed.
    63 
    62 
    64     ///The type of the map that indicates which nodes are processed.
    63     ///The type of the map that indicates which nodes are processed.
    65     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    64     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    66     ///By default it is a NullMap.
       
    67     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    65     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    68     ///Instantiates a \ref ProcessedMap.
    66     ///Instantiates a \ref ProcessedMap.
    69 
    67 
    70     ///This function instantiates a \ref ProcessedMap.
    68     ///This function instantiates a \ref ProcessedMap.
    71     ///\param g is the digraph, to which
    69     ///\param g is the digraph, to which
   193 
   191 
   194     std::vector<typename Digraph::Node> _queue;
   192     std::vector<typename Digraph::Node> _queue;
   195     int _queue_head,_queue_tail,_queue_next_dist;
   193     int _queue_head,_queue_tail,_queue_next_dist;
   196     int _curr_dist;
   194     int _curr_dist;
   197 
   195 
   198     ///Creates the maps if necessary.
   196     //Creates the maps if necessary.
   199     ///\todo Better memory allocation (instead of new).
       
   200     void create_maps()
   197     void create_maps()
   201     {
   198     {
   202       if(!_pred) {
   199       if(!_pred) {
   203         local_pred = true;
   200         local_pred = true;
   204         _pred = Traits::createPredMap(*G);
   201         _pred = Traits::createPredMap(*G);
   845     ///Instantiates a \ref PredMap.
   842     ///Instantiates a \ref PredMap.
   846 
   843 
   847     ///This function instantiates a \ref PredMap.
   844     ///This function instantiates a \ref PredMap.
   848     ///\param g is the digraph, to which we would like to define the
   845     ///\param g is the digraph, to which we would like to define the
   849     ///\ref PredMap.
   846     ///\ref PredMap.
   850     ///\todo The digraph alone may be insufficient to initialize
       
   851 #ifdef DOXYGEN
   847 #ifdef DOXYGEN
   852     static PredMap *createPredMap(const Digraph &g)
   848     static PredMap *createPredMap(const Digraph &g)
   853 #else
   849 #else
   854     static PredMap *createPredMap(const Digraph &)
   850     static PredMap *createPredMap(const Digraph &)
   855 #endif
   851 #endif
  1330     bool local_reached;
  1326     bool local_reached;
  1331 
  1327 
  1332     std::vector<typename Digraph::Node> _list;
  1328     std::vector<typename Digraph::Node> _list;
  1333     int _list_front, _list_back;
  1329     int _list_front, _list_back;
  1334 
  1330 
  1335     ///Creates the maps if necessary.
  1331     //Creates the maps if necessary.
  1336     ///\todo Better memory allocation (instead of new).
       
  1337     void create_maps() {
  1332     void create_maps() {
  1338       if(!_reached) {
  1333       if(!_reached) {
  1339         local_reached = true;
  1334         local_reached = true;
  1340         _reached = Traits::createReachedMap(*_digraph);
  1335         _reached = Traits::createReachedMap(*_digraph);
  1341       }
  1336       }