lemon/bfs.h
changeset 287 bb40b6db0a58
parent 286 da414906fe21
parent 281 e9b4fbe163f5
child 288 47b3a3b67837
child 290 f6899946c1ac
equal deleted inserted replaced
14:7dc7dbcfeb78 15:119df1b4c737
    52     ///Instantiates a \ref PredMap.
    52     ///Instantiates a \ref PredMap.
    53 
    53 
    54     ///This function instantiates a \ref PredMap.
    54     ///This function instantiates a \ref PredMap.
    55     ///\param g is the digraph, to which we would like to define the
    55     ///\param g is the digraph, to which we would like to define the
    56     ///\ref PredMap.
    56     ///\ref PredMap.
    57     ///\todo The digraph alone may be insufficient to initialize
       
    58     static PredMap *createPredMap(const Digraph &g)
    57     static PredMap *createPredMap(const Digraph &g)
    59     {
    58     {
    60       return new PredMap(g);
    59       return new PredMap(g);
    61     }
    60     }
    62 
    61 
    63     ///The type of the map that indicates which nodes are processed.
    62     ///The type of the map that indicates which nodes are processed.
    64 
    63 
    65     ///The type of the map that indicates which nodes are processed.
    64     ///The type of the map that indicates which nodes are processed.
    66     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    65     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    67     ///By default it is a NullMap.
       
    68     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    66     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    69     ///Instantiates a \ref ProcessedMap.
    67     ///Instantiates a \ref ProcessedMap.
    70 
    68 
    71     ///This function instantiates a \ref ProcessedMap.
    69     ///This function instantiates a \ref ProcessedMap.
    72     ///\param g is the digraph, to which
    70     ///\param g is the digraph, to which
   194 
   192 
   195     std::vector<typename Digraph::Node> _queue;
   193     std::vector<typename Digraph::Node> _queue;
   196     int _queue_head,_queue_tail,_queue_next_dist;
   194     int _queue_head,_queue_tail,_queue_next_dist;
   197     int _curr_dist;
   195     int _curr_dist;
   198 
   196 
   199     ///Creates the maps if necessary.
   197     //Creates the maps if necessary.
   200     ///\todo Better memory allocation (instead of new).
       
   201     void create_maps()
   198     void create_maps()
   202     {
   199     {
   203       if(!_pred) {
   200       if(!_pred) {
   204         local_pred = true;
   201         local_pred = true;
   205         _pred = Traits::createPredMap(*G);
   202         _pred = Traits::createPredMap(*G);
   846     ///Instantiates a \ref PredMap.
   843     ///Instantiates a \ref PredMap.
   847 
   844 
   848     ///This function instantiates a \ref PredMap.
   845     ///This function instantiates a \ref PredMap.
   849     ///\param g is the digraph, to which we would like to define the
   846     ///\param g is the digraph, to which we would like to define the
   850     ///\ref PredMap.
   847     ///\ref PredMap.
   851     ///\todo The digraph alone may be insufficient to initialize
       
   852     static PredMap *createPredMap(const Digraph &g)
   848     static PredMap *createPredMap(const Digraph &g)
   853     {
   849     {
   854       return new PredMap(g);
   850       return new PredMap(g);
   855     }
   851     }
   856 
   852 
  1368     bool local_reached;
  1364     bool local_reached;
  1369 
  1365 
  1370     std::vector<typename Digraph::Node> _list;
  1366     std::vector<typename Digraph::Node> _list;
  1371     int _list_front, _list_back;
  1367     int _list_front, _list_back;
  1372 
  1368 
  1373     ///Creates the maps if necessary.
  1369     //Creates the maps if necessary.
  1374     ///\todo Better memory allocation (instead of new).
       
  1375     void create_maps() {
  1370     void create_maps() {
  1376       if(!_reached) {
  1371       if(!_reached) {
  1377         local_reached = true;
  1372         local_reached = true;
  1378         _reached = Traits::createReachedMap(*_digraph);
  1373         _reached = Traits::createReachedMap(*_digraph);
  1379       }
  1374       }