[Lemon-commits] [lemon_svn] deba: r2198 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:50:52 CET 2006
Author: deba
Date: Mon Sep 12 11:15:59 2005
New Revision: 2198
Modified:
hugo/trunk/lemon/graph_utils.h
hugo/trunk/lemon/kruskal.h
hugo/trunk/lemon/maps.h
Log:
Some bugfixes.
Modified: hugo/trunk/lemon/graph_utils.h
==============================================================================
--- hugo/trunk/lemon/graph_utils.h (original)
+++ hugo/trunk/lemon/graph_utils.h Mon Sep 12 11:15:59 2005
@@ -159,6 +159,15 @@
return countNodeDegree<Graph, typename Graph::InEdgeIt>(_g, _n);
}
+ /// \brief Function to count the number of the in-edges to node \c n.
+ ///
+ /// This function counts the number of the in-edges to node \c n
+ /// in the graph.
+ template <typename Graph>
+ inline int countIncEdges(const Graph& _g, const typename Graph::Node& _n) {
+ return countNodeDegree<Graph, typename Graph::IncEdgeIt>(_g, _n);
+ }
+
template <typename Graph>
inline
@@ -912,7 +921,7 @@
/// The subscript operator.
/// \param edge The edge
/// \return The source of the edge
- Value operator[](const Key& edge) {
+ Value operator[](const Key& edge) const {
return graph.source(edge);
}
@@ -953,7 +962,7 @@
/// The subscript operator.
/// \param e The edge
/// \return The target of the edge
- Value operator[](const Key& e) {
+ Value operator[](const Key& e) const {
return graph.target(e);
}
Modified: hugo/trunk/lemon/kruskal.h
==============================================================================
--- hugo/trunk/lemon/kruskal.h (original)
+++ hugo/trunk/lemon/kruskal.h Mon Sep 12 11:15:59 2005
@@ -229,7 +229,7 @@
fillWithEdges(const _GR& g, const Map& m,dummy<0> = 0)
{
for(typename GR::UndirEdgeIt e(g);e!=INVALID;++e)
- push_back(value_type(typename GR::Edge(e,true), m[e]));
+ push_back(value_type(g.direct(e, true), m[e]));
}
template<class _GR>
Modified: hugo/trunk/lemon/maps.h
==============================================================================
--- hugo/trunk/lemon/maps.h (original)
+++ hugo/trunk/lemon/maps.h Mon Sep 12 11:15:59 2005
@@ -709,15 +709,16 @@
typename V = typename F::result_type,
typename NC = False>
class FunctorMap : public MapBase<K, V, NC> {
- const F &f;
+ F f;
public:
typedef MapBase<K, V, NC> Parent;
typedef typename Parent::Key Key;
typedef typename Parent::Value Value;
///Constructor
- FunctorMap(const F &_f) : f(_f) {};
- Value operator[](Key k) const {return f(k);}
+ FunctorMap(const F &_f) : f(_f) {}
+
+ Value operator[](Key k) const { return f(k);}
};
///Returns a \ref FunctorMap class
@@ -734,13 +735,13 @@
template <typename F> inline
FunctorMap<F, typename F::argument_type, typename F::result_type, True>
functorMap(const F &f) {
- return functorMap<typename F::argument_type,
- typename F::result_type, F>(f);
+ return FunctorMap<F, typename F::argument_type,
+ typename F::result_type, True>(f);
}
template <typename K, typename V> inline
FunctorMap<V (*)(K), K, V, True> functorMap(V (*f)(K)) {
- return functorMap<K, V, V (*)(K)>(f);
+ return FunctorMap<V (*)(K), K, V, True>(f);
}
More information about the Lemon-commits
mailing list