src/work/bfsdemo.cc
changeset 490 ceb56ff9d07f
parent 6 b63d1bc367f7
equal deleted inserted replaced
2:e08129fd998d 3:5bd2dd77afaa
    65 //   		    &IGraph::NodeType::isVis> visited;
    65 //   		    &IGraph::NodeType::isVis> visited;
    66   struct _visited_map_t {
    66   struct _visited_map_t {
    67     typedef bool value_type;
    67     typedef bool value_type;
    68     void Put(const IGraph::NodeIterator &n,const value_type &t) { n->isVis=t; }
    68     void Put(const IGraph::NodeIterator &n,const value_type &t) { n->isVis=t; }
    69     value_type Get(const IGraph::NodeIterator &n) const { return n->isVis; }
    69     value_type Get(const IGraph::NodeIterator &n) const { return n->isVis; }
       
    70     void SetG(IGraph &G) {}
    70   } visited;
    71   } visited;
    71   struct _tree_map_t {
    72   struct _tree_map_t {
    72     typedef IGraph::EdgeIterator value_type;
    73     typedef IGraph::EdgeIterator value_type;
    73     void Put(const IGraph::NodeIterator &n,const value_type &t)
    74     void Put(const IGraph::NodeIterator &n,const value_type &t)
    74     { cout << t.From().Index() << "->" << t.To().Index() << '\n'; }
    75     { cout << t.From().Index() << "->" << t.To().Index() << '\n'; }
       
    76     void SetG(IGraph &G) {}
    75   } tree;
    77   } tree;
    76   do_nothing_map dist;   //node->int (W)
    78   do_nothing_map dist;   //node->int (W)
    77   do_nothing_map priority; //node->int (W)
    79   do_nothing_map priority; //node->int (W)
    78 };
    80 };
    79 
    81 
    87   
    89   
    88   struct visited_map_t {
    90   struct visited_map_t {
    89     typedef bool value_type;
    91     typedef bool value_type;
    90     void Put(const IGraph::NodeIterator &n,const value_type &t) { n->isVis=t; }
    92     void Put(const IGraph::NodeIterator &n,const value_type &t) { n->isVis=t; }
    91     value_type Get(const IGraph::NodeIterator &n) const { return n->isVis; }
    93     value_type Get(const IGraph::NodeIterator &n) const { return n->isVis; }
       
    94     void SetG(IGraph &G) {}
    92   };
    95   };
    93   struct tree_map_t {
    96   struct tree_map_t {
    94     typedef IGraph::EdgeIterator value_type;
    97     typedef IGraph::EdgeIterator value_type;
    95     void Put(const IGraph::NodeIterator &n,const value_type &t)
    98     void Put(const IGraph::NodeIterator &n,const value_type &t)
    96     { cout << t.From().Index() << "->" << t.To().Index() << '\n'; }
    99     { cout << t.From().Index() << "->" << t.To().Index() << '\n'; }
       
   100     void SetG(IGraph &G) {}
    97   };
   101   };
    98   typedef do_nothing_map dist_map_t;   //node->int (W)
   102   typedef do_nothing_map dist_map_t;   //node->int (W)
    99   typedef do_nothing_map priority_map_t; //node->int (W)
   103   typedef do_nothing_map priority_map_t; //node->int (W)
   100 };
   104 };
   101 
   105