1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/demo/tight_edge_filter_map.h Thu Sep 30 16:08:20 2004 +0000
1.3 @@ -0,0 +1,63 @@
1.4 +/* -*- C++ -*-
1.5 + * src/lemon/tight_edge_filter_map.h - Part of LEMON, a generic C++ optimization library
1.6 + *
1.7 + * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.8 + * (Egervary Combinatorial Optimization Research Group, EGRES).
1.9 + *
1.10 + * Permission to use, modify and distribute this software is granted
1.11 + * provided that this copyright notice appears in all copies. For
1.12 + * precise terms see the accompanying LICENSE file.
1.13 + *
1.14 + * This software is provided "AS IS" with no warranty of any kind,
1.15 + * express or implied, and with no claim as to its suitability for any
1.16 + * purpose.
1.17 + *
1.18 + */
1.19 +
1.20 +#ifndef LEMON_TIGHT_EDGE_FILTER_MAP_H
1.21 +#define LEMON_TIGHT_EDGE_FILTER_MAP_H
1.22 +
1.23 +#include <lemon/maps.h>
1.24 +
1.25 +// /// \file
1.26 +// /// \brief Maximum flow algorithms.
1.27 +// /// \ingroup galgs
1.28 +
1.29 +namespace lemon {
1.30 +
1.31 + /// \brief A map for filtering the edge-set to those edges
1.32 + /// which are tight w.r.t. some node_potential map and
1.33 + /// edge_distance map.
1.34 + ///
1.35 + /// A node-map node_potential is said to be a potential w.r.t.
1.36 + /// an edge-map edge_distance
1.37 + /// if and only if for each edge e, node_potential[g.head(e)]
1.38 + /// <= edge_distance[e]+node_potential[g.tail(e)]
1.39 + /// (or the reverse inequality holds for each edge).
1.40 + /// An edge is said to be tight if this inequality holds with equality,
1.41 + /// and the map returns true exactly for those edges.
1.42 + /// To avoid rounding errors, it is recommended to use this class with exact
1.43 + /// types, e.g. with int.
1.44 + template<typename Graph,
1.45 + typename NodePotentialMap, typename EdgeDistanceMap>
1.46 + class TightEdgeFilterMap : public MapBase<typename Graph::Edge, bool> {
1.47 + protected:
1.48 + const Graph* g;
1.49 + NodePotentialMap* node_potential;
1.50 + EdgeDistanceMap* edge_distance;
1.51 + public:
1.52 + TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential,
1.53 + EdgeDistanceMap& _edge_distance) :
1.54 + g(&_g), node_potential(&_node_potential),
1.55 + edge_distance(&_edge_distance) { }
1.56 + bool operator[](const typename Graph::Edge& e) const {
1.57 + return ((*node_potential)[g->head(e)] ==
1.58 + (*edge_distance)[e]+(*node_potential)[g->tail(e)]);
1.59 + }
1.60 + };
1.61 +
1.62 +} //namespace lemon
1.63 +
1.64 +#endif //LEMON_TIGHT_EDGE_FILTER_MAP_H
1.65 +
1.66 +
2.1 --- a/src/lemon/attic/tight_edge_filter_map.h Thu Sep 30 10:15:52 2004 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,63 +0,0 @@
2.4 -/* -*- C++ -*-
2.5 - * src/lemon/tight_edge_filter_map.h - Part of LEMON, a generic C++ optimization library
2.6 - *
2.7 - * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
2.8 - * (Egervary Combinatorial Optimization Research Group, EGRES).
2.9 - *
2.10 - * Permission to use, modify and distribute this software is granted
2.11 - * provided that this copyright notice appears in all copies. For
2.12 - * precise terms see the accompanying LICENSE file.
2.13 - *
2.14 - * This software is provided "AS IS" with no warranty of any kind,
2.15 - * express or implied, and with no claim as to its suitability for any
2.16 - * purpose.
2.17 - *
2.18 - */
2.19 -
2.20 -#ifndef LEMON_TIGHT_EDGE_FILTER_MAP_H
2.21 -#define LEMON_TIGHT_EDGE_FILTER_MAP_H
2.22 -
2.23 -#include <lemon/maps.h>
2.24 -
2.25 -// /// \file
2.26 -// /// \brief Maximum flow algorithms.
2.27 -// /// \ingroup galgs
2.28 -
2.29 -namespace lemon {
2.30 -
2.31 - /// \brief A map for filtering the edge-set to those edges
2.32 - /// which are tight w.r.t. some node_potential map and
2.33 - /// edge_distance map.
2.34 - ///
2.35 - /// A node-map node_potential is said to be a potential w.r.t.
2.36 - /// an edge-map edge_distance
2.37 - /// if and only if for each edge e, node_potential[g.head(e)]
2.38 - /// <= edge_distance[e]+node_potential[g.tail(e)]
2.39 - /// (or the reverse inequality holds for each edge).
2.40 - /// An edge is said to be tight if this inequality holds with equality,
2.41 - /// and the map returns true exactly for those edges.
2.42 - /// To avoid rounding errors, it is recommended to use this class with exact
2.43 - /// types, e.g. with int.
2.44 - template<typename Graph,
2.45 - typename NodePotentialMap, typename EdgeDistanceMap>
2.46 - class TightEdgeFilterMap : public MapBase<typename Graph::Edge, bool> {
2.47 - protected:
2.48 - const Graph* g;
2.49 - NodePotentialMap* node_potential;
2.50 - EdgeDistanceMap* edge_distance;
2.51 - public:
2.52 - TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential,
2.53 - EdgeDistanceMap& _edge_distance) :
2.54 - g(&_g), node_potential(&_node_potential),
2.55 - edge_distance(&_edge_distance) { }
2.56 - bool operator[](const typename Graph::Edge& e) const {
2.57 - return ((*node_potential)[g->head(e)] ==
2.58 - (*edge_distance)[e]+(*node_potential)[g->tail(e)]);
2.59 - }
2.60 - };
2.61 -
2.62 -} //namespace lemon
2.63 -
2.64 -#endif //LEMON_TIGHT_EDGE_FILTER_MAP_H
2.65 -
2.66 -