1.1 --- a/src/demo/tight_edge_filter_map.h Sat May 21 21:04:57 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,67 +0,0 @@
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) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.8 - * (Egervary Research Group on Combinatorial Optimization, 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 - /*!
1.32 - \brief A map for filtering the edge-set to those edges
1.33 - which are tight w.r.t. a node-potential and
1.34 - edge-distance.
1.35 -
1.36 - Let \f$G=(V,A)\f$ be a directed graph (graph for short) and
1.37 - let \f$\mathbb{F}\f$ be a number type.
1.38 - Given a distance function
1.39 - \f$d:E\to\mathbb{F}\f$,
1.40 - \f$\pi:V\to\mathbb{F}\f$ is said to be a potetial
1.41 - w.r.t. \f$d\f$
1.42 - if and only if
1.43 - \f$\pi(v)\le d(uv)+\pi(u)\f$ holds for each edge \f$uv\in E\f$
1.44 - (or the reverse inequality holds for each edge).
1.45 - An edge is said to be tight if this inequality holds with equality,
1.46 - and the map returns \c true exactly for those edges.
1.47 - To avoid rounding errors, it is recommended to use this class with exact
1.48 - number types, e.g. with \c int.
1.49 - */
1.50 - template<typename Graph,
1.51 - typename NodePotentialMap, typename EdgeDistanceMap>
1.52 - class TightEdgeFilterMap : public MapBase<typename Graph::Edge, bool> {
1.53 - protected:
1.54 - const Graph* g;
1.55 - NodePotentialMap* node_potential;
1.56 - EdgeDistanceMap* edge_distance;
1.57 - public:
1.58 - TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential,
1.59 - EdgeDistanceMap& _edge_distance) :
1.60 - g(&_g), node_potential(&_node_potential),
1.61 - edge_distance(&_edge_distance) { }
1.62 - bool operator[](const typename Graph::Edge& e) const {
1.63 - return ((*node_potential)[g->target(e)] ==
1.64 - (*edge_distance)[e]+(*node_potential)[g->source(e)]);
1.65 - }
1.66 - };
1.67 -
1.68 -} //namespace lemon
1.69 -
1.70 -#endif //LEMON_TIGHT_EDGE_FILTER_MAP_H