Some bugfixes.
authordeba
Mon, 12 Sep 2005 09:15:59 +0000
changeset 1679e825655c24a4
parent 1678 b7b7125a5fe8
child 1680 4f8b9cee576b
Some bugfixes.
lemon/graph_utils.h
lemon/kruskal.h
lemon/maps.h
     1.1 --- a/lemon/graph_utils.h	Mon Sep 12 05:35:36 2005 +0000
     1.2 +++ b/lemon/graph_utils.h	Mon Sep 12 09:15:59 2005 +0000
     1.3 @@ -159,6 +159,15 @@
     1.4      return countNodeDegree<Graph, typename Graph::InEdgeIt>(_g, _n);
     1.5    }
     1.6  
     1.7 +  /// \brief Function to count the number of the in-edges to node \c n.
     1.8 +  ///
     1.9 +  /// This function counts the number of the in-edges to node \c n
    1.10 +  /// in the graph.  
    1.11 +  template <typename Graph>
    1.12 +  inline int countIncEdges(const Graph& _g,  const typename Graph::Node& _n) {
    1.13 +    return countNodeDegree<Graph, typename Graph::IncEdgeIt>(_g, _n);
    1.14 +  }
    1.15 +
    1.16  
    1.17    template <typename Graph>
    1.18    inline
    1.19 @@ -912,7 +921,7 @@
    1.20      /// The subscript operator.
    1.21      /// \param edge The edge 
    1.22      /// \return The source of the edge 
    1.23 -    Value operator[](const Key& edge) {
    1.24 +    Value operator[](const Key& edge) const {
    1.25        return graph.source(edge);
    1.26      }
    1.27  
    1.28 @@ -953,7 +962,7 @@
    1.29      /// The subscript operator.
    1.30      /// \param e The edge 
    1.31      /// \return The target of the edge 
    1.32 -    Value operator[](const Key& e) {
    1.33 +    Value operator[](const Key& e) const {
    1.34        return graph.target(e);
    1.35      }
    1.36  
     2.1 --- a/lemon/kruskal.h	Mon Sep 12 05:35:36 2005 +0000
     2.2 +++ b/lemon/kruskal.h	Mon Sep 12 09:15:59 2005 +0000
     2.3 @@ -229,7 +229,7 @@
     2.4      fillWithEdges(const _GR& g, const Map& m,dummy<0> = 0) 
     2.5      {
     2.6        for(typename GR::UndirEdgeIt e(g);e!=INVALID;++e) 
     2.7 -	push_back(value_type(typename GR::Edge(e,true), m[e]));
     2.8 +	push_back(value_type(g.direct(e, true), m[e]));
     2.9      }
    2.10  
    2.11      template<class _GR>
     3.1 --- a/lemon/maps.h	Mon Sep 12 05:35:36 2005 +0000
     3.2 +++ b/lemon/maps.h	Mon Sep 12 09:15:59 2005 +0000
     3.3 @@ -709,15 +709,16 @@
     3.4  	   typename V = typename F::result_type,
     3.5  	   typename NC = False> 
     3.6    class FunctorMap : public MapBase<K, V, NC> {
     3.7 -    const F &f;
     3.8 +    F f;
     3.9    public:
    3.10      typedef MapBase<K, V, NC> Parent;
    3.11      typedef typename Parent::Key Key;
    3.12      typedef typename Parent::Value Value;
    3.13  
    3.14      ///Constructor
    3.15 -    FunctorMap(const F &_f) : f(_f) {};
    3.16 -    Value operator[](Key k) const {return f(k);}
    3.17 +    FunctorMap(const F &_f) : f(_f) {}
    3.18 +
    3.19 +    Value operator[](Key k) const { return f(k);}
    3.20    };
    3.21    
    3.22    ///Returns a \ref FunctorMap class
    3.23 @@ -734,13 +735,13 @@
    3.24    template <typename F> inline 
    3.25    FunctorMap<F, typename F::argument_type, typename F::result_type, True> 
    3.26    functorMap(const F &f) {
    3.27 -    return functorMap<typename F::argument_type, 
    3.28 -      typename F::result_type, F>(f);
    3.29 +    return FunctorMap<F, typename F::argument_type, 
    3.30 +      typename F::result_type, True>(f);
    3.31    }
    3.32  
    3.33    template <typename K, typename V> inline 
    3.34    FunctorMap<V (*)(K), K, V, True> functorMap(V (*f)(K)) {
    3.35 -    return functorMap<K, V, V (*)(K)>(f);
    3.36 +    return FunctorMap<V (*)(K), K, V, True>(f);
    3.37    }
    3.38  
    3.39