- 'KruskalPairVec' is changed to 'KruskalMapInput'.
authoralpar
Wed, 04 Aug 2004 19:04:42 +0000
changeset 755a8c2e828ce0b
parent 754 2471ef33b4a0
child 756 c54cf1e83039
- 'KruskalPairVec' is changed to 'KruskalMapInput'.
- Changes in KruskalMapVec. Still does not work.
src/work/johanna/kruskal.h
     1.1 --- a/src/work/johanna/kruskal.h	Wed Aug 04 18:56:12 2004 +0000
     1.2 +++ b/src/work/johanna/kruskal.h	Wed Aug 04 19:04:42 2004 +0000
     1.3 @@ -117,7 +117,7 @@
     1.4    /// Kruskal input source.
     1.5    ///
     1.6    template<typename Graph, typename Map>
     1.7 -  class KruskalPairVec
     1.8 +  class KruskalMapInput
     1.9      : public std::vector< std::pair<typename Graph::Edge,
    1.10  				    typename Map::ValueType> > {
    1.11      
    1.12 @@ -143,14 +143,14 @@
    1.13    public:
    1.14  
    1.15      // FIXME: kell ez?
    1.16 -    // KruskalPairVec(Parent const& p) : Parent(p) {}
    1.17 +    // KruskalMapInput(Parent const& p) : Parent(p) {}
    1.18      
    1.19      void sort() {
    1.20        std::sort(this->begin(), this->end(), comparePair());
    1.21      }
    1.22  
    1.23      // FIXME: nem nagyon illik ez ide...
    1.24 -    KruskalPairVec(Graph const& G, Map const& m) {
    1.25 +    KruskalMapInput(Graph const& G, Map const& m) {
    1.26        typedef typename Graph::EdgeIt EdgeIt;
    1.27        
    1.28        this->clear();
    1.29 @@ -169,21 +169,46 @@
    1.30    };
    1.31  
    1.32  
    1.33 -//   template <typename Map>
    1.34 -//   class KruskalMapVec : public std::vector<typename Map::KeyType> {
    1.35 +//   template<typename Graph, typename Map>
    1.36 +//   class KruskalMapVec {
    1.37  //   public:
    1.38      
    1.39 -//     typedef typename Map::KeyType KeyType;
    1.40 -//     typedef typename Map::ValueType ValueType;
    1.41 +//     typedef std::pair<typename Map::KeyType, Map::ValueType> value_type;
    1.42 +    
    1.43 +//     typedef std::vector<KeyType> Container;
    1.44 +//     Container container;
    1.45 +//     std::vector<typename Map::KeyType> container
    1.46 +//     const Map &m;
    1.47 +    
    1.48 +    
    1.49 +//     class iterator
    1.50 +//     {
    1.51 +//       Container::iterator i;
    1.52 +//     public:
    1.53 +//       iterator &operator ++() {++i;return *this;}
    1.54 +//       valuetype operator *() {return value_type(container(i),m[container(i)]);}
    1.55 +//       bool operator==(iterator b) {return i==b.i;}
    1.56 +//       iterator() {}
    1.57 +//       iterator(Container::iterator _i) i(_i) {}
    1.58 +//     };
    1.59 +//     class const_iterator
    1.60 +//     {
    1.61 +//       Container::const_iterator i;
    1.62 +//     public:
    1.63 +//       iterator &operator ++() {++i;return *this;}
    1.64 +//       valuetype operator *() {return value_type(container(i),m[container(i)]);}
    1.65 +//       bool operator==(iterator b) {return i==b.i;}
    1.66 +//       const_iterator() {}
    1.67 +//       const_iterator(Container::iterator _i) i(_i) {}
    1.68 +//     };
    1.69  
    1.70 -//     typedef typename std::vector<KeyType> Parent;
    1.71 -//     typedef typename Parent::iterator iterator;
    1.72 -//     typedef typename Parent::const_iterator const_iterator;
    1.73 -
    1.74 +//     iterator begin() { return iterator(container.begin());}
    1.75 +//     const_iterator begin() const { return iterator(container.begin());}
    1.76 +//     iterator end() { return iterator(container.end());}
    1.77 +//     const_iterator end() const { return iterator(container.end());}
    1.78 +    
    1.79  //   private:
    1.80 -
    1.81 -//     const Map &m;
    1.82 -
    1.83 +    
    1.84  //     class compareKeys {
    1.85  //       const Map &m;
    1.86  //     public:
    1.87 @@ -221,6 +246,7 @@
    1.88  //     ValueType& second(iterator i) { return m[*i]; }
    1.89  //   };
    1.90  
    1.91 +
    1.92    /* ** ** Wrapper fuggvenyek ** ** */
    1.93  
    1.94  
    1.95 @@ -236,7 +262,7 @@
    1.96  			EdgeCostMap const& edge_costs,
    1.97  			RetEdgeBoolMap &ret_bool_map) {
    1.98      
    1.99 -    typedef KruskalPairVec<Graph,EdgeCostMap> InputVec;
   1.100 +    typedef KruskalMapInput<Graph,EdgeCostMap> InputVec;
   1.101      
   1.102      InputVec iv(G, edge_costs);
   1.103      return kruskal(G, iv, ret_bool_map);
   1.104 @@ -260,7 +286,7 @@
   1.105      typedef SequenceOutput<RetIterator> OutMap;
   1.106      OutMap out(ret_iterator);
   1.107  
   1.108 -    typedef KruskalPairVec<Graph, EdgeCostMap> InputVec;
   1.109 +    typedef KruskalMapInput<Graph, EdgeCostMap> InputVec;
   1.110  
   1.111      InputVec iv(G, edge_costs);
   1.112